Hi all!

I need some help with a (seemingly) very simple problem. Apologies if
it has a really obvious solution, but all my searching the web and
even asking in the chatroom has been to no avail so far.

I am using Sphinx for a software manual, which is split up into
several chapters. I am producing HTML output using both the
SingleFileHTMLBuilder (singlehtml) and the StandaloneHTMLBuilder
(html). For both of these I would like to disable the sidebar, but
since in the case of singlehtml it ordinarily contains the table of
contents I would like to put the TOC at the beginning of the document
instead. (The beginning of the manual should thus look like in the
case of the standalone html builder, except that all the content is
put directly after the TOC rather than on separate html pages.)
Unfortunately, I can't for the life of me figure out how to achieve
this, even though it looks like it must be a very common problems. Any
suggestions would be very much appreciated!


The rest of this email describes what I have tried so far (but what
doesn't work). It can be safely skipped if you know a solution
offhand. :)

1) Using a reStructuredText '.. contents::' directive. Inserting this
in the master document creates a table of contents - but this only
contains the title of the document. I assume the reason is that the
individual chapters reside in separate source files and the contents
directive only works locally?

2) Creating a custom template. I created a file 'page.html' in the
'_templates' subdirectory, with the following contents:

===>
{% extends "!page.html" %}
{% block body %}
    {{ toctree(collapse=false, maxdepth=-1) }}
    {{ super() }}
{% endblock %}
<===

This *almost* achieves what I need, but obviously the TOC is inserted
before the entire body of the document (in particular, before the
title, authors, etc.). What I would need to do is "enter" the body
block somehow and put the toctree() command there, but I couldn't
figure out how to do this. As an aside, can I specify that the
modified template should only be used for the singlehtml builder, not
for the standalone one?

3) Creating a custom extension. My last thought was that perhaps I
could write a custom extension providing a 'mytoctree' directive,
which would just display the contents of the internal document tree. I
made a bit of progress in this direction but didn't get too far, and
then thought the problem must be much easier to solve than by hours of
programming (even though it might be fun :) ).

Many thanks if you have read this far!! Again, any hints or (even
partial) solutions are very much appreciated.

Best regards,
Max

-- 
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