From 14b1cdb16be0200486e918d0486d3425c30067c8 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 29 Mar 2016 13:11:22 +0100 Subject: [PATCH 1/4] Make mpl_examples+sections a list not a tuple. Other parts of the code overwrites this with a list, fixes one sphinx warning with sphinx 1.4.0 --- doc/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index a6b769d7972..c0aea51fb76 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -118,7 +118,7 @@ plot_formats = [('svg', 72), ('png', 80)] # 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'), @@ -139,7 +139,7 @@ ('axisartist', 'axisartist toolkit'), ('units', 'units'), ('widgets', 'widgets'), - ) + ] # Github extension From 53489b2e18aa83b71156e3892614e0401869be28 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 29 Mar 2016 13:13:10 +0100 Subject: [PATCH 2/4] Only add nodes once in mathmpl extension. Fixes sphinx warnings --- lib/matplotlib/sphinxext/mathmpl.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/sphinxext/mathmpl.py b/lib/matplotlib/sphinxext/mathmpl.py index f44c1d75625..8fc7ed2b3d2 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) From 2917fabae60a5b5537482a0dee2c436e51d097ad Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 29 Mar 2016 13:14:26 +0100 Subject: [PATCH 3/4] Docs Only add nodes once in only directives Fix more sphinx warnings --- lib/matplotlib/sphinxext/only_directives.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/sphinxext/only_directives.py b/lib/matplotlib/sphinxext/only_directives.py index fdc8000ab9b..05b99b38ffb 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)) From 7f18df6d3ff684c1fb03ab97f12c2532b6404cd1 Mon Sep 17 00:00:00 2001 From: Jens Hedegaard Nielsen Date: Tue, 29 Mar 2016 13:15:22 +0100 Subject: [PATCH 4/4] Docs should now build with Sphinx 1.4.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 56cad11b2d2..658130c8432 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,7 +86,7 @@ install: fi # Always install from pypi pip install $PRE pep8 cycler coveralls coverage python-dateutil pyparsing!=2.0.4 - pip install pillow sphinx==1.3.6 $MOCK numpydoc ipython colorspacious + pip install pillow sphinx!=1.3.0 $MOCK numpydoc ipython colorspacious # Install nose from a build which has partial # support for python36 and suport for coverage output suppressing pip install git+https://github.com/jenshnielsen/nose.git@matplotlibnose