8000 Merge pull request #986 from tkf/texinfo · matplotlib/matplotlib@4cf846d · GitHub
[go: up one dir, main page]

Skip to content

Commit 4cf846d

Browse files
committed
Merge pull request #986 from tkf/texinfo
Add texinfo build target in doc/make.py
2 parents 97617ff + 9951938 commit 4cf846d

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

doc/conf.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,10 @@
188188
rst_epilog = """
189189
.. |minimum_numpy_version| replace:: %s
190190
""" % matplotlib.__version__numpy__
191+
192+
texinfo_documents = [
193+
("contents", 'matplotlib', 'Matplotlib Documentation',
194+
'Darren Dale@*Michael Droettboom@*Eric Firing@*John Hunter',
195+
'Matplotlib', "Python plotting package", 'Programming',
196+
1),
197+
]

doc/make.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def copy_if_out_of_date(original, derived):
114114

115115
def check_build():
116116
build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex',
117-
'_static', '_templates']
117+
'build/texinfo', '_static', '_templates']
118118
for d in build_dirs:
119119
try:
120120
os.mkdir(d)
@@ -173,6 +173,26 @@ def latex():
173173
else:
174174
print('latex build has not been tested on windows')
175175

176+
def texinfo():
177+
check_build()
178+
#figs()
179+
if sys.platform != 'win32':
180+
# Texinfo format.
181+
if os.system(
182+
'sphinx-build -b texinfo -d build/doctrees . build/texinfo'):
183+
raise SystemExit("Building Texinfo failed.")
184+
185+
# Produce info file.
186+
os.chdir('build/texinfo')
187+
188+
# Call the makefile produced by sphinx...
189+
if os.system('make'):
190+
raise SystemExit("Rendering Texinfo failed.")
191+
192+
os.chdir('../..')
193+
else:
194+
print('texinfo build has not been tested on windows')
195+
176196
def clean():
177197
shutil.rmtree("build", ignore_errors=True)
178198
shutil.rmtree("examples", ignore_errors=True)
@@ -198,6 +218,7 @@ def all():
198218
'figs' : figs,
199219
'html' : html,
200220
'latex' : latex,
221+
'texinfo' : texinfo,
201222
'clean' : clean,
202223
'sf' : sf,
203224
'sfpdf' : sfpdf,

lib/matplotlib/sphinxext/plot_directive.py

Lines changed: 12 additions & 0 deletions
423
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,16 @@ def split_code_at_show(text):
414414
.. image:: {{ build_dir }}/{{ img.basename }}.pdf
415415
{% endfor %}
416416
417+
{{ only_texinfo }}
418+
419+
{% for img in images %}
420+
.. image:: {{ build_dir }}/{{ img.basename }}.png
421+
{%- for option in options %}
422+
{{ option }}
+
{% endfor %}
424+
425+
{% endfor %}
426+
417427
"""
418428

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

759769
only_html = ".. only:: html"
760770
only_latex = ".. only:: latex"
771+
only_texinfo = ".. only:: texinfo"
761772

762773
if j == 0:
763774
src_link = source_link
@@ -772,6 +783,7 @@ def run(arguments, content, options, state_machine, state, lineno):
772783
multi_image=len(images) > 1,
773784
only_html=only_html,
774785
only_latex=only_latex,
786+
only_texinfo=only_texinfo,
775787
options=opts,
776788
images=images,
777789
source_code=source_code,

0 commit comments

Comments
 (0)
0