Skip to content

Commit

Permalink
Merge pull request matplotlib#6238 from jenshnielsen/fixsphinx140issues
Browse files Browse the repository at this point in the history
Fix sphinx 1.4.0 issues

Conflicts:
    .travis.yml
        Reject all changes
  • Loading branch information
tacaswell authored and bearstrong committed Apr 1, 2016
1 parent 5a0267c commit 5fad52f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -138,7 +138,7 @@
('axes_grid', 'axes_grid toolkit'),
('units', 'units'),
('widgets', 'widgets'),
)
]


# Github extension
Expand Down
13 changes: 6 additions & 7 deletions lib/matplotlib/sphinxext/mathmpl.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 5fad52f

Please sign in to comment.