Skip to content

Commit

Permalink
Merge pull request #6238 from jenshnielsen/fixsphinx140issues
Browse files Browse the repository at this point in the history
Fix sphinx 1.4.0 issues
  • Loading branch information
tacaswell committed Mar 30, 2016
2 parents 3174f25 + 7f18df6 commit 1bc63cc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Expand Up @@ -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'),
Expand All @@ -139,7 +139,7 @@
('axisartist', 'axisartist toolkit'),
('units', 'units'),
('widgets', 'widgets'),
)
]


# Github extension
Expand Down
13 changes: 6 additions & 7 deletions lib/matplotlib/sphinxext/mathmpl.py
Expand Up @@ -87,16 +87,15 @@ def latex2html(node, source):

return '<img src="%s/%s.png" %s%s/>' % (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

Expand All @@ -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)
16 changes: 10 additions & 6 deletions lib/matplotlib/sphinxext/only_directives.py
Expand Up @@ -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
Expand All @@ -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))

0 comments on commit 1bc63cc

Please sign in to comment.