Edit Book: When generating an inline ToC add a class attribute to all <ul> tags to make it easy to style a particular level of the ToC

This commit is contained in:
Kovid Goyal 2014-03-28 09:35:00 +05:30
parent 673a1a6a3b
commit 3469076d03

View File

@ -509,6 +509,7 @@ def create_inline_toc(container, title=None):
li.append(a)
if len(toc) > 0:
parent = li.makeelement(XHTML('ul'))
parent.set('class', 'level%d' % (level + 1))
li.append(parent)
a.tail = '\n\n' + (indent*(level+2))
parent.text = '\n'+(indent*(level+3))
@ -534,8 +535,10 @@ def create_inline_toc(container, title=None):
)
name = toc_name
ul = html[1][1]
ul.set('class', 'level1')
for child in toc:
process_node(html[1][1], child)
process_node(ul, child)
if lang:
html.set('lang', lang)
pretty_html_tree(container, html)