Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sphinx 1.4.0 issues #6238

Merged
merged 4 commits into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
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))