From e91fed368398f5877c541439c20a5ff735305c8e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 2 Jan 2020 12:21:52 +0000 Subject: [PATCH] Fix for upcoming nbconvert Code from https://github.com/spatialaudio/nbsphinx/pull/344 with thanks. --- nb2plots/from_notebook.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nb2plots/from_notebook.py b/nb2plots/from_notebook.py index 754712b..886887e 100644 --- a/nb2plots/from_notebook.py +++ b/nb2plots/from_notebook.py @@ -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 -%} @@ -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):