diff --git a/Slides/templates/display_priority.tpl b/Slides/templates/display_priority.tpl new file mode 100644 index 0000000..ec4d58a --- /dev/null +++ b/Slides/templates/display_priority.tpl @@ -0,0 +1,46 @@ +{%- extends 'null.tpl' -%} + +{#display data priority#} + + +{%- block data_priority scoped -%} + {%- for type in output.data | filter_data_type -%} + {%- if type == 'application/pdf' -%} + {%- block data_pdf -%} + {%- endblock -%} + {%- elif type == 'image/svg+xml' -%} + {%- block data_svg -%} + {%- endblock -%} + {%- elif type == 'image/png' -%} + {%- block data_png -%} + {%- endblock -%} + {%- elif type == 'text/html' -%} + {%- block data_html -%} + {%- endblock -%} + {%- elif type == 'text/markdown' -%} + {%- block data_markdown -%} + {%- endblock -%} + {%- elif type == 'image/jpeg' -%} + {%- block data_jpg -%} + {%- endblock -%} + {%- elif type == 'text/plain' -%} + {%- block data_text -%} + {%- endblock -%} + {%- elif type == 'text/latex' -%} + {%- block data_latex -%} + {%- endblock -%} + {%- elif type == 'application/javascript' -%} + {%- block data_javascript -%} + {%- endblock -%} + {%- elif type == 'application/vnd.jupyter.widget-state+json' -%} + {%- block data_widget_state -%} + {%- endblock -%} + {%- elif type == 'application/vnd.jupyter.widget-view+json' -%} + {%- block data_widget_view -%} + {%- endblock -%} + {%- else -%} + {%- block data_other -%} + {%- endblock -%} + {%- endif -%} + {%- endfor -%} +{%- endblock data_priority -%} diff --git a/Slides/templates/mathjax.tpl b/Slides/templates/mathjax.tpl new file mode 100644 index 0000000..9b1d753 --- /dev/null +++ b/Slides/templates/mathjax.tpl @@ -0,0 +1,23 @@ +{%- macro mathjax(url='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML') -%} + + + + + +{%- endmacro %} diff --git a/Slides/templates/mybasic.tpl b/Slides/templates/mybasic.tpl index 984bb94..188156f 100644 --- a/Slides/templates/mybasic.tpl +++ b/Slides/templates/mybasic.tpl @@ -1,253 +1,253 @@ {%- extends 'display_priority.tpl' -%} {% block codecell %}
{{ super() }}
{%- endblock codecell %} {% block input_group -%} -
+{#
{{ super() }} -
+
#} {% endblock input_group %} {% block output_group %}
{{ super() }}
{% endblock output_group %} {% block in_prompt -%}
{%- if cell.execution_count is defined -%} In [{{ cell.execution_count|replace(None, " ") }}]: {%- else -%} In [ ]: {%- endif -%}
{%- endblock in_prompt %} {% block empty_in_prompt -%}
{%- endblock empty_in_prompt %} {# output_prompt doesn't do anything in HTML, because there is a prompt div in each output area (see output block) #} {% block output_prompt %} {% endblock output_prompt %} {% block input %}
{{ cell.source | highlight_code(metadata=cell.metadata) }}
{%- endblock input %} {% block output %}
{% block output_area_prompt %} {%- if output.output_type == 'execute_result' -%}
{%- if cell.execution_count is defined -%} Out[{{ cell.execution_count|replace(None, " ") }}]: {%- else -%} Out[ ]: {%- endif -%} {%- else -%}
{%- endif -%}
{% endblock output_area_prompt %} {{ super() }}
{% endblock output %} {% block markdowncell scoped %}
{{ self.empty_in_prompt() }}
{{ cell.source | markdown2html | strip_files_prefix }}
{%- endblock markdowncell %} {% block unknowncell scoped %} unknown type {{ cell.type }} {% endblock unknowncell %} {% block execute_result -%} {%- set extra_class="output_execute_result" -%} {% block data_priority scoped %} {{ super() }} {% endblock %} {%- set extra_class="" -%} {%- endblock execute_result %} {% block stream_stdout -%}
 {{- output.text | ansi2html -}}
 
{%- endblock stream_stdout %} {% block stream_stderr -%}
 {{- output.text | ansi2html -}}
 
{%- endblock stream_stderr %} {% block data_svg scoped -%}
{%- if output.svg_filename %} {%- endblock data_svg %} {% block data_html scoped -%}
{{ output.data['text/html'] }}
{%- endblock data_html %} {% block data_markdown scoped -%}
{{ output.data['text/markdown'] | markdown2html }}
{%- endblock data_markdown %} {% block data_png scoped %}
{%- if 'image/png' in output.metadata.get('filenames', {}) %}
{%- endblock data_png %} {% block data_jpg scoped %}
{%- if 'image/jpeg' in output.metadata.get('filenames', {}) %}
{%- endblock data_jpg %} {% block data_latex scoped %}
{{ output.data['text/latex'] }}
{%- endblock data_latex %} {% block error -%}
 {{- super() -}}
 
{%- endblock error %} {%- block traceback_line %} {{ line | ansi2html }} {%- endblock traceback_line %} {%- block data_text scoped %}
 {{- output.data['text/plain'] | ansi2html -}}
 
{%- endblock -%} {%- block data_javascript scoped %} {% set div_id = uuid4() %}
{%- endblock -%} {%- block data_widget_state scoped %} {% set div_id = uuid4() %} {% set datatype_list = output.data | filter_data_type %} {% set datatype = datatype_list[0]%}
{%- endblock data_widget_state -%} {%- block data_widget_view scoped %} {% set div_id = uuid4() %} {% set datatype_list = output.data | filter_data_type %} {% set datatype = datatype_list[0]%}
{%- endblock data_widget_view -%} {%- block footer %} {% set mimetype = 'application/vnd.jupyter.widget-state+json'%} {% if mimetype in nb.metadata.get("widgets",{})%} {% endif %} {{ super() }} {%- endblock footer-%} diff --git a/Slides/templates/presentation.tpl b/Slides/templates/presentation.tpl index 256f3f5..f1ac6f6 100644 --- a/Slides/templates/presentation.tpl +++ b/Slides/templates/presentation.tpl @@ -1,292 +1,272 @@ {%- extends 'mybasic.tpl' -%} -{% block input_group -%} -
-{{ super() }} -
-{% endblock input_group %} - {% from 'mathjax.tpl' import mathjax %} {%- block any_cell scoped -%} {%- if cell.metadata.get('slide_start', False) -%}
{%- endif -%} {%- if cell.metadata.get('subslide_start', False) -%}
{%- endif -%} {%- if cell.metadata.get('fragment_start', False) -%}
{%- endif -%} {%- if cell.metadata.slide_type == 'notes' -%} {%- elif cell.metadata.slide_type == 'skip' -%} {%- else -%} {{ super() }} {%- endif -%} {%- if cell.metadata.get('fragment_end', False) -%}
{%- endif -%} {%- if cell.metadata.get('subslide_end', False) -%}
{%- endif -%} {%- if cell.metadata.get('slide_end', False) -%}
{%- endif -%} {%- endblock any_cell -%} {% block header %} {{resources['metadata']['name']}} slides {{ mathjax() }} {% for css in resources.inlining.css -%} {% endfor %} {% endblock header%} {% block body %}
{{ super() }}
{% endblock body %} {% block footer %} {% endblock footer %}