From c46892012f465aa7afdeaa18f080d0266f99cfde Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Sun, 10 Nov 2019 03:58:32 +0000 Subject: [PATCH] move ipywidget check to template checking the metadata does not work with the execution post-processor --- ipypublish/convert/main.py | 8 +------- ipypublish/templates/segments/ipy-sphinx.yaml.j2 | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ipypublish/convert/main.py b/ipypublish/convert/main.py index 3f062b4..a41e42d 100755 --- a/ipypublish/convert/main.py +++ b/ipypublish/convert/main.py @@ -426,7 +426,7 @@ def publish(self, ipynb_path, nb_node=None): else: final_nb, meta_path = (nb_node, ipynb_path) - # valdate the notebook metadata against the schema + # validate the notebook metadata against the schema if self.validate_nb_metadata: nb_metadata_schema = read_file_from_directory( get_module_path(schema), @@ -472,12 +472,6 @@ def publish(self, ipynb_path, nb_node=None): final_nb, exporter_cls, econfig, jinja_template ) - # record if the notebook contains widgets (for use by sphinx) - if "application/vnd.jupyter.widget-state+json" in final_nb.metadata.get( - "widgets", {} - ): - resources["contains_ipywidgets"] = True - # postprocess results main_filepath = os.path.join(outdir, ipynb_name + exporter.file_extension) diff --git a/ipypublish/templates/segments/ipy-sphinx.yaml.j2 b/ipypublish/templates/segments/ipy-sphinx.yaml.j2 index 4208c86..7b00ade 100644 --- a/ipypublish/templates/segments/ipy-sphinx.yaml.j2 +++ b/ipypublish/templates/segments/ipy-sphinx.yaml.j2 @@ -237,6 +237,7 @@ + {% set x = resources.__setitem__("contains_ipywidgets", True) %} {% endif %} "jinja_macros": |