|
| 1 | +{%- extends 'base.html.j2' -%} |
| 2 | +{% from 'mathjax.html.j2' import mathjax %} |
| 3 | +{% from 'jupyter_widgets.html.j2' import jupyter_widgets %} |
| 4 | + |
| 5 | +{% set reveal_url_prefix = resources.reveal.url_prefix | default('https://unpkg.com/reveal.js@4.0.2', true) %} |
| 6 | +{% set reveal_theme = resources.reveal.theme | default('white', true) %} |
| 7 | +{% set reveal_transition = resources.reveal.transition | default('slide', true) %} |
| 8 | +{% set reveal_number = resources.reveal.number | default('', true) %} |
| 9 | +{% set reveal_width = resources.reveal.width | default('960', true) %} |
| 10 | +{% set reveal_height = resources.reveal.height | default('700', true) %} |
| 11 | +{% set reveal_scroll = resources.reveal.scroll | default(false, true) | json_dumps %} |
| 12 | + |
| 13 | +{%- block header -%} |
| 14 | +<!DOCTYPE html> |
| 15 | +<html lang="{{ resources.language_code }}"> |
| 16 | +<head> |
| 17 | + |
| 18 | +{%- block html_head -%} |
| 19 | +<meta charset="utf-8" /> |
| 20 | +<meta http-equiv="X-UA-Compatible" content="chrome=1" /> |
| 21 | + |
| 22 | +<meta name="apple-mobile-web-app-capable" content="yes" /> |
| 23 | +<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> |
| 24 | + |
| 25 | +{% set nb_title = nb.metadata.get('title', resources['metadata']['name']) | escape_html_keep_quotes %} |
| 26 | +<title>{{nb_title}} slides</title> |
| 27 | + |
| 28 | +{%- block html_head_js -%} |
| 29 | +{%- block html_head_js_jquery -%} |
| 30 | +<script src="{{ resources.jquery_url }}"></script> |
| 31 | +{%- endblock html_head_js_jquery -%} |
| 32 | +{%- block html_head_js_requirejs -%} |
| 33 | +<script src="{{ resources.require_js_url }}"></script> |
| 34 | +{%- endblock html_head_js_requirejs -%} |
| 35 | +{%- block html_head_js_mermaidjs -%} |
| 36 | +<script type="module"> |
| 37 | + import mermaid from '{{ resources.mermaid_js_url }}'; |
| 38 | + mermaid.initialize({ startOnLoad: true }); |
| 39 | +</script> |
| 40 | +{%- endblock html_head_js_mermaidjs -%} |
| 41 | +{%- endblock html_head_js -%} |
| 42 | + |
| 43 | +{% block jupyter_widgets %} |
| 44 | + {%- if "widgets" in nb.metadata -%} |
| 45 | + {{ jupyter_widgets(resources.jupyter_widgets_base_url, resources.html_manager_semver_range, resources.widget_renderer_url) }} |
| 46 | + {%- endif -%} |
| 47 | +{% endblock jupyter_widgets %} |
| 48 | + |
| 49 | +<!-- General and theme style sheets --> |
| 50 | +<link rel="stylesheet" href="{{ reveal_url_prefix }}/dist/reveal.css"> |
| 51 | + |
| 52 | +<!-- If the query includes 'print-pdf', include the PDF print sheet --> |
| 53 | +<script> |
| 54 | +if( window.location.search.match( /print-pdf/gi ) ) { |
| 55 | + var link = document.createElement( 'link' ); |
| 56 | + link.rel = 'stylesheet'; |
| 57 | + link.type = 'text/css'; |
| 58 | + document.getElementsByTagName( 'head' )[0].appendChild( link ); |
| 59 | +} |
| 60 | +</script> |
| 61 | + |
| 62 | +{% for css in resources.inlining.css -%} |
| 63 | + <style type="text/css"> |
| 64 | + {{ css }} |
| 65 | + </style> |
| 66 | +{% endfor %} |
| 67 | + |
| 68 | +{% block notebook_css %} |
| 69 | +{{ resources.include_css("static/index.css") }} |
| 70 | +{% if resources.theme == 'dark' %} |
| 71 | + {{ resources.include_css("static/theme-dark.css") }} |
| 72 | +{% else %} |
| 73 | + {{ resources.include_css("static/theme-light.css") }} |
| 74 | +{% endif %} |
| 75 | +<style type="text/css"> |
| 76 | +a.anchor-link { |
| 77 | + display: none; |
| 78 | +} |
| 79 | +.highlight { |
| 80 | + margin: 0.4em; |
| 81 | +} |
| 82 | +.jp-Notebook { |
| 83 | + padding: 0; |
| 84 | +} |
| 85 | +:root { |
| 86 | + --jp-ui-font-size1: 20px; /* instead of 14px */ |
| 87 | + --jp-content-font-size1: 20px; /* instead of 14px */ |
| 88 | + --jp-code-font-size: 19px; /* instead of 13px */ |
| 89 | + --jp-cell-prompt-width: 110px; /* instead of 64px */ |
| 90 | +} |
| 91 | +@media print { |
| 92 | + body { |
| 93 | + margin: 0; |
| 94 | + } |
| 95 | +} |
| 96 | +</style> |
| 97 | + |
| 98 | +{{ resources.include_css("static/custom_reveal.css") }} |
| 99 | + |
| 100 | +{% endblock notebook_css %} |
| 101 | + |
| 102 | +{%- block html_head_js_mathjax -%} |
| 103 | +{{ mathjax(resources.mathjax_url) }} |
| 104 | +{%- endblock html_head_js_mathjax -%} |
| 105 | + |
| 106 | +{%- block html_head_css -%} |
| 107 | +{%- endblock html_head_css -%} |
| 108 | + |
| 109 | +{%- endblock html_head -%} |
| 110 | + |
| 111 | +<!-- Reveal Theme --> |
| 112 | +<link rel="stylesheet" href="{{ reveal_url_prefix }}/dist/theme/{{reveal_theme}}.css" id="theme"> |
| 113 | + |
| 114 | +</head> |
| 115 | +{% endblock header%} |
| 116 | + |
| 117 | +{%- block body_header -%} |
| 118 | +{% if resources.theme == 'dark' %} |
| 119 | +<body class="jp-Notebook" data-jp-theme-light="false" data-jp-theme-name="JupyterLab Dark"> |
| 120 | +{% else %} |
| 121 | +<body class="jp-Notebook" data-jp-theme-light="true" data-jp-theme-name="JupyterLab Light"> |
| 122 | +{% endif %} |
| 123 | +<main> |
| 124 | +<div class="reveal"> |
| 125 | +<div class="slides"> |
| 126 | +{%- endblock body_header -%} |
| 127 | + |
| 128 | +{% block body_footer %} |
| 129 | +</div> |
| 130 | +</div> |
| 131 | +</main> |
| 132 | +</body> |
| 133 | +{% endblock body_footer %} |
| 134 | + |
| 135 | +{% block footer %} |
| 136 | +{{ super() }} |
| 137 | + |
| 138 | +{% block footer_js %} |
| 139 | +<script> |
| 140 | +require( |
| 141 | + { |
| 142 | + // it makes sense to wait a little bit when you are loading |
| 143 | + // reveal from a cdn in a slow connection environment |
| 144 | + waitSeconds: 15 |
| 145 | + }, |
| 146 | + [ |
| 147 | + "{{ reveal_url_prefix }}/dist/reveal.js", |
| 148 | + "{{ reveal_url_prefix }}/plugin/notes/notes.js" |
| 149 | + ], |
| 150 | +
|
| 151 | + function(Reveal, RevealNotes){ |
| 152 | + // Full list of configuration options available here: https://github.com/hakimel/reveal.js#configuration |
| 153 | + Reveal.initialize({ |
| 154 | + controls: true, |
| 155 | + progress: true, |
| 156 | + history: true, |
| 157 | + transition: "{{reveal_transition}}", |
| 158 | + slideNumber: "{{reveal_number}}", |
| 159 | + plugins: [RevealNotes], |
| 160 | + width: {{reveal_width}}, |
| 161 | + height: {{reveal_height}}, |
| 162 | +
|
| 163 | + }); |
| 164 | +
|
| 165 | + var update = function(event){ |
| 166 | + if(MathJax.Hub.getAllJax(Reveal.getCurrentSlide())){ |
| 167 | + MathJax.Hub.Rerender(Reveal.getCurrentSlide()); |
| 168 | + } |
| 169 | + }; |
| 170 | +
|
| 171 | + Reveal.addEventListener('slidechanged', update); |
| 172 | +
|
| 173 | + function setScrollingSlide() { |
| 174 | + var scroll = {{ reveal_scroll }} |
| 175 | + if (scroll === true) { |
| 176 | + var h = $('.reveal').height() * 0.95; |
| 177 | + $('section.present').find('section') |
| 178 | + .filter(function() { |
| 179 | + return $(this).height() > h; |
| 180 | + }) |
| 181 | + .css('height', 'calc(95vh)') |
| 182 | + .css('overflow-y', 'scroll') |
| 183 | + .css('margin-top', '20px'); |
| 184 | + } |
| 185 | + } |
| 186 | +
|
| 187 | + // check and set the scrolling slide every time the slide change |
| 188 | + Reveal.addEventListener('slidechanged', setScrollingSlide); |
| 189 | + } |
| 190 | +); |
| 191 | +</script> |
| 192 | +{% endblock footer_js %} |
| 193 | +</html> |
| 194 | +{% endblock footer %} |
0 commit comments