Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 58fede1

Browse filesBrowse files
authored
for non-html output, let sphinx pick the best format (cherry-p… (#14788)
for non-html output, let sphinx pick the best format (cherry-pick cha…
2 parents eda29e1 + 486b385 commit 58fede1
Copy full SHA for 58fede1

File tree

Expand file treeCollapse file tree

1 file changed

+3
-22
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-22
lines changed

‎lib/matplotlib/sphinxext/plot_directive.py

Copy file name to clipboardExpand all lines: lib/matplotlib/sphinxext/plot_directive.py
+3-22Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def remove_coding(text):
357357
TEMPLATE = """
358358
{{ source_code }}
359359
360-
{{ only_html }}
360+
.. only:: html
361361
362362
{% if source_link or (html_show_formats and not multi_image) %}
363363
(
@@ -393,27 +393,15 @@ def remove_coding(text):
393393
{{ caption }}
394394
{% endfor %}
395395
396-
{{ only_latex }}
396+
.. only:: not html
397397
398398
{% for img in images %}
399-
{% if 'pdf' in img.formats -%}
400-
.. figure:: {{ build_dir }}/{{ img.basename }}.pdf
399+
.. figure:: {{ build_dir }}/{{ img.basename }}.*
401400
{% for option in options -%}
402401
{{ option }}
403402
{% endfor %}
404403
405404
{{ caption }}
406-
{% endif -%}
407-
{% endfor %}
408-
409-
{{ only_texinfo }}
410-
411-
{% for img in images %}
412-
.. image:: {{ build_dir }}/{{ img.basename }}.png
413-
{% for option in options -%}
414-
{{ option }}
415-
{% endfor %}
416-
417405
{% endfor %}
418406
419407
"""
@@ -813,10 +801,6 @@ def run(arguments, content, options, state_machine, state, lineno):
813801
':%s: %s' % (key, val) for key, val in six.iteritems(options)
814802
if key in ('alt', 'height', 'width', 'scale', 'align', 'class')]
815803

816-
only_html = ".. only:: html"
817-
only_latex = ".. only:: latex"
818-
only_texinfo = ".. only:: texinfo"
819-
820804
# Not-None src_link signals the need for a source link in the generated
821805
# html
822806
if j == 0 and config.plot_html_show_source_link:
@@ -830,9 +814,6 @@ def run(arguments, content, options, state_machine, state, lineno):
830814
build_dir=build_dir_link,
831815
source_link=src_link,
832816
multi_image=len(images) > 1,
833-
only_html=only_html,
834-
only_latex=only_latex,
835-
only_texinfo=only_texinfo,
836817
options=opts,
837818
images=images,
838819
source_code=source_code,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.