Skip to content

Commit

Permalink
Fix for upcoming nbconvert
Browse files Browse the repository at this point in the history
Code from spatialaudio/nbsphinx#344 with thanks.
  • Loading branch information
matthew-brett committed Jan 2, 2020
1 parent e4d0e3e commit e91fed3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nb2plots/from_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@


# Template to label code and output and plot blocks
dl = DictLoader({'rst_plots.tpl': """\
{%- extends 'rst.tpl' -%}
dl = DictLoader({'rst_plots.tpl': r"""\
{%- extends '__RST_DEFAULT_TEMPLATE__' -%}
{% block input %}
{%- if cell.source.strip() | has_mpl_inline -%}
Expand Down Expand Up @@ -50,7 +50,8 @@
{{ output.data['text/plain'] | ellipse_mpl | indent }}
##END_OUT_END##
{%- endblock data_text -%}
"""})
""".replace('__RST_DEFAULT_TEMPLATE__',
nbconvert.RSTExporter().template_file)})


def has_mpl_inline(code):
Expand Down

0 comments on commit e91fed3

Please sign in to comment.