Pavel Kosina wrote:
>
>>
>>> * in the index.html the list of pages, created from toctree - the
>>> bullets (black circle) should be configurable - yes/no. If main
>>> headings are numbered, than there is disturbing bullet in front of the
>>> number.
This can be configured in css - for example:
ul { list-style-type: none }
Georg Brandl napsal(a):
Good point. Do you want to work on a patch?
>>
I think I sent this patch to you (Georg) before but I'll attach it again
here in case
it was lost in the ether, or so that others might improve upon it.
It allows a finer control of the toctree and its items, for example:
http://thehazeltree.org/contents.html
Gerard
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en
-~----------~----~----~----~------~----~------~--~---
Index: environment.py
===================================================================
--- environment.py (revision 64573)
+++ environment.py (working copy)
@@ -682,10 +682,24 @@
reference = nodes.reference('', '', refuri=docname,
anchorname=anchorname,
*nodetext)
+ reference['classes'].append('toclink')
para = addnodes.compact_paragraph('', '', reference)
item = nodes.list_item('', para)
+ item['classes'].append('tocitem')
if maxdepth == 0 or depth < maxdepth:
- item += build_toc(subnode, depth+1)
+ subtoc = build_toc(subnode, depth+1)
+ if subtoc:
+ id = docname.replace('/', '-') + \
+ anchorname.replace('#', '-')
+ # link the anchor to the subtoc that it
+ # will expand when clicked
+ reference['ids'].append('tic-' + id)
+ subtoc['ids'].append('toc-' + id)
+ # make a distinction between 'leaf' links
+ # and links which have subtocs
+ reference['classes'][-1] = 'subtoc'
+ subtoc['classes'].append('subtoc')
+ item += subtoc
entries.append(item)
if entries:
return nodes.bullet_list('', *entries)
@@ -794,7 +808,7 @@
_walk_depth(subnode, depth, maxdepth, titleoverrides)
elif isinstance(subnode, nodes.bullet_list):
if depth > maxdepth:
- subnode.parent.replace(subnode, [])
+ node.replace(subnode, [])
else:
_walk_depth(subnode, depth+1, maxdepth, titleoverrides)
@@ -823,7 +837,7 @@
# resolve all sub-toctrees
for toctreenode in toc.traverse(addnodes.toctree):
i = toctreenode.parent.index(toctreenode) + 1
- for item in _entries_from_toctree(toctreenode):
+ for item in _entries_from_toctree(toctreenode, False):
toctreenode.parent.insert(i, item)
i += 1
toctreenode.parent.remove(toctreenode)
@@ -840,8 +854,13 @@
if not tocentries:
return None
- newnode = addnodes.compact_paragraph('', '', *tocentries)
+ newnode = nodes.bullet_list('')
+ for entry in tocentries:
+ for item in entry.children:
+ assert isinstance(item, nodes.list_item)
+ newnode.append(item)
newnode['toctree'] = True
+ #newnode['ids'].append('toc')
# prune the tree to maxdepth and replace titles
if maxdepth > 0 and prune:
_walk_depth(newnode, 1, maxdepth, titleoverrides)
@@ -854,6 +873,7 @@
and refnode['refuri'] in titleoverrides:
newtitle = titleoverrides[refnode['refuri']]
refnode.children = [nodes.Text(newtitle)]
+
return newnode
descroles = frozenset(('data', 'exc', 'func', 'class', 'const', 'attr',