diff --git a/doc/conf.py b/doc/conf.py index 592b349ca104..d92366401287 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -118,7 +118,7 @@ plot_formats = [('png', 80), ('hires.png', 200), ('pdf', 50)] # Subdirectories in 'examples/' directory of package and titles for gallery -mpl_example_sections = ( +mpl_example_sections = [ ('lines_bars_and_markers', 'Lines, bars, and markers'), ('shapes_and_collections', 'Shapes and collections'), ('statistics', 'Statistical plots'), @@ -138,7 +138,7 @@ ('axes_grid', 'axes_grid toolkit'), ('units', 'units'), ('widgets', 'widgets'), - ) + ] # Github extension diff --git a/lib/matplotlib/sphinxext/mathmpl.py b/lib/matplotlib/sphinxext/mathmpl.py index f44c1d75625a..8fc7ed2b3d2e 100644 --- a/lib/matplotlib/sphinxext/mathmpl.py +++ b/lib/matplotlib/sphinxext/mathmpl.py @@ -87,16 +87,15 @@ def latex2html(node, source): return '' % (path, name, cls, style) + def setup(app): setup.app = app - app.add_node(latex_math) - app.add_role('math', math_role) - # Add visit/depart methods to HTML-Translator: def visit_latex_math_html(self, node): source = self.document.attributes['source'] self.body.append(latex2html(node, source)) + def depart_latex_math_html(self, node): pass @@ -109,13 +108,13 @@ def visit_latex_math_latex(self, node): self.body.extend(['\\begin{equation}', node['latex'], '\\end{equation}']) + def depart_latex_math_latex(self, node): pass - app.add_node(latex_math, html=(visit_latex_math_html, - depart_latex_math_html)) - app.add_node(latex_math, latex=(visit_latex_math_latex, - depart_latex_math_latex)) + app.add_node(latex_math, + html=(visit_latex_math_html, depart_latex_math_html), + latex=(visit_latex_math_latex, depart_latex_math_latex)) app.add_role('math', math_role) app.add_directive('math', math_directive, True, (0, 0, 0), **options_spec) diff --git a/lib/matplotlib/sphinxext/only_directives.py b/lib/matplotlib/sphinxext/only_directives.py index fdc8000ab9b1..05b99b38ffb4 100644 --- a/lib/matplotlib/sphinxext/only_directives.py +++ b/lib/matplotlib/sphinxext/only_directives.py @@ -41,11 +41,10 @@ def builder_inited(app): else: html_only.traverse = only_base.dont_traverse + def setup(app): app.add_directive('htmlonly', html_only_directive, True, (0, 0, 0)) app.add_directive('latexonly', latex_only_directive, True, (0, 0, 0)) - app.add_node(html_only) - app.add_node(latex_only) # This will *really* never see the light of day As it turns out, # this results in "broken" image nodes since they never get @@ -55,14 +54,19 @@ def setup(app): # Add visit/depart methods to HTML-Translator: def visit_perform(self, node): pass + def depart_perform(self, node): pass + def visit_ignore(self, node): node.children = [] + def depart_ignore(self, node): node.children = [] - app.add_node(html_only, html=(visit_perform, depart_perform)) - app.add_node(html_only, latex=(visit_ignore, depart_ignore)) - app.add_node(latex_only, latex=(visit_perform, depart_perform)) - app.add_node(latex_only, html=(visit_ignore, depart_ignore)) + app.add_node(html_only, + html=(visit_perform, depart_perform), + latex=(visit_ignore, depart_ignore)) + app.add_node(latex_only, + latex=(visit_perform, depart_perform), + html=(visit_ignore, depart_ignore))