Skip to content

Commit

Permalink
Make it work with the voila/nbconver template refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Jul 24, 2019
1 parent a2b01df commit bf70dc3
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 34 deletions.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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]))

Expand Down
1 change: 1 addition & 0 deletions share/jupyter/nbconvert/templates/material/conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"base_template": "lab"}
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
{%- extends 'base.tpl' -%}
{% from 'mathjax.tpl' import mathjax %}
{%- extends 'lab/index.html' -%}

{%- block html_head_css -%}
<link href="{{resources.base_url}}voila/static/index.css" rel="stylesheet" type='text/css'>
{% if resources.theme == 'dark' %}
<link href="{{resources.base_url}}voila/static/theme-dark.css" rel="stylesheet" type='text/css'>
{% else %}
<link href="{{resources.base_url}}voila/static/theme-light.css" rel="stylesheet" type='text/css'>
{% endif %}
<link href="{{resources.base_url}}voila/static/materialize.min.css" rel="stylesheet" type='text/css'>

{%- block html_head_css -%}
{{ super() }}
{{ resources.include_css("static/materialize.min.css") }}
<style type="text/css">
body {
background-color: var(--jp-layout-color0);
Expand All @@ -25,33 +19,17 @@
width: 100%;
}
</style>
{%- endblock html_head_css -%}

{% for css in resources.inlining.css %}
<style type="text/css">
{{ css }}
</style>
{% endfor %}

<style>
a.anchor-link {
display: none;
}
.highlight {
margin: 0.4em;
}
</style>

{{ mathjax() }}
{%- endblock html_head_css -%}

{%- block body -%}
<body data-base-url="{{resources.base_url}}voila/">
{% block body_content %}
<header>
<div class="navbar-fixed">
<nav class="top-nav">
<div class="nav-wrapper">
<a href="#!" class="brand-logo-container">
<object class="brand-logo" type="image/svg+xml" data="{{resources.base_url}}voila/static/voila.svg"></object>
<object class="brand-logo" type="image/svg+xml" data="{{resources.include_url('static/voila.svg')}}"></object>
</a>
</div>
</nav>
Expand All @@ -67,18 +45,21 @@
{% else %}
<div class="jp-Notebook theme-light">
{% endif %}
{%- block body_cells -%}
{{ super() }}
{%- endblock body_cells -%}
</div>
</div>
</div>
</div>
</main>
</body>
{%- endblock body -%}
{%- endblock body_content -%}



{% block footer_js %}
{{ super() }}

<!-- Load Materialize JavaScript -->
<script src="{{resources.base_url}}voila/static/materialize.min.js"></script>
{{ resources.include_js("static/materialize.min.js") }}
{% endblock footer_js %}

0 comments on commit bf70dc3

Please sign in to comment.