-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nbsphinx
TocTree broken monkey-patching
#11589
Comments
This is odd, as the A |
import sphinx.environment.adapters.toctree
from sphinx import addnodes
original_toctree_resolve = sphinx.environment.adapters.toctree._resolve_toctree
def patched_toctree_resolve(env, docname, builder, toctree, *args, **kwargs):
print(toctree.get('nbsphinx_gallery', ...))
node = original_toctree_resolve(env, docname, builder, toctree, *args, **kwargs)
return node
def doctree_resolved(app, doctree, fromdocname):
for node in doctree.findall(addnodes.toctree):
node['nbsphinx_gallery'] = True
def setup(app):
app.connect('doctree-resolved', doctree_resolved)
sphinx.environment.adapters.toctree._resolve_toctree = patched_toctree_resolve
return {'version': 1, 'parallel_read_safe': True, 'parallel_write_safe': True} |
@mgeier it turns out that the problem here is the patching itself--by changing from See aecebce A |
Thanks a lot @AA-Turner for looking into this and for fixing it on the Sphinx side! I've fixed |
Originally posted by @mgeier in #11565 (comment)
The text was updated successfully, but these errors were encountered: