Skip to content

Commit

Permalink
Merge pull request #5187 from minrk/ensure-metadata
Browse files Browse the repository at this point in the history
handle missing output metadata in nbconvert
  • Loading branch information
ellisonbg committed Feb 22, 2014
2 parents 69f1f3b + a98425e commit f25b06c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions IPython/nbconvert/templates/html/basic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,21 @@ unknown type {{ cell.type }}
{% block data_png %}
<img src="data:image/png;base64,{{ output.png }}"
{%- if 'width' in output.metadata.get('png', {}) %}
{%- if 'metadata' in output and 'width' in output.metadata.get('png', {}) %}
width={{output.metadata['png']['width']}}
{%- endif %}
{%- if 'height' in output.metadata.get('png', {}) %}
{%- if 'metadata' in output and 'height' in output.metadata.get('png', {}) %}
height={{output.metadata['png']['height']}}
{%- endif %}
>
{%- endblock data_png %}
{% block data_jpg %}
<img src="data:image/jpeg;base64,{{ output.jpeg }}"
{%- if 'width' in output.metadata.get('jpeg', {}) %}
{%- if 'metadata' in output and 'width' in output.metadata.get('jpeg', {}) %}
width={{output.metadata['jpeg']['width']}}
{%- endif %}
{%- if 'height' in output.metadata.get('jpeg', {}) %}
{%- if 'metadata' in output and 'height' in output.metadata.get('jpeg', {}) %}
height={{output.metadata['jpeg']['height']}}
{%- endif %}
>
Expand Down

0 comments on commit f25b06c

Please sign in to comment.