Skip to content

Commit

Permalink
move ipywidget check to template
Browse files Browse the repository at this point in the history
checking the metadata does not work with the execution post-processor
  • Loading branch information
chrisjsewell committed Nov 10, 2019
1 parent e0b7625 commit c468920
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 1 addition & 7 deletions ipypublish/convert/main.py
Expand Up @@ -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),
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions ipypublish/templates/segments/ipy-sphinx.yaml.j2
Expand Up @@ -237,6 +237,7 @@
<script type="application/vnd.jupyter.widget-state+json">
{{ nb.metadata.widgets['application/vnd.jupyter.widget-state+json'] | json_dumps }}
</script>
{% set x = resources.__setitem__("contains_ipywidgets", True) %}
{% endif %}

"jinja_macros": |
Expand Down

0 comments on commit c468920

Please sign in to comment.