On Tue, Nov 29, 2011 at 15:59, Olivier Bonaventure
<olivier.bonavent...@uclouvain.be> wrote:
> Hello,
>
> I'm currently using sphinx to write an open-source networking texbook
> that explains the principles of computer networks and the TCP/IP
> protocol suite. sphinx is really nice because it allows me to focus on
> the content without having to think too much about the layout. The
> objective is to distribute it as an epub ebook in the coming months.
>
> The current text is structured in five main chapters (see
> http://inl.info.ucl.ac.be/cnp3 for HTML version
> entire rst code is available at
> https://scm.info.ucl.ac.be/trac/cnp3/browser/book )
>
> Unfortunately, a chapter can be long and can contain lots of figures and
> exercises. To allow the HTML pages to be easier to download, I'd like to
> configure sphinx to generate one HTML page per subsection or
> subsubsection instead of the current default of one page per section.
>
> I could not find a solution until now in the HTML output. Is there a
> hidden solution somewhere ? It would be nice to be able to configure
> sphinx to split the HTML files at section, subsection, subsubsection or
> other boundaries.
>
> Thanks
>
>
> Olivier

Hi Oliver,

I wrote something a while back to do exactly what you asked for (and a
few other things). The code and an example is available at
http://ucomment.org.

In short, Sphinx doesn't have a way to split up the sections. What I
did was to parse the RST source, split it, and write the sections to
new RST files. Then modify the toctree to handle those split sections
so that when Sphinx sees the directories and files it will compile
each section to its own HTML page.

The relevant code is here:
https://bitbucket.org/kevindunn/ucommentapp/src/c0b839e548b7/sphinx-extensions/ucomment-extension.py
in the split_rst_files(...) function.

Hope that helps get you started.
Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to