mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix sphinx get_toc_tree deprecation
This commit is contained in:
parent
bd9de17f37
commit
b5dff9ba89
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from itertools import count
|
from itertools import count
|
||||||
|
from sphinx.environment.adapters.toctree import TocTree
|
||||||
|
|
||||||
id_counter = count()
|
id_counter = count()
|
||||||
ID = 'sidebar-collapsible-toc'
|
ID = 'sidebar-collapsible-toc'
|
||||||
@ -69,7 +70,8 @@ def modify_li(li):
|
|||||||
|
|
||||||
|
|
||||||
def create_toc(app, pagename):
|
def create_toc(app, pagename):
|
||||||
toctree = app.env.get_toc_for(pagename, app.builder)
|
tt = TocTree(app.env)
|
||||||
|
toctree = tt.get_toc_for(pagename, app.builder)
|
||||||
if toctree is not None:
|
if toctree is not None:
|
||||||
subtree = toctree[toctree.first_child_matching_class(nodes.list_item)]
|
subtree = toctree[toctree.first_child_matching_class(nodes.list_item)]
|
||||||
bl = subtree.first_child_matching_class(nodes.bullet_list)
|
bl = subtree.first_child_matching_class(nodes.bullet_list)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user