Fix sphinx get_toc_tree deprecation

This commit is contained in:
Kovid Goyal 2019-01-18 11:01:48 +05:30
parent bd9de17f37
commit b5dff9ba89
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -3,6 +3,7 @@
from docutils import nodes
from itertools import count
from sphinx.environment.adapters.toctree import TocTree
id_counter = count()
ID = 'sidebar-collapsible-toc'
@ -69,7 +70,8 @@ def modify_li(li):
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:
subtree = toctree[toctree.first_child_matching_class(nodes.list_item)]
bl = subtree.first_child_matching_class(nodes.bullet_list)