This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author grflanagan
Recipients georg.brandl, grflanagan
Date 2008-06-25.20:36:24
SpamBayes Score 0.003855079
Marked as misclassified No
Message-id <1214426188.21.0.172463487619.issue3203@psf.upfronthosting.co.za>
In-reply-to
Content
A TOC tree should render in HTML as a single 'ul', but in certain
circumstances it appears as multiple ul's.

You can see the effect here:

    http://docs.python.org/dev/c-api/index.html

and in fact in the Sphinx documentation itself:

    http://sphinx.pocoo.org/contents.html

the 'toctree' here is not an individual entity but a vertical series of
ul's, each of which has a *single* item (li). You may be able to see the
slightly increased space between the ul's which would not be present if
these were all the children of a single parent.

This should be changed so that pages have a unique 'toc' element because:

- it would be easier for css and javascript to manipulate
- there may be accessibility issues (eg. non-visual readers may not 
identify the toc as a single sequence of alternatives)

The reason for the current behaviour can be found in the method
'resolve_toctree' of class sphinx.environment.BuildEnvironment, line 863::

      newnode = addnodes.compact_paragraph('', '', *tocentries)

`tocentries` is a list of `toctrees` [<toctree>, <toctree>,..] each of
which will end up as a ul, while a compact_paragraph has no html
representation; hence the observed effect.

One way to fix this is to replace the above line with the following::

        newnode = nodes.bullet_list()
        for entry in tocentries:
            for item in entry.children:
                assert isinstance(item, nodes.list_item)
                newnode.append(item)

(and you can also take the opportunity here to add a unique id::

        newnode['ids'].append('toc')
)

Note that this new code is a noop if `tocentries` only has one element,
at least as far as html is concerned.
History
Date User Action Args
2008-06-25 20:36:28grflanagansetspambayes_score: 0.00385508 -> 0.003855079
recipients: + grflanagan, georg.brandl
2008-06-25 20:36:28grflanagansetspambayes_score: 0.00385508 -> 0.00385508
messageid: <1214426188.21.0.172463487619.issue3203@psf.upfronthosting.co.za>
2008-06-25 20:36:27grflanaganlinkissue3203 messages
2008-06-25 20:36:25grflanagancreate