10000 Only add nodes once in mathmpl extension. · matplotlib/matplotlib@53489b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 53489b2

Browse files
committed
Only add nodes once in mathmpl extension.
Fixes sphinx warnings
1 parent 14b1cdb commit 53489b2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/matplotlib/sphinxext/mathmpl.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,15 @@ def latex2html(node, source):
8787

8888
return '<img src="%s/%s.png" %s%s/>' % (path, name, cls, style)
8989

90+
9091
def setup(app):
9192
setup.app = app
9293

93-
app.add_node(latex_math)
94-
app.add_role('math', math_role)
95-
9694
# Add visit/depart methods to HTML-Translator:
9795
def visit_latex_math_html(self, node):
9896
source = self.document.attributes['source']
9997
self.body.append(latex2html(node, source))
98+
10099
def depart_latex_math_html(self, node):
101100
pass
102101

@@ -109,13 +108,13 @@ def visit_latex_math_latex(self, node):
109108
self.body.extend(['\\begin{equation}',
110109
node['latex'],
111110
'\\end{equation}'])
111+
112112
def depart_latex_math_latex(self, node):
113113
pass
114114

115-
app.add_node(latex_math, html=(visit_latex_math_html,
116-
depart_latex_math_html))
117-
app.add_node(latex_math, latex=(visit_latex_math_latex,
118-
depart_latex_math_latex))
115+
app.add_node(latex_math,
116+
html=(visit_latex_math_html, depart_latex_math_html),
117+
latex=(visit_latex_math_latex, depart_latex_math_latex))
119118
app.add_role('math', math_role)
120119
app.add_directive('math', math_directive,
121120
True, (0, 0, 0), **options_spec)

0 commit comments

Comments
 (0)
0