-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnotebook_template.tpl
More file actions
122 lines (81 loc) · 2.83 KB
/
notebook_template.tpl
File metadata and controls
122 lines (81 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{%- extends 'display_priority.tpl' -%}
{% block header %}
{# Remove the exec_ prefix #}
{% set nb_name = resources.metadata.name[5:] %}
.. raw:: html
<a href="/output_nbs/{{ nb_name }}.ipynb"><button id="download">Download tutorial notebook</button></a>
<a href="https://beta.mybinder.org/v2/gh/astropy/astropy-tutorials/master?filepath=/tutorials/notebooks/{{ nb_name }}/{{ nb_name }}.ipynb"><button id="binder">Interactive tutorial notebook</button></a>
<div id="spacer"></div>
.. role:: inputnumrole
.. role:: outputnumrole
.. _{{nb_name}}:
{% endblock %}
{% block footer %}
.. raw:: html
<div id="spacer"></div>
<a href="/output_nbs/{{ nb_name }}.ipynb"><button id="download">Download tutorial notebook</button></a>
<a href="https://beta.mybinder.org/v2/gh/astropy/astropy-tutorials/master?filepath=/tutorials/notebooks/{{ nb_name }}/{{ nb_name }}.ipynb"><button id="binder">Interactive tutorial notebook</button></a>
{% endblock %}
{% block in_prompt %}
:inputnumrole:`In[{{ cell['execution_count'] }}]:`
{% endblock in_prompt %}
{% block output_prompt %}
:outputnumrole:`Out[{{ cell['execution_count'] }}]:`
{% endblock output_prompt %}
{% block input %}
{%- if cell.source.strip() and not cell.source.startswith("%") -%}
.. code:: python
{{ cell.source | indent}}
{% endif -%}
{% endblock input %}
{% block error %}
::
{{ super() }}
{% endblock error %}
{% block traceback_line %}
{{ line | indent | strip_ansi }}
{% endblock traceback_line %}
{% block execute_result %}
{% block data_priority scoped %}
{{ super() }}
{% endblock %}
{% endblock execute_result %}
{% block stream %}
.. parsed-literal::
{{ output.text | indent }}
{% endblock stream %}
{% block data_svg %}
.. image:: {{ output.metadata.filenames['image/svg+xml'] | posix_path }}
{% endblock data_svg %}
{% block data_png %}
.. image:: {{ output.metadata.filenames['image/png'] | posix_path }}
{% endblock data_png %}
{% block data_jpg %}
.. image:: {{ output.metadata.filenames['image/jpeg'] | posix_path }}
{% endblock data_jpg %}
{% block data_latex %}
.. math::
{{ output.data['text/latex'] | strip_dollars | indent }}
{% endblock data_latex %}
{% block data_text scoped %}
.. parsed-literal::
{{ output.data['text/plain'] | indent }}
{% endblock data_text %}
{% block data_html scoped %}
.. raw:: html
{{ output.data['text/html'] | indent }}
{% endblock data_html %}
{% block markdowncell scoped %}
{{ cell.source | markdown2rst }}
{% endblock markdowncell %}
{%- block rawcell scoped -%}
{%- if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) %}
{{cell.source}}
{% endif -%}
{%- endblock rawcell -%}
{% block headingcell scoped %}
{{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2rst }}
{% endblock headingcell %}
{% block unknowncell scoped %}
unknown type {{cell.type}}
{% endblock unknowncell %}