@@ -348,7 +348,7 @@ def split_code_at_show(text):
348348TEMPLATE = """
349349{{ source_code }}
350350
351- {{ only_html }}
351+ .. only:: html
352352
353353 {% if source_link or (html_show_formats and not multi_image) %}
354354 (
@@ -384,29 +384,15 @@ def split_code_at_show(text):
384384 {{ caption }}
385385 {% endfor %}
386386
387- {{ only_latex }}
387+ .. only:: not html
388388
389389 {% for img in images %}
390- {% if 'pdf' in img.formats -%}
391- .. figure:: {{ build_dir }}/{{ img.basename }}.pdf
390+ .. figure:: {{ build_dir }}/{{ img.basename }}.*
392391 {% for option in options -%}
393392 {{ option }}
394393 {% endfor %}
395394
396395 {{ 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 -%}
410396 {% endfor %}
411397
412398"""
@@ -777,10 +763,6 @@ def run(arguments, content, options, state_machine, state, lineno):
777763 ':%s: %s' % (key , val ) for key , val in options .items ()
778764 if key in ('alt' , 'height' , 'width' , 'scale' , 'align' , 'class' )]
779765
780- only_html = ".. only:: html"
781- only_latex = ".. only:: latex"
782- only_texinfo = ".. only:: texinfo"
783-
784766 # Not-None src_link signals the need for a source link in the generated
785767 # html
786768 if j == 0 and config .plot_html_show_source_link :
@@ -794,9 +776,6 @@ def run(arguments, content, options, state_machine, state, lineno):
794776 build_dir = build_dir_link ,
795777 source_link = src_link ,
796778 multi_image = len (images ) > 1 ,
797- only_html = only_html ,
798- only_latex = only_latex ,
799- only_texinfo = only_texinfo ,
800779 options = opts ,
801780 images = images ,
802781 source_code = source_code ,
0 commit comments