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