MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / setup

Function setup

lib/matplotlib/sphinxext/mathmpl.py:202–242  ·  view source on GitHub ↗
(app)

Source from the content-addressed store, hash-verified

200
201
202def setup(app):
203 setup.app = app
204 app.add_config_value('mathmpl_fontsize', 10.0, True)
205 app.add_config_value('mathmpl_srcset', [], True)
206 try:
207 app.connect('config-inited', _config_inited) # Sphinx 1.8+
208 except ExtensionError:
209 app.connect('env-updated', lambda app, env: _config_inited(app, None))
210
211 # Add visit/depart methods to HTML-Translator:
212 def visit_latex_math_html(self, node):
213 source = self.document.attributes['source']
214 self.body.append(latex2html(node, source))
215
216 def depart_latex_math_html(self, node):
217 pass
218
219 # Add visit/depart methods to LaTeX-Translator:
220 def visit_latex_math_latex(self, node):
221 inline = isinstance(node.parent, nodes.TextElement)
222 if inline:
223 self.body.append('$%s$' % node['latex'])
224 else:
225 self.body.extend(['\\begin{equation}',
226 node['latex'],
227 '\\end{equation}'])
228
229 def depart_latex_math_latex(self, node):
230 pass
231
232 app.add_node(latex_math,
233 html=(visit_latex_math_html, depart_latex_math_html),
234 latex=(visit_latex_math_latex, depart_latex_math_latex))
235 app.add_role('mathmpl', math_role)
236 app.add_directive('mathmpl', MathDirective)
237 if sphinx.version_info < (1, 8):
238 app.add_role('math', math_role)
239 app.add_directive('math', MathDirective)
240
241 metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
242 return metadata

Callers

nothing calls this directly

Calls 2

_config_initedFunction · 0.85
connectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…