@@ -348,7 +348,7 @@ def split_code_at_show(text):
348
348
TEMPLATE = """
349
349
{{ source_code }}
350
350
351
- {{ only_html }}
351
+ .. only:: html
352
352
353
353
{% if source_link or (html_show_formats and not multi_image) %}
354
354
(
@@ -384,29 +384,15 @@ def split_code_at_show(text):
384
384
{{ caption }}
385
385
{% endfor %}
386
386
387
- {{ only_latex }}
387
+ .. only:: not html
388
388
389
389
{% for img in images %}
390
- {% if 'pdf' in img.formats -%}
391
- .. figure:: {{ build_dir }}/{{ img.basename }}.pdf
390
+ .. figure:: {{ build_dir }}/{{ img.basename }}.*
392
391
{% for option in options -%}
393
392
{{ option }}
394
393
{% endfor %}
395
394
396
395
{{ caption }}
397
- {% endif -%}
398
- {% endfor %}
399
-
400
- {{ only_texinfo }}
401
-
402
- {% for img in images %}
403
- {% if 'png' in img.formats -%}
404
- .. image:: {{ build_dir }}/{{ img.basename }}.png
405
- {% for option in options -%}
406
- {{ option }}
407
- {% endfor %}
408
-
409
- {% endif -%}
410
396
{% endfor %}
411
397
412
398
"""
@@ -777,10 +763,6 @@ def run(arguments, content, options, state_machine, state, lineno):
777
763
':%s: %s' % (key , val ) for key , val in options .items ()
778
764
if key in ('alt' , 'height' , 'width' , 'scale' , 'align' , 'class' )]
779
765
780
- only_html = ".. only:: html"
781
- only_latex = ".. only:: latex"
782
- only_texinfo = ".. only:: texinfo"
783
-
784
766
# Not-None src_link signals the need for a source link in the generated
785
767
# html
786
768
if j == 0 and config .plot_html_show_source_link :
@@ -794,9 +776,6 @@ def run(arguments, content, options, state_machine, state, lineno):
794
776
build_dir = build_dir_link ,
795
777
source_link = src_link ,
796
778
multi_image = len (images ) > 1 ,
797
- only_html = only_html ,
798
- only_latex = only_latex ,
799
- only_texinfo = only_texinfo ,
800
779
options = opts ,
801
780
images = images ,
802
781
source_code = source_code ,
0 commit comments