From bf70dc32dde047c6c5abc9c5587d4a33009477dd Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Wed, 24 Jul 2019 18:55:08 +0200 Subject: [PATCH] Make it work with the voila/nbconver template refactor Depends on https://github.com/jupyter/nbconvert/pull/1056 Depends on https://github.com/QuantStack/voila/pull/208 --- setup.py | 4 +- .../nbconvert/templates/material/conf.json | 1 + .../templates/material/index.html} | 45 +++++------------- .../templates/material/static/icons_font.ttf | Bin .../material/static/materialize.min.css | 0 .../material/static/materialize.min.js | 0 .../material/static/voila-square.svg | 0 .../templates/material/static/voila.svg | 0 .../{templates => }/browser-open.html | 0 .../material/{templates => }/tree.html | 0 10 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 share/jupyter/nbconvert/templates/material/conf.json rename share/jupyter/{voila/templates/material/nbconvert_templates/voila.tpl => nbconvert/templates/material/index.html} (52%) rename share/jupyter/{voila => nbconvert}/templates/material/static/icons_font.ttf (100%) rename share/jupyter/{voila => nbconvert}/templates/material/static/materialize.min.css (100%) rename share/jupyter/{voila => nbconvert}/templates/material/static/materialize.min.js (100%) rename share/jupyter/{voila => nbconvert}/templates/material/static/voila-square.svg (100%) rename share/jupyter/{voila => nbconvert}/templates/material/static/voila.svg (100%) rename share/jupyter/voila/templates/material/{templates => }/browser-open.html (100%) rename share/jupyter/voila/templates/material/{templates => }/tree.html (100%) diff --git a/setup.py b/setup.py index 78613f3..c45c683 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ def user_dir(): class DevelopCmd(develop): prefix_targets = [ - ("voila/templates", 'material') + ("nbconvert/templates", 'material') ] def run(self): target_dir = os.path.join(sys.prefix, 'share', 'jupyter') @@ -77,7 +77,7 @@ def run(self): # WARNING: all files generates during setup.py will not end up in the source distribution data_files = [] # Add all the templates -for (dirpath, dirnames, filenames) in os.walk('share/jupyter/voila/templates/'): +for (dirpath, dirnames, filenames) in os.walk('share/jupyter/nbconvert/templates/'): if filenames: data_files.append((dirpath, [os.path.join(dirpath, filename) for filename in filenames])) diff --git a/share/jupyter/nbconvert/templates/material/conf.json b/share/jupyter/nbconvert/templates/material/conf.json new file mode 100644 index 0000000..ff4bfee --- /dev/null +++ b/share/jupyter/nbconvert/templates/material/conf.json @@ -0,0 +1 @@ +{"base_template": "lab"} \ No newline at end of file diff --git a/share/jupyter/voila/templates/material/nbconvert_templates/voila.tpl b/share/jupyter/nbconvert/templates/material/index.html similarity index 52% rename from share/jupyter/voila/templates/material/nbconvert_templates/voila.tpl rename to share/jupyter/nbconvert/templates/material/index.html index f3938d2..48b3c57 100644 --- a/share/jupyter/voila/templates/material/nbconvert_templates/voila.tpl +++ b/share/jupyter/nbconvert/templates/material/index.html @@ -1,15 +1,9 @@ -{%- extends 'base.tpl' -%} -{% from 'mathjax.tpl' import mathjax %} +{%- extends 'lab/index.html' -%} -{%- block html_head_css -%} - -{% if resources.theme == 'dark' %} - -{% else %} - -{% endif %} - +{%- block html_head_css -%} +{{ super() }} +{{ resources.include_css("static/materialize.min.css") }} +{%- endblock html_head_css -%} -{% for css in resources.inlining.css %} - -{% endfor %} - - -{{ mathjax() }} -{%- endblock html_head_css -%} -{%- block body -%} - +{% block body_content %}
- -{%- endblock body -%} +{%- endblock body_content -%} + + {% block footer_js %} {{ super() }} - +{{ resources.include_js("static/materialize.min.js") }} {% endblock footer_js %} diff --git a/share/jupyter/voila/templates/material/static/icons_font.ttf b/share/jupyter/nbconvert/templates/material/static/icons_font.ttf similarity index 100% rename from share/jupyter/voila/templates/material/static/icons_font.ttf rename to share/jupyter/nbconvert/templates/material/static/icons_font.ttf diff --git a/share/jupyter/voila/templates/material/static/materialize.min.css b/share/jupyter/nbconvert/templates/material/static/materialize.min.css similarity index 100% rename from share/jupyter/voila/templates/material/static/materialize.min.css rename to share/jupyter/nbconvert/templates/material/static/materialize.min.css diff --git a/share/jupyter/voila/templates/material/static/materialize.min.js b/share/jupyter/nbconvert/templates/material/static/materialize.min.js similarity index 100% rename from share/jupyter/voila/templates/material/static/materialize.min.js rename to share/jupyter/nbconvert/templates/material/static/materialize.min.js diff --git a/share/jupyter/voila/templates/material/static/voila-square.svg b/share/jupyter/nbconvert/templates/material/static/voila-square.svg similarity index 100% rename from share/jupyter/voila/templates/material/static/voila-square.svg rename to share/jupyter/nbconvert/templates/material/static/voila-square.svg diff --git a/share/jupyter/voila/templates/material/static/voila.svg b/share/jupyter/nbconvert/templates/material/static/voila.svg similarity index 100% rename from share/jupyter/voila/templates/material/static/voila.svg rename to share/jupyter/nbconvert/templates/material/static/voila.svg diff --git a/share/jupyter/voila/templates/material/templates/browser-open.html b/share/jupyter/voila/templates/material/browser-open.html similarity index 100% rename from share/jupyter/voila/templates/material/templates/browser-open.html rename to share/jupyter/voila/templates/material/browser-open.html diff --git a/share/jupyter/voila/templates/material/templates/tree.html b/share/jupyter/voila/templates/material/tree.html similarity index 100% rename from share/jupyter/voila/templates/material/templates/tree.html rename to share/jupyter/voila/templates/material/tree.html