Show More
@@ -1,165 +1,159 | |||||
1 | {%- extends 'display_priority.tpl' -%} |
|
1 | {%- extends 'display_priority.tpl' -%} | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | {% block codecell %} |
|
4 | {% block codecell %} | |
5 | <div class="cell border-box-sizing code_cell"> |
|
5 | <div class="cell border-box-sizing code_cell"> | |
6 | {{ super() }} |
|
6 | {{ super() }} | |
7 | </div> |
|
7 | </div> | |
8 | {%- endblock codecell %} |
|
8 | {%- endblock codecell %} | |
9 |
|
9 | |||
10 | {% block input_group -%} |
|
10 | {% block input_group -%} | |
11 | <div class="input"> |
|
11 | <div class="input"> | |
12 | {{ super() }} |
|
12 | {{ super() }} | |
13 | </div> |
|
13 | </div> | |
14 | {% endblock input_group %} |
|
14 | {% endblock input_group %} | |
15 |
|
15 | |||
16 | {% block output_group %} |
|
16 | {% block output_group %} | |
17 | <div class="output_wrapper"> |
|
17 | <div class="output_wrapper"> | |
18 | <div class="output"> |
|
18 | <div class="output"> | |
19 | {{ super() }} |
|
19 | {{ super() }} | |
20 | </div> |
|
20 | </div> | |
21 | </div> |
|
21 | </div> | |
22 | {% endblock output_group %} |
|
22 | {% endblock output_group %} | |
23 |
|
23 | |||
24 | {% block in_prompt -%} |
|
24 | {% block in_prompt -%} | |
25 | <div class="prompt input_prompt"> |
|
25 | <div class="prompt input_prompt"> | |
26 | In [{{ cell.prompt_number }}]: |
|
26 | In [{{ cell.prompt_number }}]: | |
27 | </div> |
|
27 | </div> | |
28 | {%- endblock in_prompt %} |
|
28 | {%- endblock in_prompt %} | |
29 |
|
29 | |||
30 | {% block e_in_prompt -%} |
|
30 | {% block e_in_prompt -%} | |
31 | <div class="prompt input_prompt"> |
|
31 | <div class="prompt input_prompt"> | |
32 | </div> |
|
32 | </div> | |
33 | {%- endblock e_in_prompt %} |
|
33 | {%- endblock e_in_prompt %} | |
34 |
|
34 | |||
35 | {# |
|
35 | {# | |
36 | output_prompt doesn't do anything in HTML, |
|
36 | output_prompt doesn't do anything in HTML, | |
37 | because there is a prompt div in each output area (see output block) |
|
37 | because there is a prompt div in each output area (see output block) | |
38 | #} |
|
38 | #} | |
39 | {% block output_prompt %} |
|
39 | {% block output_prompt %} | |
40 | {% endblock output_prompt %} |
|
40 | {% endblock output_prompt %} | |
41 |
|
41 | |||
42 | {% block input %} |
|
42 | {% block input %} | |
43 | <div class="input_area box-flex1"> |
|
43 | <div class="input_area box-flex1"> | |
44 | {{ cell.input | highlight2html(metadata=cell.metadata) }} |
|
44 | {{ cell.input | highlight2html(metadata=cell.metadata) }} | |
45 | </div> |
|
45 | </div> | |
46 | {%- endblock input %} |
|
46 | {%- endblock input %} | |
47 |
|
47 | |||
48 | {% block output %} |
|
48 | {% block output %} | |
49 | <div class="output_area"> |
|
49 | <div class="output_area"> | |
50 | {%- if output.output_type == 'pyout' -%} |
|
50 | {%- if output.output_type == 'pyout' -%} | |
51 | <div class="prompt output_prompt"> |
|
51 | <div class="prompt output_prompt"> | |
52 | Out[{{ cell.prompt_number }}]: |
|
52 | Out[{{ cell.prompt_number }}]: | |
53 | {%- else -%} |
|
53 | {%- else -%} | |
54 | <div class="prompt"> |
|
54 | <div class="prompt"> | |
55 | {%- endif -%} |
|
55 | {%- endif -%} | |
56 | </div> |
|
56 | </div> | |
57 | {{ super() }} |
|
57 | {{ super() }} | |
58 | </div> |
|
58 | </div> | |
59 | {% endblock output %} |
|
59 | {% endblock output %} | |
60 |
|
60 | |||
61 | {% block markdowncell scoped %} |
|
61 | {% block markdowncell scoped %} | |
62 | <div class="input"> |
|
62 | <div class="input"> | |
63 | {{ self.e_in_prompt() }} |
|
63 | {{ self.e_in_prompt() }} | |
64 | <div class="inner_cell"> |
|
64 | <div class="inner_cell"> | |
65 | <div class="text_cell_render border-box-sizing rendered_html"> |
|
65 | <div class="text_cell_render border-box-sizing rendered_html"> | |
66 | {{ cell.source | markdown2html | strip_files_prefix }} |
|
66 | {{ cell.source | markdown2html | strip_files_prefix }} | |
67 | </div> |
|
67 | </div> | |
68 | </div> |
|
68 | </div> | |
69 | </div> |
|
69 | </div> | |
70 | {%- endblock markdowncell %} |
|
70 | {%- endblock markdowncell %} | |
71 |
|
71 | |||
72 | {% block headingcell scoped %} |
|
72 | {% block headingcell scoped %} | |
73 | <div class="input"> |
|
73 | <div class="input"> | |
74 | {{ self.e_in_prompt() }} |
|
74 | {{ self.e_in_prompt() }} | |
75 | <div class="inner_cell"> |
|
75 | <div class="inner_cell"> | |
76 | <div class="text_cell_render border-box-sizing rendered_html"> |
|
76 | <div class="text_cell_render border-box-sizing rendered_html"> | |
77 | {{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2html | strip_files_prefix | add_anchor }} |
|
77 | {{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2html | strip_files_prefix | add_anchor }} | |
78 | </div> |
|
78 | </div> | |
79 | </div> |
|
79 | </div> | |
80 | </div> |
|
80 | </div> | |
81 | {% endblock headingcell %} |
|
81 | {% endblock headingcell %} | |
82 |
|
82 | |||
83 | {%- block rawcell scoped -%} |
|
|||
84 | {% if cell.metadata.get('raw_mimetype', resources.get('raw_mimetype', '')).lower() in resources.get('raw_mimetypes', ['']) %} |
|
|||
85 | {{ cell.source }} |
|
|||
86 | {% endif %} |
|
|||
87 | {%- endblock rawcell -%} |
|
|||
88 |
|
||||
89 | {% block unknowncell scoped %} |
|
83 | {% block unknowncell scoped %} | |
90 | unknown type {{ cell.type }} |
|
84 | unknown type {{ cell.type }} | |
91 | {% endblock unknowncell %} |
|
85 | {% endblock unknowncell %} | |
92 |
|
86 | |||
93 | {% block pyout -%} |
|
87 | {% block pyout -%} | |
94 | <div class="box-flex1 output_subarea output_pyout"> |
|
88 | <div class="box-flex1 output_subarea output_pyout"> | |
95 | {% block data_priority scoped %} |
|
89 | {% block data_priority scoped %} | |
96 | {{ super() }} |
|
90 | {{ super() }} | |
97 | {% endblock %} |
|
91 | {% endblock %} | |
98 | </div> |
|
92 | </div> | |
99 | {%- endblock pyout %} |
|
93 | {%- endblock pyout %} | |
100 |
|
94 | |||
101 | {% block stream_stdout -%} |
|
95 | {% block stream_stdout -%} | |
102 | <div class="box-flex1 output_subarea output_stream output_stdout"> |
|
96 | <div class="box-flex1 output_subarea output_stream output_stdout"> | |
103 | <pre> |
|
97 | <pre> | |
104 | {{ output.text | ansi2html }} |
|
98 | {{ output.text | ansi2html }} | |
105 | </pre> |
|
99 | </pre> | |
106 | </div> |
|
100 | </div> | |
107 | {%- endblock stream_stdout %} |
|
101 | {%- endblock stream_stdout %} | |
108 |
|
102 | |||
109 | {% block stream_stderr -%} |
|
103 | {% block stream_stderr -%} | |
110 | <div class="box-flex1 output_subarea output_stream output_stderr"> |
|
104 | <div class="box-flex1 output_subarea output_stream output_stderr"> | |
111 | <pre> |
|
105 | <pre> | |
112 | {{ output.text | ansi2html }} |
|
106 | {{ output.text | ansi2html }} | |
113 | </pre> |
|
107 | </pre> | |
114 | </div> |
|
108 | </div> | |
115 | {%- endblock stream_stderr %} |
|
109 | {%- endblock stream_stderr %} | |
116 |
|
110 | |||
117 | {% block data_svg -%} |
|
111 | {% block data_svg -%} | |
118 | {{ output.svg }} |
|
112 | {{ output.svg }} | |
119 | {%- endblock data_svg %} |
|
113 | {%- endblock data_svg %} | |
120 |
|
114 | |||
121 | {% block data_html -%} |
|
115 | {% block data_html -%} | |
122 | <div class="output_html rendered_html"> |
|
116 | <div class="output_html rendered_html"> | |
123 | {{ output.html }} |
|
117 | {{ output.html }} | |
124 | </div> |
|
118 | </div> | |
125 | {%- endblock data_html %} |
|
119 | {%- endblock data_html %} | |
126 |
|
120 | |||
127 | {% block data_png %} |
|
121 | {% block data_png %} | |
128 | <img src="data:image/png;base64,{{ output.png }}"> |
|
122 | <img src="data:image/png;base64,{{ output.png }}"> | |
129 | {%- endblock data_png %} |
|
123 | {%- endblock data_png %} | |
130 |
|
124 | |||
131 | {% block data_jpg %} |
|
125 | {% block data_jpg %} | |
132 | <img src="data:image/jpeg;base64,{{ output.jpeg }}"> |
|
126 | <img src="data:image/jpeg;base64,{{ output.jpeg }}"> | |
133 | {%- endblock data_jpg %} |
|
127 | {%- endblock data_jpg %} | |
134 |
|
128 | |||
135 | {% block data_latex %} |
|
129 | {% block data_latex %} | |
136 | {{ output.latex }} |
|
130 | {{ output.latex }} | |
137 | {%- endblock data_latex %} |
|
131 | {%- endblock data_latex %} | |
138 |
|
132 | |||
139 | {% block pyerr -%} |
|
133 | {% block pyerr -%} | |
140 | <div class="box-flex1 output_subarea output_pyerr"> |
|
134 | <div class="box-flex1 output_subarea output_pyerr"> | |
141 | <pre>{{ super() }}</pre> |
|
135 | <pre>{{ super() }}</pre> | |
142 | </div> |
|
136 | </div> | |
143 | {%- endblock pyerr %} |
|
137 | {%- endblock pyerr %} | |
144 |
|
138 | |||
145 | {%- block traceback_line %} |
|
139 | {%- block traceback_line %} | |
146 | {{ line | ansi2html }} |
|
140 | {{ line | ansi2html }} | |
147 | {%- endblock traceback_line %} |
|
141 | {%- endblock traceback_line %} | |
148 |
|
142 | |||
149 | {%- block data_text %} |
|
143 | {%- block data_text %} | |
150 | <pre> |
|
144 | <pre> | |
151 | {{ output.text | ansi2html }} |
|
145 | {{ output.text | ansi2html }} | |
152 | </pre> |
|
146 | </pre> | |
153 | {%- endblock -%} |
|
147 | {%- endblock -%} | |
154 |
|
148 | |||
155 | {%- block data_javascript %} |
|
149 | {%- block data_javascript %} | |
156 | <script type="text/javascript"> |
|
150 | <script type="text/javascript"> | |
157 | {{ output.javascript }} |
|
151 | {{ output.javascript }} | |
158 | </script> |
|
152 | </script> | |
159 | {%- endblock -%} |
|
153 | {%- endblock -%} | |
160 |
|
154 | |||
161 | {%- block display_data scoped -%} |
|
155 | {%- block display_data scoped -%} | |
162 | <div class="box-flex1 output_subarea output_display_data"> |
|
156 | <div class="box-flex1 output_subarea output_display_data"> | |
163 | {{ super() }} |
|
157 | {{ super() }} | |
164 | </div> |
|
158 | </div> | |
165 | {%- endblock display_data -%} |
|
159 | {%- endblock display_data -%} |
@@ -1,94 +1,94 | |||||
1 | {# |
|
1 | {# | |
2 |
|
2 | |||
3 | DO NOT USE THIS AS A BASE, |
|
3 | DO NOT USE THIS AS A BASE, | |
4 | IF YOU ARE COPY AND PASTING THIS FILE |
|
4 | IF YOU ARE COPY AND PASTING THIS FILE | |
5 | YOU ARE PROBABLY DOING THINGS INCORRECTLY. |
|
5 | YOU ARE PROBABLY DOING THINGS INCORRECTLY. | |
6 |
|
6 | |||
7 | Null template, does nothing except defining a basic structure |
|
7 | Null template, does nothing except defining a basic structure | |
8 | To layout the different blocks of a notebook. |
|
8 | To layout the different blocks of a notebook. | |
9 |
|
9 | |||
10 | Subtemplates can override blocks to define their custom representation. |
|
10 | Subtemplates can override blocks to define their custom representation. | |
11 |
|
11 | |||
12 | If one of the block you do overwrite is not a leave block, consider |
|
12 | If one of the block you do overwrite is not a leave block, consider | |
13 | calling super. |
|
13 | calling super. | |
14 |
|
14 | |||
15 | {%- block nonLeaveBlock -%} |
|
15 | {%- block nonLeaveBlock -%} | |
16 | #add stuff at beginning |
|
16 | #add stuff at beginning | |
17 | {{ super() }} |
|
17 | {{ super() }} | |
18 | #add stuff at end |
|
18 | #add stuff at end | |
19 | {%- endblock nonLeaveBlock -%} |
|
19 | {%- endblock nonLeaveBlock -%} | |
20 |
|
20 | |||
21 | consider calling super even if it is a leave block, we might insert more blocks later. |
|
21 | consider calling super even if it is a leave block, we might insert more blocks later. | |
22 |
|
22 | |||
23 | #} |
|
23 | #} | |
24 | {%- block header -%} |
|
24 | {%- block header -%} | |
25 | {%- endblock header -%} |
|
25 | {%- endblock header -%} | |
26 | {%- block body -%} |
|
26 | {%- block body -%} | |
27 | {%- for worksheet in nb.worksheets -%} |
|
27 | {%- for worksheet in nb.worksheets -%} | |
28 | {%- for cell in worksheet.cells -%} |
|
28 | {%- for cell in worksheet.cells -%} | |
29 | {%- block any_cell scoped -%} |
|
29 | {%- block any_cell scoped -%} | |
30 | {%- if cell.cell_type in ['code'] -%} |
|
30 | {%- if cell.cell_type in ['code'] -%} | |
31 | {%- block codecell scoped -%} |
|
31 | {%- block codecell scoped -%} | |
32 | {%- block input_group -%} |
|
32 | {%- block input_group -%} | |
33 | {%- block in_prompt -%}{%- endblock in_prompt -%} |
|
33 | {%- block in_prompt -%}{%- endblock in_prompt -%} | |
34 | {%- block input -%}{%- endblock input -%} |
|
34 | {%- block input -%}{%- endblock input -%} | |
35 | {%- endblock input_group -%} |
|
35 | {%- endblock input_group -%} | |
36 | {%- if cell.outputs -%} |
|
36 | {%- if cell.outputs -%} | |
37 | {%- block output_group -%} |
|
37 | {%- block output_group -%} | |
38 | {%- block output_prompt -%}{%- endblock output_prompt -%} |
|
38 | {%- block output_prompt -%}{%- endblock output_prompt -%} | |
39 | {%- block outputs scoped -%} |
|
39 | {%- block outputs scoped -%} | |
40 | {%- for output in cell.outputs -%} |
|
40 | {%- for output in cell.outputs -%} | |
41 | {%- block output scoped -%} |
|
41 | {%- block output scoped -%} | |
42 | {%- if output.output_type in ['pyout'] -%} |
|
42 | {%- if output.output_type in ['pyout'] -%} | |
43 | {%- block pyout scoped -%}{%- endblock pyout -%} |
|
43 | {%- block pyout scoped -%}{%- endblock pyout -%} | |
44 | {%- elif output.output_type in ['stream'] -%} |
|
44 | {%- elif output.output_type in ['stream'] -%} | |
45 | {%- block stream scoped -%} |
|
45 | {%- block stream scoped -%} | |
46 | {%- if output.stream in ['stdout'] -%} |
|
46 | {%- if output.stream in ['stdout'] -%} | |
47 | {%- block stream_stdout scoped -%} |
|
47 | {%- block stream_stdout scoped -%} | |
48 | {%- endblock stream_stdout -%} |
|
48 | {%- endblock stream_stdout -%} | |
49 | {%- elif output.stream in ['stderr'] -%} |
|
49 | {%- elif output.stream in ['stderr'] -%} | |
50 | {%- block stream_stderr scoped -%} |
|
50 | {%- block stream_stderr scoped -%} | |
51 | {%- endblock stream_stderr -%} |
|
51 | {%- endblock stream_stderr -%} | |
52 | {%- endif -%} |
|
52 | {%- endif -%} | |
53 | {%- endblock stream -%} |
|
53 | {%- endblock stream -%} | |
54 | {%- elif output.output_type in ['display_data'] -%} |
|
54 | {%- elif output.output_type in ['display_data'] -%} | |
55 | {%- block display_data scoped -%} |
|
55 | {%- block display_data scoped -%} | |
56 | {%- block data_priority scoped -%} |
|
56 | {%- block data_priority scoped -%} | |
57 | {%- endblock data_priority -%} |
|
57 | {%- endblock data_priority -%} | |
58 | {%- endblock display_data -%} |
|
58 | {%- endblock display_data -%} | |
59 | {%- elif output.output_type in ['pyerr'] -%} |
|
59 | {%- elif output.output_type in ['pyerr'] -%} | |
60 | {%- block pyerr scoped -%} |
|
60 | {%- block pyerr scoped -%} | |
61 | {%- for line in output.traceback -%} |
|
61 | {%- for line in output.traceback -%} | |
62 | {%- block traceback_line scoped -%}{%- endblock traceback_line -%} |
|
62 | {%- block traceback_line scoped -%}{%- endblock traceback_line -%} | |
63 | {%- endfor -%} |
|
63 | {%- endfor -%} | |
64 | {%- endblock pyerr -%} |
|
64 | {%- endblock pyerr -%} | |
65 | {%- endif -%} |
|
65 | {%- endif -%} | |
66 | {%- endblock output -%} |
|
66 | {%- endblock output -%} | |
67 | {%- endfor -%} |
|
67 | {%- endfor -%} | |
68 | {%- endblock outputs -%} |
|
68 | {%- endblock outputs -%} | |
69 | {%- endblock output_group -%} |
|
69 | {%- endblock output_group -%} | |
70 | {%- endif -%} |
|
70 | {%- endif -%} | |
71 | {%- endblock codecell -%} |
|
71 | {%- endblock codecell -%} | |
72 | {%- elif cell.cell_type in ['markdown'] -%} |
|
72 | {%- elif cell.cell_type in ['markdown'] -%} | |
73 | {%- block markdowncell scoped-%} |
|
73 | {%- block markdowncell scoped-%} | |
74 | {%- endblock markdowncell -%} |
|
74 | {%- endblock markdowncell -%} | |
75 | {%- elif cell.cell_type in ['heading'] -%} |
|
75 | {%- elif cell.cell_type in ['heading'] -%} | |
76 | {%- block headingcell scoped-%} |
|
76 | {%- block headingcell scoped-%} | |
77 | {%- endblock headingcell -%} |
|
77 | {%- endblock headingcell -%} | |
78 | {%- elif cell.cell_type in ['raw'] -%} |
|
78 | {%- elif cell.cell_type in ['raw'] -%} | |
79 | {%- block rawcell scoped -%} |
|
79 | {%- block rawcell scoped -%} | |
80 | {% if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) %} |
|
80 | {% if cell.metadata.get('raw_mimetype', resources.get('raw_mimetype', '')).lower() in resources.get('raw_mimetypes', ['']) %} | |
81 | {{ cell.source }} |
|
81 | {{ cell.source }} | |
82 | {% endif %} |
|
82 | {% endif %} | |
83 | {%- endblock rawcell -%} |
|
83 | {%- endblock rawcell -%} | |
84 | {%- else -%} |
|
84 | {%- else -%} | |
85 | {%- block unknowncell scoped-%} |
|
85 | {%- block unknowncell scoped-%} | |
86 | {%- endblock unknowncell -%} |
|
86 | {%- endblock unknowncell -%} | |
87 | {%- endif -%} |
|
87 | {%- endif -%} | |
88 | {%- endblock any_cell -%} |
|
88 | {%- endblock any_cell -%} | |
89 | {%- endfor -%} |
|
89 | {%- endfor -%} | |
90 | {%- endfor -%} |
|
90 | {%- endfor -%} | |
91 | {%- endblock body -%} |
|
91 | {%- endblock body -%} | |
92 |
|
92 | |||
93 | {%- block footer -%} |
|
93 | {%- block footer -%} | |
94 | {%- endblock footer -%} |
|
94 | {%- endblock footer -%} |
General Comments 0
You need to be logged in to leave comments.
Login now