8000 Docs Only add nodes once in only directives · matplotlib/matplotlib@2917fab · GitHub
[go: up one dir, main page]

Skip to content

Commit 2917fab

Browse files
committed
Docs Only add nodes once in only directives
Fix more sphinx warnings
1 parent 53489b2 commit 2917fab

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/matplotlib/sphinxext/only_directives.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ def builder_inited(app):
4141
else:
4242
html_only.traverse = only_base.dont_traverse
4343

44+
4445
def setup(app):
4546
app.add_directive('htmlonly', html_only_directive, True, (0, 0, 0))
4647
app.add_directive('latexonly', latex_only_directive, True, (0, 0, 0))
47-
app.add_node(html_only)
48-
app.add_node(latex_only)
4948

5049
# This will *really* never see the light of day As it turns out,
5150
# this results in "broken" image nodes since they never get
@@ -55,14 +54,19 @@ def setup(app):
5554
# Add visit/depart methods to HTML-Translator:
5655
def visit_perform(self, node):
5756
pass
57+
5858
def depart_perform(self, node):
5959
pass
60+
6061
def visit_ignore(self, node):
6162
node.children = []
63+
6264
def depart_ignore(self, node):
6365
node.children = []
6466

65-
app.add_node(html_only, html=(visit_perform, depart_perform))
66-
app.add_node(html_only, latex=(visit_ignore, depart_ignore))
67-
app.add_node(latex_only, latex=(visit_perform, depart_perform))
68-
app.add_node(latex_only, html=(visit_ignore, depart_ignore))
67+
app.add_node(html_only,
68+
html=(visit_perform, depart_perform),
69+
latex=(visit_ignore, depart_ignore))
70+
app.add_node(latex_only,
71+
latex=(visit_perform, depart_perform),
72+
html=(visit_ignore, depart_ignore))

0 commit comments

Comments
 (0)
0