Show More
@@ -1,66 +1,57 b'' | |||||
1 | """HTML Exporter class""" |
|
1 | """HTML Exporter class""" | |
2 |
|
2 | |||
3 | #----------------------------------------------------------------------------- |
|
3 | # Copyright (c) IPython Development Team. | |
4 | # Copyright (c) 2013, the IPython Development Team. |
|
|||
5 | # |
|
|||
6 | # Distributed under the terms of the Modified BSD License. |
|
4 | # Distributed under the terms of the Modified BSD License. | |
7 | # |
|
|||
8 | # The full license is in the file COPYING.txt, distributed with this software. |
|
|||
9 | #----------------------------------------------------------------------------- |
|
|||
10 |
|
||||
11 | #----------------------------------------------------------------------------- |
|
|||
12 | # Imports |
|
|||
13 | #----------------------------------------------------------------------------- |
|
|||
14 |
|
5 | |||
15 | import os |
|
6 | import os | |
16 |
|
7 | |||
17 | from IPython.nbconvert.filters.highlight import Highlight2HTML |
|
8 | from IPython.nbconvert.filters.highlight import Highlight2HTML | |
18 | from IPython.config import Config |
|
9 | from IPython.config import Config | |
19 |
|
10 | |||
20 | from .templateexporter import TemplateExporter |
|
11 | from .templateexporter import TemplateExporter | |
21 |
|
12 | |||
22 | #----------------------------------------------------------------------------- |
|
13 | #----------------------------------------------------------------------------- | |
23 | # Classes |
|
14 | # Classes | |
24 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
25 |
|
16 | |||
26 | class HTMLExporter(TemplateExporter): |
|
17 | class HTMLExporter(TemplateExporter): | |
27 | """ |
|
18 | """ | |
28 | Exports a basic HTML document. This exporter assists with the export of |
|
19 | Exports a basic HTML document. This exporter assists with the export of | |
29 | HTML. Inherit from it if you are writing your own HTML template and need |
|
20 | HTML. Inherit from it if you are writing your own HTML template and need | |
30 | custom preprocessors/filters. If you don't need custom preprocessors/ |
|
21 | custom preprocessors/filters. If you don't need custom preprocessors/ | |
31 | filters, just change the 'template_file' config option. |
|
22 | filters, just change the 'template_file' config option. | |
32 | """ |
|
23 | """ | |
33 |
|
24 | |||
34 | def _file_extension_default(self): |
|
25 | def _file_extension_default(self): | |
35 | return '.html' |
|
26 | return '.html' | |
36 |
|
27 | |||
37 | def _default_template_path_default(self): |
|
28 | def _default_template_path_default(self): | |
38 | return os.path.join("..", "templates", "html") |
|
29 | return os.path.join("..", "templates", "html") | |
39 |
|
30 | |||
40 | def _template_file_default(self): |
|
31 | def _template_file_default(self): | |
41 | return 'full' |
|
32 | return 'full' | |
42 |
|
33 | |||
43 | output_mimetype = 'text/html' |
|
34 | output_mimetype = 'text/html' | |
44 |
|
35 | |||
45 | @property |
|
36 | @property | |
46 | def default_config(self): |
|
37 | def default_config(self): | |
47 | c = Config({ |
|
38 | c = Config({ | |
48 | 'NbConvertBase': { |
|
39 | 'NbConvertBase': { | |
49 | 'display_data_priority' : ['text/javascript', 'text/html', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain'] |
|
40 | 'display_data_priority' : ['text/javascript', 'text/html', 'text/markdown', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain'] | |
50 | }, |
|
41 | }, | |
51 | 'CSSHTMLHeaderPreprocessor':{ |
|
42 | 'CSSHTMLHeaderPreprocessor':{ | |
52 | 'enabled':True |
|
43 | 'enabled':True | |
53 | }, |
|
44 | }, | |
54 | 'HighlightMagicsPreprocessor': { |
|
45 | 'HighlightMagicsPreprocessor': { | |
55 | 'enabled':True |
|
46 | 'enabled':True | |
56 | } |
|
47 | } | |
57 | }) |
|
48 | }) | |
58 | c.merge(super(HTMLExporter,self).default_config) |
|
49 | c.merge(super(HTMLExporter,self).default_config) | |
59 | return c |
|
50 | return c | |
60 |
|
51 | |||
61 | def from_notebook_node(self, nb, resources=None, **kw): |
|
52 | def from_notebook_node(self, nb, resources=None, **kw): | |
62 | langinfo = nb.metadata.get('language_info', {}) |
|
53 | langinfo = nb.metadata.get('language_info', {}) | |
63 | lexer = langinfo.get('pygments_lexer', langinfo.get('name', None)) |
|
54 | lexer = langinfo.get('pygments_lexer', langinfo.get('name', None)) | |
64 | self.register_filter('highlight_code', |
|
55 | self.register_filter('highlight_code', | |
65 | Highlight2HTML(pygments_lexer=lexer, parent=self)) |
|
56 | Highlight2HTML(pygments_lexer=lexer, parent=self)) | |
66 | return super(HTMLExporter, self).from_notebook_node(nb, resources, **kw) |
|
57 | return super(HTMLExporter, self).from_notebook_node(nb, resources, **kw) |
@@ -1,192 +1,198 b'' | |||||
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 rendered"> |
|
5 | <div class="cell border-box-sizing code_cell rendered"> | |
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 | {%- if cell.execution_count is defined -%} |
|
26 | {%- if cell.execution_count is defined -%} | |
27 | In [{{ cell.execution_count|replace(None, " ") }}]: |
|
27 | In [{{ cell.execution_count|replace(None, " ") }}]: | |
28 | {%- else -%} |
|
28 | {%- else -%} | |
29 | In [ ]: |
|
29 | In [ ]: | |
30 | {%- endif -%} |
|
30 | {%- endif -%} | |
31 | </div> |
|
31 | </div> | |
32 | {%- endblock in_prompt %} |
|
32 | {%- endblock in_prompt %} | |
33 |
|
33 | |||
34 | {% block empty_in_prompt -%} |
|
34 | {% block empty_in_prompt -%} | |
35 | <div class="prompt input_prompt"> |
|
35 | <div class="prompt input_prompt"> | |
36 | </div> |
|
36 | </div> | |
37 | {%- endblock empty_in_prompt %} |
|
37 | {%- endblock empty_in_prompt %} | |
38 |
|
38 | |||
39 | {# |
|
39 | {# | |
40 | output_prompt doesn't do anything in HTML, |
|
40 | output_prompt doesn't do anything in HTML, | |
41 | because there is a prompt div in each output area (see output block) |
|
41 | because there is a prompt div in each output area (see output block) | |
42 | #} |
|
42 | #} | |
43 | {% block output_prompt %} |
|
43 | {% block output_prompt %} | |
44 | {% endblock output_prompt %} |
|
44 | {% endblock output_prompt %} | |
45 |
|
45 | |||
46 | {% block input %} |
|
46 | {% block input %} | |
47 | <div class="inner_cell"> |
|
47 | <div class="inner_cell"> | |
48 | <div class="input_area"> |
|
48 | <div class="input_area"> | |
49 | {{ cell.source | highlight_code(metadata=cell.metadata) }} |
|
49 | {{ cell.source | highlight_code(metadata=cell.metadata) }} | |
50 | </div> |
|
50 | </div> | |
51 | </div> |
|
51 | </div> | |
52 | {%- endblock input %} |
|
52 | {%- endblock input %} | |
53 |
|
53 | |||
54 | {% block output %} |
|
54 | {% block output %} | |
55 | <div class="output_area"> |
|
55 | <div class="output_area"> | |
56 | {%- if output.output_type == 'execute_result' -%} |
|
56 | {%- if output.output_type == 'execute_result' -%} | |
57 | <div class="prompt output_prompt"> |
|
57 | <div class="prompt output_prompt"> | |
58 | {%- if cell.execution_count is defined -%} |
|
58 | {%- if cell.execution_count is defined -%} | |
59 | Out[{{ cell.execution_count|replace(None, " ") }}]: |
|
59 | Out[{{ cell.execution_count|replace(None, " ") }}]: | |
60 | {%- else -%} |
|
60 | {%- else -%} | |
61 | Out[ ]: |
|
61 | Out[ ]: | |
62 | {%- endif -%} |
|
62 | {%- endif -%} | |
63 | {%- else -%} |
|
63 | {%- else -%} | |
64 | <div class="prompt"> |
|
64 | <div class="prompt"> | |
65 | {%- endif -%} |
|
65 | {%- endif -%} | |
66 | </div> |
|
66 | </div> | |
67 | {{ super() }} |
|
67 | {{ super() }} | |
68 | </div> |
|
68 | </div> | |
69 | {% endblock output %} |
|
69 | {% endblock output %} | |
70 |
|
70 | |||
71 | {% block markdowncell scoped %} |
|
71 | {% block markdowncell scoped %} | |
72 | <div class="cell border-box-sizing text_cell rendered"> |
|
72 | <div class="cell border-box-sizing text_cell rendered"> | |
73 | {{ self.empty_in_prompt() }} |
|
73 | {{ self.empty_in_prompt() }} | |
74 | <div class="inner_cell"> |
|
74 | <div class="inner_cell"> | |
75 | <div class="text_cell_render border-box-sizing rendered_html"> |
|
75 | <div class="text_cell_render border-box-sizing rendered_html"> | |
76 | {{ cell.source | markdown2html | strip_files_prefix }} |
|
76 | {{ cell.source | markdown2html | strip_files_prefix }} | |
77 | </div> |
|
77 | </div> | |
78 | </div> |
|
78 | </div> | |
79 | </div> |
|
79 | </div> | |
80 | {%- endblock markdowncell %} |
|
80 | {%- endblock markdowncell %} | |
81 |
|
81 | |||
82 | {% block unknowncell scoped %} |
|
82 | {% block unknowncell scoped %} | |
83 | unknown type {{ cell.type }} |
|
83 | unknown type {{ cell.type }} | |
84 | {% endblock unknowncell %} |
|
84 | {% endblock unknowncell %} | |
85 |
|
85 | |||
86 | {% block execute_result -%} |
|
86 | {% block execute_result -%} | |
87 | {%- set extra_class="output_execute_result" -%} |
|
87 | {%- set extra_class="output_execute_result" -%} | |
88 | {% block data_priority scoped %} |
|
88 | {% block data_priority scoped %} | |
89 | {{ super() }} |
|
89 | {{ super() }} | |
90 | {% endblock %} |
|
90 | {% endblock %} | |
91 | {%- set extra_class="" -%} |
|
91 | {%- set extra_class="" -%} | |
92 | {%- endblock execute_result %} |
|
92 | {%- endblock execute_result %} | |
93 |
|
93 | |||
94 | {% block stream_stdout -%} |
|
94 | {% block stream_stdout -%} | |
95 | <div class="output_subarea output_stream output_stdout output_text"> |
|
95 | <div class="output_subarea output_stream output_stdout output_text"> | |
96 | <pre> |
|
96 | <pre> | |
97 | {{- output.text | ansi2html -}} |
|
97 | {{- output.text | ansi2html -}} | |
98 | </pre> |
|
98 | </pre> | |
99 | </div> |
|
99 | </div> | |
100 | {%- endblock stream_stdout %} |
|
100 | {%- endblock stream_stdout %} | |
101 |
|
101 | |||
102 | {% block stream_stderr -%} |
|
102 | {% block stream_stderr -%} | |
103 | <div class="output_subarea output_stream output_stderr output_text"> |
|
103 | <div class="output_subarea output_stream output_stderr output_text"> | |
104 | <pre> |
|
104 | <pre> | |
105 | {{- output.text | ansi2html -}} |
|
105 | {{- output.text | ansi2html -}} | |
106 | </pre> |
|
106 | </pre> | |
107 | </div> |
|
107 | </div> | |
108 | {%- endblock stream_stderr %} |
|
108 | {%- endblock stream_stderr %} | |
109 |
|
109 | |||
110 | {% block data_svg scoped -%} |
|
110 | {% block data_svg scoped -%} | |
111 | <div class="output_svg output_subarea {{extra_class}}"> |
|
111 | <div class="output_svg output_subarea {{extra_class}}"> | |
112 | {%- if output.svg_filename %} |
|
112 | {%- if output.svg_filename %} | |
113 | <img src="{{output.svg_filename | posix_path}}" |
|
113 | <img src="{{output.svg_filename | posix_path}}" | |
114 | {%- else %} |
|
114 | {%- else %} | |
115 | {{ output.data['image/svg+xml'] }} |
|
115 | {{ output.data['image/svg+xml'] }} | |
116 | {%- endif %} |
|
116 | {%- endif %} | |
117 | </div> |
|
117 | </div> | |
118 | {%- endblock data_svg %} |
|
118 | {%- endblock data_svg %} | |
119 |
|
119 | |||
120 | {% block data_html scoped -%} |
|
120 | {% block data_html scoped -%} | |
121 | <div class="output_html rendered_html output_subarea {{extra_class}}"> |
|
121 | <div class="output_html rendered_html output_subarea {{extra_class}}"> | |
122 | {{ output.data['text/html'] }} |
|
122 | {{ output.data['text/html'] }} | |
123 | </div> |
|
123 | </div> | |
124 | {%- endblock data_html %} |
|
124 | {%- endblock data_html %} | |
125 |
|
125 | |||
|
126 | {% block data_markdown scoped -%} | |||
|
127 | <div class="output_markdown rendered_html output_subarea {{extra_class}}"> | |||
|
128 | {{ output.data['text/markdown'] | markdown2html }} | |||
|
129 | </div> | |||
|
130 | {%- endblock data_markdown %} | |||
|
131 | ||||
126 | {% block data_png scoped %} |
|
132 | {% block data_png scoped %} | |
127 | <div class="output_png output_subarea {{extra_class}}"> |
|
133 | <div class="output_png output_subarea {{extra_class}}"> | |
128 | {%- if 'image/png' in output.metadata.get('filenames', {}) %} |
|
134 | {%- if 'image/png' in output.metadata.get('filenames', {}) %} | |
129 | <img src="{{output.metadata.filenames['image/png'] | posix_path}}" |
|
135 | <img src="{{output.metadata.filenames['image/png'] | posix_path}}" | |
130 | {%- else %} |
|
136 | {%- else %} | |
131 | <img src="data:image/png;base64,{{ output.data['image/png'] }}" |
|
137 | <img src="data:image/png;base64,{{ output.data['image/png'] }}" | |
132 | {%- endif %} |
|
138 | {%- endif %} | |
133 | {%- if 'width' in output.metadata.get('image/png', {}) %} |
|
139 | {%- if 'width' in output.metadata.get('image/png', {}) %} | |
134 | width={{output.metadata['png']['width']}} |
|
140 | width={{output.metadata['png']['width']}} | |
135 | {%- endif %} |
|
141 | {%- endif %} | |
136 | {%- if 'height' in output.metadata.get('image/png', {}) %} |
|
142 | {%- if 'height' in output.metadata.get('image/png', {}) %} | |
137 | height={{output.metadata['png']['height']}} |
|
143 | height={{output.metadata['png']['height']}} | |
138 | {%- endif %} |
|
144 | {%- endif %} | |
139 | > |
|
145 | > | |
140 | </div> |
|
146 | </div> | |
141 | {%- endblock data_png %} |
|
147 | {%- endblock data_png %} | |
142 |
|
148 | |||
143 | {% block data_jpg scoped %} |
|
149 | {% block data_jpg scoped %} | |
144 | <div class="output_jpeg output_subarea {{extra_class}}"> |
|
150 | <div class="output_jpeg output_subarea {{extra_class}}"> | |
145 | {%- if 'image/jpeg' in output.metadata.get('filenames', {}) %} |
|
151 | {%- if 'image/jpeg' in output.metadata.get('filenames', {}) %} | |
146 | <img src="{{output.metadata.filenames['image/jpeg'] | posix_path}}" |
|
152 | <img src="{{output.metadata.filenames['image/jpeg'] | posix_path}}" | |
147 | {%- else %} |
|
153 | {%- else %} | |
148 | <img src="data:image/jpeg;base64,{{ output.data['image/jpeg'] }}" |
|
154 | <img src="data:image/jpeg;base64,{{ output.data['image/jpeg'] }}" | |
149 | {%- endif %} |
|
155 | {%- endif %} | |
150 | {%- if 'width' in output.metadata.get('image/jpeg', {}) %} |
|
156 | {%- if 'width' in output.metadata.get('image/jpeg', {}) %} | |
151 | width={{output.metadata['image/jpeg']['width']}} |
|
157 | width={{output.metadata['image/jpeg']['width']}} | |
152 | {%- endif %} |
|
158 | {%- endif %} | |
153 | {%- if 'height' in output.metadata.get('image/jpeg', {}) %} |
|
159 | {%- if 'height' in output.metadata.get('image/jpeg', {}) %} | |
154 | height={{output.metadata['image/jpeg']['height']}} |
|
160 | height={{output.metadata['image/jpeg']['height']}} | |
155 | {%- endif %} |
|
161 | {%- endif %} | |
156 | > |
|
162 | > | |
157 | </div> |
|
163 | </div> | |
158 | {%- endblock data_jpg %} |
|
164 | {%- endblock data_jpg %} | |
159 |
|
165 | |||
160 | {% block data_latex scoped %} |
|
166 | {% block data_latex scoped %} | |
161 | <div class="output_latex output_subarea {{extra_class}}"> |
|
167 | <div class="output_latex output_subarea {{extra_class}}"> | |
162 | {{ output.data['text/latex'] }} |
|
168 | {{ output.data['text/latex'] }} | |
163 | </div> |
|
169 | </div> | |
164 | {%- endblock data_latex %} |
|
170 | {%- endblock data_latex %} | |
165 |
|
171 | |||
166 | {% block error -%} |
|
172 | {% block error -%} | |
167 | <div class="output_subarea output_text output_error"> |
|
173 | <div class="output_subarea output_text output_error"> | |
168 | <pre> |
|
174 | <pre> | |
169 | {{- super() -}} |
|
175 | {{- super() -}} | |
170 | </pre> |
|
176 | </pre> | |
171 | </div> |
|
177 | </div> | |
172 | {%- endblock error %} |
|
178 | {%- endblock error %} | |
173 |
|
179 | |||
174 | {%- block traceback_line %} |
|
180 | {%- block traceback_line %} | |
175 | {{ line | ansi2html }} |
|
181 | {{ line | ansi2html }} | |
176 | {%- endblock traceback_line %} |
|
182 | {%- endblock traceback_line %} | |
177 |
|
183 | |||
178 | {%- block data_text scoped %} |
|
184 | {%- block data_text scoped %} | |
179 | <div class="output_text output_subarea {{extra_class}}"> |
|
185 | <div class="output_text output_subarea {{extra_class}}"> | |
180 | <pre> |
|
186 | <pre> | |
181 | {{- output.data['text/plain'] | ansi2html -}} |
|
187 | {{- output.data['text/plain'] | ansi2html -}} | |
182 | </pre> |
|
188 | </pre> | |
183 | </div> |
|
189 | </div> | |
184 | {%- endblock -%} |
|
190 | {%- endblock -%} | |
185 |
|
191 | |||
186 | {%- block data_javascript scoped %} |
|
192 | {%- block data_javascript scoped %} | |
187 | <div class="output_subarea output_javascript {{extra_class}}"> |
|
193 | <div class="output_subarea output_javascript {{extra_class}}"> | |
188 | <script type="text/javascript"> |
|
194 | <script type="text/javascript"> | |
189 | {{ output.data['text/javascript'] }} |
|
195 | {{ output.data['text/javascript'] }} | |
190 | </script> |
|
196 | </script> | |
191 | </div> |
|
197 | </div> | |
192 | {%- endblock -%} |
|
198 | {%- endblock -%} |
@@ -1,41 +1,44 b'' | |||||
1 | ((= Auto-generated template file, DO NOT edit directly! |
|
1 | ((= Auto-generated template file, DO NOT edit directly! | |
2 | To edit this file, please refer to ../../skeleton/README.md =)) |
|
2 | To edit this file, please refer to ../../skeleton/README.md =)) | |
3 |
|
3 | |||
4 |
|
4 | |||
5 | ((*- extends 'null.tplx' -*)) |
|
5 | ((*- extends 'null.tplx' -*)) | |
6 |
|
6 | |||
7 | ((=display data priority=)) |
|
7 | ((=display data priority=)) | |
8 |
|
8 | |||
9 |
|
9 | |||
10 | ((*- block data_priority scoped -*)) |
|
10 | ((*- block data_priority scoped -*)) | |
11 | ((*- for type in output.data | filter_data_type -*)) |
|
11 | ((*- for type in output.data | filter_data_type -*)) | |
12 | ((*- if type == 'application/pdf' -*)) |
|
12 | ((*- if type == 'application/pdf' -*)) | |
13 | ((*- block data_pdf -*)) |
|
13 | ((*- block data_pdf -*)) | |
14 | ((*- endblock -*)) |
|
14 | ((*- endblock -*)) | |
15 | ((*- elif type == 'image/svg+xml' -*)) |
|
15 | ((*- elif type == 'image/svg+xml' -*)) | |
16 | ((*- block data_svg -*)) |
|
16 | ((*- block data_svg -*)) | |
17 | ((*- endblock -*)) |
|
17 | ((*- endblock -*)) | |
18 | ((*- elif type == 'image/png' -*)) |
|
18 | ((*- elif type == 'image/png' -*)) | |
19 | ((*- block data_png -*)) |
|
19 | ((*- block data_png -*)) | |
20 | ((*- endblock -*)) |
|
20 | ((*- endblock -*)) | |
21 | ((*- elif type == 'text/html' -*)) |
|
21 | ((*- elif type == 'text/html' -*)) | |
22 | ((*- block data_html -*)) |
|
22 | ((*- block data_html -*)) | |
23 | ((*- endblock -*)) |
|
23 | ((*- endblock -*)) | |
|
24 | ((*- elif type == 'text/markdown' -*)) | |||
|
25 | ((*- block data_markdown -*)) | |||
|
26 | ((*- endblock -*)) | |||
24 | ((*- elif type == 'image/jpeg' -*)) |
|
27 | ((*- elif type == 'image/jpeg' -*)) | |
25 | ((*- block data_jpg -*)) |
|
28 | ((*- block data_jpg -*)) | |
26 | ((*- endblock -*)) |
|
29 | ((*- endblock -*)) | |
27 | ((*- elif type == 'text/plain' -*)) |
|
30 | ((*- elif type == 'text/plain' -*)) | |
28 | ((*- block data_text -*)) |
|
31 | ((*- block data_text -*)) | |
29 | ((*- endblock -*)) |
|
32 | ((*- endblock -*)) | |
30 | ((*- elif type == 'text/latex' -*)) |
|
33 | ((*- elif type == 'text/latex' -*)) | |
31 | ((*- block data_latex -*)) |
|
34 | ((*- block data_latex -*)) | |
32 | ((*- endblock -*)) |
|
35 | ((*- endblock -*)) | |
33 | ((*- elif type == 'application/javascript' -*)) |
|
36 | ((*- elif type == 'application/javascript' -*)) | |
34 | ((*- block data_javascript -*)) |
|
37 | ((*- block data_javascript -*)) | |
35 | ((*- endblock -*)) |
|
38 | ((*- endblock -*)) | |
36 | ((*- else -*)) |
|
39 | ((*- else -*)) | |
37 | ((*- block data_other -*)) |
|
40 | ((*- block data_other -*)) | |
38 | ((*- endblock -*)) |
|
41 | ((*- endblock -*)) | |
39 | ((*- endif -*)) |
|
42 | ((*- endif -*)) | |
40 | ((*- endfor -*)) |
|
43 | ((*- endfor -*)) | |
41 | ((*- endblock data_priority -*)) |
|
44 | ((*- endblock data_priority -*)) |
@@ -1,63 +1,67 b'' | |||||
1 | {% extends 'display_priority.tpl' %} |
|
1 | {% extends 'display_priority.tpl' %} | |
2 |
|
2 | |||
3 |
|
3 | |||
4 | {% block in_prompt %} |
|
4 | {% block in_prompt %} | |
5 | {% endblock in_prompt %} |
|
5 | {% endblock in_prompt %} | |
6 |
|
6 | |||
7 | {% block output_prompt %} |
|
7 | {% block output_prompt %} | |
8 | {%- endblock output_prompt %} |
|
8 | {%- endblock output_prompt %} | |
9 |
|
9 | |||
10 | {% block input %} |
|
10 | {% block input %} | |
11 | {{ cell.source | indent(4)}} |
|
11 | {{ cell.source | indent(4)}} | |
12 | {% endblock input %} |
|
12 | {% endblock input %} | |
13 |
|
13 | |||
14 | {% block error %} |
|
14 | {% block error %} | |
15 | {{ super() }} |
|
15 | {{ super() }} | |
16 | {% endblock error %} |
|
16 | {% endblock error %} | |
17 |
|
17 | |||
18 | {% block traceback_line %} |
|
18 | {% block traceback_line %} | |
19 | {{ line | indent | strip_ansi }} |
|
19 | {{ line | indent | strip_ansi }} | |
20 | {% endblock traceback_line %} |
|
20 | {% endblock traceback_line %} | |
21 |
|
21 | |||
22 | {% block execute_result %} |
|
22 | {% block execute_result %} | |
23 |
|
23 | |||
24 | {% block data_priority scoped %} |
|
24 | {% block data_priority scoped %} | |
25 | {{ super() }} |
|
25 | {{ super() }} | |
26 | {% endblock %} |
|
26 | {% endblock %} | |
27 | {% endblock execute_result %} |
|
27 | {% endblock execute_result %} | |
28 |
|
28 | |||
29 | {% block stream %} |
|
29 | {% block stream %} | |
30 | {{ output.text | indent }} |
|
30 | {{ output.text | indent }} | |
31 | {% endblock stream %} |
|
31 | {% endblock stream %} | |
32 |
|
32 | |||
33 | {% block data_svg %} |
|
33 | {% block data_svg %} | |
34 | ![svg]({{ output.svg_filename | path2url }}) |
|
34 | ![svg]({{ output.svg_filename | path2url }}) | |
35 | {% endblock data_svg %} |
|
35 | {% endblock data_svg %} | |
36 |
|
36 | |||
37 | {% block data_png %} |
|
37 | {% block data_png %} | |
38 | ![png]({{ output.metadata.filenames['image/png'] | path2url }}) |
|
38 | ![png]({{ output.metadata.filenames['image/png'] | path2url }}) | |
39 | {% endblock data_png %} |
|
39 | {% endblock data_png %} | |
40 |
|
40 | |||
41 | {% block data_jpg %} |
|
41 | {% block data_jpg %} | |
42 | ![jpeg]({{ output.metadata.filenames['image/jpeg'] | path2url }}) |
|
42 | ![jpeg]({{ output.metadata.filenames['image/jpeg'] | path2url }}) | |
43 | {% endblock data_jpg %} |
|
43 | {% endblock data_jpg %} | |
44 |
|
44 | |||
45 | {% block data_latex %} |
|
45 | {% block data_latex %} | |
46 | {{ output.data['text/latex'] }} |
|
46 | {{ output.data['text/latex'] }} | |
47 | {% endblock data_latex %} |
|
47 | {% endblock data_latex %} | |
48 |
|
48 | |||
49 | {% block data_html scoped %} |
|
49 | {% block data_html scoped %} | |
50 | {{ output.data['text/html'] }} |
|
50 | {{ output.data['text/html'] }} | |
51 | {% endblock data_html %} |
|
51 | {% endblock data_html %} | |
52 |
|
52 | |||
|
53 | {% block data_markdown scoped %} | |||
|
54 | {{ output.data['text/markdown'] }} | |||
|
55 | {% endblock data_markdown %} | |||
|
56 | ||||
53 | {% block data_text scoped %} |
|
57 | {% block data_text scoped %} | |
54 | {{ output.data['text/plain'] | indent }} |
|
58 | {{ output.data['text/plain'] | indent }} | |
55 | {% endblock data_text %} |
|
59 | {% endblock data_text %} | |
56 |
|
60 | |||
57 | {% block markdowncell scoped %} |
|
61 | {% block markdowncell scoped %} | |
58 | {{ cell.source }} |
|
62 | {{ cell.source }} | |
59 | {% endblock markdowncell %} |
|
63 | {% endblock markdowncell %} | |
60 |
|
64 | |||
61 | {% block unknowncell scoped %} |
|
65 | {% block unknowncell scoped %} | |
62 | unknown type {{ cell.type }} |
|
66 | unknown type {{ cell.type }} | |
63 | {% endblock unknowncell %} No newline at end of file |
|
67 | {% endblock unknowncell %} |
@@ -1,37 +1,40 b'' | |||||
1 | {%- extends 'null.tpl' -%} |
|
1 | {%- extends 'null.tpl' -%} | |
2 |
|
2 | |||
3 | {#display data priority#} |
|
3 | {#display data priority#} | |
4 |
|
4 | |||
5 |
|
5 | |||
6 | {%- block data_priority scoped -%} |
|
6 | {%- block data_priority scoped -%} | |
7 | {%- for type in output.data | filter_data_type -%} |
|
7 | {%- for type in output.data | filter_data_type -%} | |
8 | {%- if type == 'application/pdf' -%} |
|
8 | {%- if type == 'application/pdf' -%} | |
9 | {%- block data_pdf -%} |
|
9 | {%- block data_pdf -%} | |
10 | {%- endblock -%} |
|
10 | {%- endblock -%} | |
11 | {%- elif type == 'image/svg+xml' -%} |
|
11 | {%- elif type == 'image/svg+xml' -%} | |
12 | {%- block data_svg -%} |
|
12 | {%- block data_svg -%} | |
13 | {%- endblock -%} |
|
13 | {%- endblock -%} | |
14 | {%- elif type == 'image/png' -%} |
|
14 | {%- elif type == 'image/png' -%} | |
15 | {%- block data_png -%} |
|
15 | {%- block data_png -%} | |
16 | {%- endblock -%} |
|
16 | {%- endblock -%} | |
17 | {%- elif type == 'text/html' -%} |
|
17 | {%- elif type == 'text/html' -%} | |
18 | {%- block data_html -%} |
|
18 | {%- block data_html -%} | |
19 | {%- endblock -%} |
|
19 | {%- endblock -%} | |
|
20 | {%- elif type == 'text/markdown' -%} | |||
|
21 | {%- block data_markdown -%} | |||
|
22 | {%- endblock -%} | |||
20 | {%- elif type == 'image/jpeg' -%} |
|
23 | {%- elif type == 'image/jpeg' -%} | |
21 | {%- block data_jpg -%} |
|
24 | {%- block data_jpg -%} | |
22 | {%- endblock -%} |
|
25 | {%- endblock -%} | |
23 | {%- elif type == 'text/plain' -%} |
|
26 | {%- elif type == 'text/plain' -%} | |
24 | {%- block data_text -%} |
|
27 | {%- block data_text -%} | |
25 | {%- endblock -%} |
|
28 | {%- endblock -%} | |
26 | {%- elif type == 'text/latex' -%} |
|
29 | {%- elif type == 'text/latex' -%} | |
27 | {%- block data_latex -%} |
|
30 | {%- block data_latex -%} | |
28 | {%- endblock -%} |
|
31 | {%- endblock -%} | |
29 | {%- elif type == 'application/javascript' -%} |
|
32 | {%- elif type == 'application/javascript' -%} | |
30 | {%- block data_javascript -%} |
|
33 | {%- block data_javascript -%} | |
31 | {%- endblock -%} |
|
34 | {%- endblock -%} | |
32 | {%- else -%} |
|
35 | {%- else -%} | |
33 | {%- block data_other -%} |
|
36 | {%- block data_other -%} | |
34 | {%- endblock -%} |
|
37 | {%- endblock -%} | |
35 | {%- endif -%} |
|
38 | {%- endif -%} | |
36 | {%- endfor -%} |
|
39 | {%- endfor -%} | |
37 | {%- endblock data_priority -%} |
|
40 | {%- endblock data_priority -%} |
General Comments 0
You need to be logged in to leave comments.
Login now