Skip to content

Commit

Permalink
Merge pull request #986 from tkf/texinfo
Browse files Browse the repository at this point in the history
Add texinfo build target in doc/make.py
  • Loading branch information
mdboom committed Aug 20, 2012
2 parents 97617ff + 9951938 commit 4cf846d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,10 @@
rst_epilog = """
.. |minimum_numpy_version| replace:: %s
""" % matplotlib.__version__numpy__

texinfo_documents = [
("contents", 'matplotlib', 'Matplotlib Documentation',
'Darren Dale@*Michael Droettboom@*Eric Firing@*John Hunter',
'Matplotlib', "Python plotting package", 'Programming',
1),
]
23 changes: 22 additions & 1 deletion doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def copy_if_out_of_date(original, derived):

def check_build():
build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex',
'_static', '_templates']
'build/texinfo', '_static', '_templates']
for d in build_dirs:
try:
os.mkdir(d)
Expand Down Expand Up @@ -173,6 +173,26 @@ def latex():
else:
print('latex build has not been tested on windows')

def texinfo():
check_build()
#figs()
if sys.platform != 'win32':
# Texinfo format.
if os.system(
'sphinx-build -b texinfo -d build/doctrees . build/texinfo'):
raise SystemExit("Building Texinfo failed.")

# Produce info file.
os.chdir('build/texinfo')

# Call the makefile produced by sphinx...
if os.system('make'):
raise SystemExit("Rendering Texinfo failed.")

os.chdir('../..')
else:
print('texinfo build has not been tested on windows')

def clean():
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("examples", ignore_errors=True)
Expand All @@ -198,6 +218,7 @@ def all():
'figs' : figs,
'html' : html,
'latex' : latex,
'texinfo' : texinfo,
'clean' : clean,
'sf' : sf,
'sfpdf' : sfpdf,
Expand Down
12 changes: 12 additions & 0 deletions lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,16 @@ def split_code_at_show(text):
.. image:: {{ build_dir }}/{{ img.basename }}.pdf
{% endfor %}
{{ only_texinfo }}
{% for img in images %}
.. image:: {{ build_dir }}/{{ img.basename }}.png
{%- for option in options %}
{{ option }}
{% endfor %}
{% endfor %}
"""

exception_template = """
Expand Down Expand Up @@ -758,6 +768,7 @@ def run(arguments, content, options, state_machine, state, lineno):

only_html = ".. only:: html"
only_latex = ".. only:: latex"
only_texinfo = ".. only:: texinfo"

if j == 0:
src_link = source_link
Expand All @@ -772,6 +783,7 @@ def run(arguments, content, options, state_machine, state, lineno):
multi_image=len(images) > 1,
only_html=only_html,
only_latex=only_latex,
only_texinfo=only_texinfo,
options=opts,
images=images,
source_code=source_code,
Expand Down

0 comments on commit 4cf846d

Please sign in to comment.