Show More
The requested changes are too big and content was truncated. Show full diff
@@ -0,0 +1,21 b'' | |||||
|
1 | {%- extends 'basichtml.tpl' -%} | |||
|
2 | ||||
|
3 | ||||
|
4 | ||||
|
5 | {%- block any_cell scoped -%} | |||
|
6 | {%- if cell.metadata.slide_type in ['-', 'slide', 'subslide'] -%} | |||
|
7 | {{ super() }} | |||
|
8 | {%- elif cell.metadata.slide_type in ['skip'] -%} | |||
|
9 | <div style=display:none> | |||
|
10 | {{ super() }} | |||
|
11 | </div> | |||
|
12 | {%- elif cell.metadata.slide_type in ['notes'] -%} | |||
|
13 | <aside class="notes"> | |||
|
14 | {{ super() }} | |||
|
15 | </aside> | |||
|
16 | {%- elif cell.metadata.slide_type in ['fragment'] -%} | |||
|
17 | <div class="fragment"> | |||
|
18 | {{ super() }} | |||
|
19 | </div> | |||
|
20 | {%- endif -%} | |||
|
21 | {%- endblock any_cell -%} |
@@ -0,0 +1,17 b'' | |||||
|
1 | {%- extends 'subslides.tpl' -%} | |||
|
2 | ||||
|
3 | ||||
|
4 | ||||
|
5 | {%- block any_cell scoped -%} | |||
|
6 | {%- if cell.metadata.slide_type in ['slide'] -%} | |||
|
7 | <section> | |||
|
8 | <section> | |||
|
9 | {%- endif -%} | |||
|
10 | ||||
|
11 | {{ super() }} | |||
|
12 | ||||
|
13 | {%- if cell.metadata.slide_helper in ['slide_end'] -%} | |||
|
14 | </section> | |||
|
15 | </section> | |||
|
16 | {%- endif -%} | |||
|
17 | {%- endblock any_cell -%} |
@@ -0,0 +1,15 b'' | |||||
|
1 | {%- extends 'reveal_cells.tpl' -%} | |||
|
2 | ||||
|
3 | ||||
|
4 | ||||
|
5 | {%- block any_cell scoped -%} | |||
|
6 | {%- if cell.metadata.slide_type in ['subslide'] -%} | |||
|
7 | <section> | |||
|
8 | {%- endif -%} | |||
|
9 | ||||
|
10 | {{ super() }} | |||
|
11 | ||||
|
12 | {%- if cell.metadata.slide_helper in ['subslide_end'] -%} | |||
|
13 | </section> | |||
|
14 | {%- endif -%} | |||
|
15 | {%- endblock any_cell -%} |
@@ -1,328 +1,243 b'' | |||||
1 | """ |
|
1 | """ | |
2 |
|
2 | |||
3 | """ |
|
3 | """ | |
4 |
|
4 | |||
5 | from __future__ import print_function |
|
5 | from __future__ import print_function | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | from IPython.config.configurable import Configurable |
|
8 | from IPython.config.configurable import Configurable | |
9 | from IPython.utils.traitlets import Unicode, Bool, Dict, List |
|
9 | from IPython.utils.traitlets import Unicode, Bool, Dict, List | |
10 |
|
10 | |||
11 | class ConfigurableTransformers(Configurable): |
|
11 | class ConfigurableTransformers(Configurable): | |
12 | """ A configurable transformer """ |
|
12 | """ A configurable transformer """ | |
13 |
|
13 | |||
14 | def __init__(self, config=None, **kw): |
|
14 | def __init__(self, config=None, **kw): | |
15 | super(ConfigurableTransformers, self).__init__(config=config, **kw) |
|
15 | super(ConfigurableTransformers, self).__init__(config=config, **kw) | |
16 |
|
16 | |||
17 | def __call__(self, nb, other): |
|
17 | def __call__(self, nb, other): | |
18 | try : |
|
18 | try : | |
19 | for worksheet in nb.worksheets : |
|
19 | for worksheet in nb.worksheets : | |
20 | for index, cell in enumerate(worksheet.cells): |
|
20 | for index, cell in enumerate(worksheet.cells): | |
21 | worksheet.cells[index], other = self.cell_transform(cell, other, index) |
|
21 | worksheet.cells[index], other = self.cell_transform(cell, other, index) | |
22 | return nb, other |
|
22 | return nb, other | |
23 | except NotImplementedError: |
|
23 | except NotImplementedError: | |
24 | raise NotImplementedError('should be implemented by subclass') |
|
24 | raise NotImplementedError('should be implemented by subclass') | |
25 |
|
25 | |||
26 | def cell_transform(self, cell, other, index): |
|
26 | def cell_transform(self, cell, other, index): | |
27 | """ |
|
27 | """ | |
28 | Overwrite if you want to apply a transformation on each cell |
|
28 | Overwrite if you want to apply a transformation on each cell | |
29 | """ |
|
29 | """ | |
30 | raise NotImplementedError('should be implemented by subclass') |
|
30 | raise NotImplementedError('should be implemented by subclass') | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | class ActivatableTransformer(ConfigurableTransformers): |
|
33 | class ActivatableTransformer(ConfigurableTransformers): | |
34 |
|
34 | |||
35 | enabled = Bool(False, config=True) |
|
35 | enabled = Bool(False, config=True) | |
36 |
|
36 | |||
37 | def __call__(self, nb, other): |
|
37 | def __call__(self, nb, other): | |
38 | if not self.enabled : |
|
38 | if not self.enabled : | |
39 | return nb, other |
|
39 | return nb, other | |
40 | else : |
|
40 | else : | |
41 | return super(ActivatableTransformer, self).__call__(nb, other) |
|
41 | return super(ActivatableTransformer, self).__call__(nb, other) | |
42 |
|
42 | |||
43 |
|
43 | |||
44 | def cell_preprocessor(function): |
|
44 | def cell_preprocessor(function): | |
45 | """ wrap a function to be executed on all cells of a notebook |
|
45 | """ wrap a function to be executed on all cells of a notebook | |
46 |
|
46 | |||
47 | wrapped function parameters : |
|
47 | wrapped function parameters : | |
48 | cell : the cell |
|
48 | cell : the cell | |
49 | other : external resources |
|
49 | other : external resources | |
50 | index : index of the cell |
|
50 | index : index of the cell | |
51 | """ |
|
51 | """ | |
52 | def wrappedfunc(nb, other): |
|
52 | def wrappedfunc(nb, other): | |
53 | for worksheet in nb.worksheets : |
|
53 | for worksheet in nb.worksheets : | |
54 | for index, cell in enumerate(worksheet.cells): |
|
54 | for index, cell in enumerate(worksheet.cells): | |
55 | worksheet.cells[index], other = function(cell, other, index) |
|
55 | worksheet.cells[index], other = function(cell, other, index) | |
56 | return nb, other |
|
56 | return nb, other | |
57 | return wrappedfunc |
|
57 | return wrappedfunc | |
58 |
|
58 | |||
59 |
|
59 | |||
60 | @cell_preprocessor |
|
60 | @cell_preprocessor | |
61 | def haspyout_transformer(cell, other, count): |
|
61 | def haspyout_transformer(cell, other, count): | |
62 | """ |
|
62 | """ | |
63 | Add a haspyout flag to cell that have it |
|
63 | Add a haspyout flag to cell that have it | |
64 |
|
64 | |||
65 | Easier for templating, where you can't know in advance |
|
65 | Easier for templating, where you can't know in advance | |
66 | wether to write the out prompt |
|
66 | wether to write the out prompt | |
67 |
|
67 | |||
68 | """ |
|
68 | """ | |
69 | cell.type = cell.cell_type |
|
69 | cell.type = cell.cell_type | |
70 | cell.haspyout = False |
|
70 | cell.haspyout = False | |
71 | for out in cell.get('outputs', []): |
|
71 | for out in cell.get('outputs', []): | |
72 | if out.output_type == 'pyout': |
|
72 | if out.output_type == 'pyout': | |
73 | cell.haspyout = True |
|
73 | cell.haspyout = True | |
74 | break |
|
74 | break | |
75 | return cell, other |
|
75 | return cell, other | |
76 |
|
76 | |||
77 | @cell_preprocessor |
|
77 | @cell_preprocessor | |
78 | def coalesce_streams(cell, other, count): |
|
78 | def coalesce_streams(cell, other, count): | |
79 | """merge consecutive sequences of stream output into single stream |
|
79 | """merge consecutive sequences of stream output into single stream | |
80 |
|
80 | |||
81 | to prevent extra newlines inserted at flush calls |
|
81 | to prevent extra newlines inserted at flush calls | |
82 |
|
82 | |||
83 | TODO: handle \r deletion |
|
83 | TODO: handle \r deletion | |
84 | """ |
|
84 | """ | |
85 | outputs = cell.get('outputs', []) |
|
85 | outputs = cell.get('outputs', []) | |
86 | if not outputs: |
|
86 | if not outputs: | |
87 | return cell, other |
|
87 | return cell, other | |
88 | new_outputs = [] |
|
88 | new_outputs = [] | |
89 | last = outputs[0] |
|
89 | last = outputs[0] | |
90 | new_outputs = [last] |
|
90 | new_outputs = [last] | |
91 | for output in outputs[1:]: |
|
91 | for output in outputs[1:]: | |
92 | if (output.output_type == 'stream' and |
|
92 | if (output.output_type == 'stream' and | |
93 | last.output_type == 'stream' and |
|
93 | last.output_type == 'stream' and | |
94 | last.stream == output.stream |
|
94 | last.stream == output.stream | |
95 | ): |
|
95 | ): | |
96 | last.text += output.text |
|
96 | last.text += output.text | |
97 | else: |
|
97 | else: | |
98 | new_outputs.append(output) |
|
98 | new_outputs.append(output) | |
99 |
|
99 | |||
100 | cell.outputs = new_outputs |
|
100 | cell.outputs = new_outputs | |
101 | return cell, other |
|
101 | return cell, other | |
102 |
|
102 | |||
103 |
|
103 | |||
104 |
|
104 | |||
105 | class ExtractFigureTransformer(ActivatableTransformer): |
|
105 | class ExtractFigureTransformer(ActivatableTransformer): | |
106 |
|
106 | |||
107 | extra_ext_map = Dict({}, |
|
107 | extra_ext_map = Dict({}, | |
108 | config=True, |
|
108 | config=True, | |
109 | help="""extra map to override extension based on type. |
|
109 | help="""extra map to override extension based on type. | |
110 | Usefull for latex where svg will be converted to pdf before inclusion |
|
110 | Usefull for latex where svg will be converted to pdf before inclusion | |
111 | """ |
|
111 | """ | |
112 | ) |
|
112 | ) | |
113 | display_data_priority = List(['html', 'pdf', 'svg', 'latex', 'png', 'jpg', 'jpeg' , 'text'], |
|
113 | display_data_priority = List(['html', 'pdf', 'svg', 'latex', 'png', 'jpg', 'jpeg' , 'text'], | |
114 | config=True, |
|
114 | config=True, | |
115 | help= """ |
|
115 | help= """ | |
116 | An ordered list of prefered output type, the first |
|
116 | An ordered list of prefered output type, the first | |
117 | encounterd will usually be used when converting discarding |
|
117 | encounterd will usually be used when converting discarding | |
118 | the others. |
|
118 | the others. | |
119 | """ |
|
119 | """ | |
120 | ) |
|
120 | ) | |
121 |
|
121 | |||
122 | key_format_map = Dict({}, |
|
122 | key_format_map = Dict({}, | |
123 | config=True, |
|
123 | config=True, | |
124 | ) |
|
124 | ) | |
125 |
|
125 | |||
126 | figname_format_map = Dict({}, |
|
126 | figname_format_map = Dict({}, | |
127 | config=True, |
|
127 | config=True, | |
128 | ) |
|
128 | ) | |
129 |
|
129 | |||
130 | #to do change this to .format {} syntax |
|
130 | #to do change this to .format {} syntax | |
131 | default_key_tpl = Unicode('_fig_{count:02d}.{ext}', config=True) |
|
131 | default_key_tpl = Unicode('_fig_{count:02d}.{ext}', config=True) | |
132 |
|
132 | |||
133 | def _get_ext(self, ext): |
|
133 | def _get_ext(self, ext): | |
134 | if ext in self.extra_ext_map : |
|
134 | if ext in self.extra_ext_map : | |
135 | return self.extra_ext_map[ext] |
|
135 | return self.extra_ext_map[ext] | |
136 | return ext |
|
136 | return ext | |
137 |
|
137 | |||
138 | def _new_figure(self, data, fmt, count): |
|
138 | def _new_figure(self, data, fmt, count): | |
139 | """Create a new figure file in the given format. |
|
139 | """Create a new figure file in the given format. | |
140 |
|
140 | |||
141 | """ |
|
141 | """ | |
142 |
tplf = self.figname_format_map.get(fmt,self.default_key_tpl) |
|
142 | tplf = self.figname_format_map.get(fmt,self.default_key_tpl) | |
143 | tplk = self.key_format_map.get(fmt,self.default_key_tpl) |
|
143 | tplk = self.key_format_map.get(fmt,self.default_key_tpl) | |
144 |
|
144 | |||
145 | # option to pass the hash as data ? |
|
145 | # option to pass the hash as data ? | |
146 | figname = tplf.format(count=count, ext=self._get_ext(fmt)) |
|
146 | figname = tplf.format(count=count, ext=self._get_ext(fmt)) | |
147 | key = tplk.format(count=count, ext=self._get_ext(fmt)) |
|
147 | key = tplk.format(count=count, ext=self._get_ext(fmt)) | |
148 |
|
148 | |||
149 | # Binary files are base64-encoded, SVG is already XML |
|
149 | # Binary files are base64-encoded, SVG is already XML | |
150 | if fmt in ('png', 'jpg', 'pdf'): |
|
150 | if fmt in ('png', 'jpg', 'pdf'): | |
151 | data = data.decode('base64') |
|
151 | data = data.decode('base64') | |
152 |
|
152 | |||
153 | return figname, key, data |
|
153 | return figname, key, data | |
154 |
|
154 | |||
155 |
|
155 | |||
156 | def cell_transform(self, cell, other, count): |
|
156 | def cell_transform(self, cell, other, count): | |
157 | if other.get('figures', None) is None : |
|
157 | if other.get('figures', None) is None : | |
158 | other['figures'] = {} |
|
158 | other['figures'] = {} | |
159 | for out in cell.get('outputs', []): |
|
159 | for out in cell.get('outputs', []): | |
160 | for out_type in self.display_data_priority: |
|
160 | for out_type in self.display_data_priority: | |
161 | if out.hasattr(out_type): |
|
161 | if out.hasattr(out_type): | |
162 | figname, key, data = self._new_figure(out[out_type], out_type, count) |
|
162 | figname, key, data = self._new_figure(out[out_type], out_type, count) | |
163 | out['key_'+out_type] = figname |
|
163 | out['key_'+out_type] = figname | |
164 | other['figures'][key] = data |
|
164 | other['figures'][key] = data | |
165 | count = count+1 |
|
165 | count = count+1 | |
166 | return cell, other |
|
166 | return cell, other | |
167 |
|
167 | |||
168 | class RevealHelpTransformer(ConfigurableTransformers): |
|
168 | class RevealHelpTransformer(ConfigurableTransformers): | |
169 |
|
169 | |||
170 | section_open = False |
|
170 | def __call__(self, nb, other): | |
171 | subsection_open = False |
|
171 | try : | |
172 | fragment_open = False |
|
172 | for worksheet in nb.worksheets : | |
173 |
|
173 | for i, cell in enumerate(worksheet.cells): | ||
174 | def open_subsection(self): |
|
174 | cell.metadata.slide_type = cell.metadata.get('slideshow', {}).get('slide_type', None) | |
175 | self.subsection_open = True |
|
175 | if cell.metadata.slide_type is None: | |
176 | return True |
|
176 | cell.metadata.slide_type = '-' | |
177 |
|
177 | if cell.metadata.slide_type in ['slide']: | ||
178 | def open_section(self): |
|
178 | worksheet.cells[i - 1].metadata.slide_helper = 'slide_end' | |
179 | self.section_open = True |
|
179 | if cell.metadata.slide_type in ['subslide']: | |
180 | return True |
|
180 | worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end' | |
181 |
|
181 | return nb, other | ||
182 | def open_fragment(self): |
|
182 | except NotImplementedError as error : | |
183 | self.fragment_open = True |
|
183 | raise NotImplementedError('should be implemented by subclass') | |
184 | return True |
|
|||
185 |
|
||||
186 | # could probaly write those maybe_close/open |
|
|||
187 | # with a function functor |
|
|||
188 | def maybe_close_section(self): |
|
|||
189 | """return True is already open, false otherwise |
|
|||
190 | and change state to close |
|
|||
191 | """ |
|
|||
192 | if self.section_open : |
|
|||
193 | self.section_open = False |
|
|||
194 | return True |
|
|||
195 | else : |
|
|||
196 | return False |
|
|||
197 |
|
||||
198 | def maybe_open_section(self): |
|
|||
199 | """return True is already open, false otherwise |
|
|||
200 | and change state to close |
|
|||
201 | """ |
|
|||
202 | if not self.section_open : |
|
|||
203 | self.section_open = True |
|
|||
204 | return True |
|
|||
205 | else : |
|
|||
206 | return False |
|
|||
207 |
|
||||
208 | def maybe_open_subsection(self): |
|
|||
209 | """return True is already open, false otherwise |
|
|||
210 | and change state to close |
|
|||
211 | """ |
|
|||
212 | if not self.subsection_open : |
|
|||
213 | self.subsection_open = True |
|
|||
214 | return True |
|
|||
215 | else : |
|
|||
216 | return False |
|
|||
217 |
|
||||
218 | def maybe_close_subsection(self): |
|
|||
219 | """return True is already open, false otherwise |
|
|||
220 | and change state to close |
|
|||
221 | """ |
|
|||
222 | if self.subsection_open : |
|
|||
223 | self.subsection_open = False |
|
|||
224 | return True |
|
|||
225 | else : |
|
|||
226 | return False |
|
|||
227 |
|
||||
228 | def maybe_close_fragment(self): |
|
|||
229 | """return True is already open, false otherwise |
|
|||
230 | and change state to close |
|
|||
231 | """ |
|
|||
232 | if self.fragment_open : |
|
|||
233 | self.fragment_open = False |
|
|||
234 | return True |
|
|||
235 | else : |
|
|||
236 | return False |
|
|||
237 |
|
||||
238 | def cell_transform(self, cell, other, count): |
|
|||
239 | ctype = cell.metadata.get('slideshow', {}).get('slide_type', None) |
|
|||
240 | if ctype in [None, '-'] : |
|
|||
241 | cell.metadata.slideshow = {} |
|
|||
242 | cell.metadata.slideshow['slide_type'] = None |
|
|||
243 | elif ctype == 'fragment': |
|
|||
244 | cell.metadata.slideshow.close_fragment = self.maybe_close_fragment() |
|
|||
245 | cell.metadata.slideshow.close_subsection = False |
|
|||
246 | cell.metadata.slideshow.close_section = False |
|
|||
247 |
|
||||
248 | cell.metadata.slideshow.open_section = self.maybe_open_section() |
|
|||
249 | cell.metadata.slideshow.open_subsection = self.maybe_open_subsection() |
|
|||
250 | cell.metadata.slideshow.open_fragment = self.open_fragment() |
|
|||
251 |
|
||||
252 | elif ctype == 'subslide': |
|
|||
253 | cell.metadata.slideshow.close_fragment = self.maybe_close_fragment() |
|
|||
254 | cell.metadata.slideshow.close_subsection = self.maybe_close_subsection() |
|
|||
255 | cell.metadata.slideshow.close_section = False |
|
|||
256 |
|
||||
257 | cell.metadata.slideshow.open_section = self.maybe_open_section() |
|
|||
258 | cell.metadata.slideshow.open_subsection = self.open_subsection() |
|
|||
259 | cell.metadata.slideshow.open_fragment = False |
|
|||
260 | elif ctype == 'slide': |
|
|||
261 | cell.metadata.slideshow.close_fragment = self.maybe_close_fragment() |
|
|||
262 | cell.metadata.slideshow.close_subsection = self.maybe_close_subsection() |
|
|||
263 | cell.metadata.slideshow.close_section = self.maybe_close_section() |
|
|||
264 |
|
||||
265 | cell.metadata.slideshow.open_section = self.open_section() |
|
|||
266 | cell.metadata.slideshow.open_subsection = self.open_subsection() |
|
|||
267 | cell.metadata.slideshow.open_fragment = False |
|
|||
268 | return cell, other |
|
|||
269 |
|
184 | |||
270 |
|
185 | |||
271 | class CSSHtmlHeaderTransformer(ActivatableTransformer): |
|
186 | class CSSHtmlHeaderTransformer(ActivatableTransformer): | |
272 |
|
187 | |||
273 | def __call__(self, nb, resources): |
|
188 | def __call__(self, nb, resources): | |
274 | """Fetch and add css to the resource dict |
|
189 | """Fetch and add css to the resource dict | |
275 |
|
190 | |||
276 | Fetch css from IPython adn Pygment to add at the beginning |
|
191 | Fetch css from IPython adn Pygment to add at the beginning | |
277 | of the html files. |
|
192 | of the html files. | |
278 |
|
193 | |||
279 | Add this css in resources in the "inlining.css" key |
|
194 | Add this css in resources in the "inlining.css" key | |
280 | """ |
|
195 | """ | |
281 | resources['inlining'] = {} |
|
196 | resources['inlining'] = {} | |
282 | resources['inlining']['css'] = self.header |
|
197 | resources['inlining']['css'] = self.header | |
283 | return nb, resources |
|
198 | return nb, resources | |
284 |
|
199 | |||
285 | header = [] |
|
200 | header = [] | |
286 |
|
201 | |||
287 | def __init__(self, config=None, **kw): |
|
202 | def __init__(self, config=None, **kw): | |
288 | super(CSSHtmlHeaderTransformer, self).__init__(config=config, **kw) |
|
203 | super(CSSHtmlHeaderTransformer, self).__init__(config=config, **kw) | |
289 | if self.enabled : |
|
204 | if self.enabled : | |
290 | self.regen_header() |
|
205 | self.regen_header() | |
291 |
|
206 | |||
292 | def regen_header(self): |
|
207 | def regen_header(self): | |
293 | ## lazy load asa this might not be use in many transformers |
|
208 | ## lazy load asa this might not be use in many transformers | |
294 | import os |
|
209 | import os | |
295 | from IPython.utils import path |
|
210 | from IPython.utils import path | |
296 | import io |
|
211 | import io | |
297 | from pygments.formatters import HtmlFormatter |
|
212 | from pygments.formatters import HtmlFormatter | |
298 | header = [] |
|
213 | header = [] | |
299 | static = os.path.join(path.get_ipython_package_dir(), |
|
214 | static = os.path.join(path.get_ipython_package_dir(), | |
300 | 'frontend', 'html', 'notebook', 'static', |
|
215 | 'frontend', 'html', 'notebook', 'static', | |
301 | ) |
|
216 | ) | |
302 | here = os.path.split(os.path.realpath(__file__))[0] |
|
217 | here = os.path.split(os.path.realpath(__file__))[0] | |
303 | css = os.path.join(static, 'css') |
|
218 | css = os.path.join(static, 'css') | |
304 | for sheet in [ |
|
219 | for sheet in [ | |
305 | # do we need jquery and prettify? |
|
220 | # do we need jquery and prettify? | |
306 | # os.path.join(static, 'jquery', 'css', 'themes', 'base', |
|
221 | # os.path.join(static, 'jquery', 'css', 'themes', 'base', | |
307 | # 'jquery-ui.min.css'), |
|
222 | # 'jquery-ui.min.css'), | |
308 | # os.path.join(static, 'prettify', 'prettify.css'), |
|
223 | # os.path.join(static, 'prettify', 'prettify.css'), | |
309 | os.path.join(css, 'boilerplate.css'), |
|
224 | os.path.join(css, 'boilerplate.css'), | |
310 | os.path.join(css, 'fbm.css'), |
|
225 | os.path.join(css, 'fbm.css'), | |
311 | os.path.join(css, 'notebook.css'), |
|
226 | os.path.join(css, 'notebook.css'), | |
312 | os.path.join(css, 'renderedhtml.css'), |
|
227 | os.path.join(css, 'renderedhtml.css'), | |
313 | os.path.join(css, 'style.min.css'), |
|
228 | os.path.join(css, 'style.min.css'), | |
314 | # our overrides: |
|
229 | # our overrides: | |
315 | os.path.join(here, '..', 'css', 'static_html.css'), |
|
230 | os.path.join(here, '..', 'css', 'static_html.css'), | |
316 | ]: |
|
231 | ]: | |
317 | try: |
|
232 | try: | |
318 | with io.open(sheet, encoding='utf-8') as f: |
|
233 | with io.open(sheet, encoding='utf-8') as f: | |
319 | s = f.read() |
|
234 | s = f.read() | |
320 | header.append(s) |
|
235 | header.append(s) | |
321 | except IOError: |
|
236 | except IOError: | |
322 | # new version of ipython with style.min.css, pass |
|
237 | # new version of ipython with style.min.css, pass | |
323 | pass |
|
238 | pass | |
324 |
|
239 | |||
325 | pygments_css = HtmlFormatter().get_style_defs('.highlight') |
|
240 | pygments_css = HtmlFormatter().get_style_defs('.highlight') | |
326 | header.append(pygments_css) |
|
241 | header.append(pygments_css) | |
327 | self.header = header |
|
242 | self.header = header | |
328 |
|
243 |
@@ -1,150 +1,134 b'' | |||||
1 |
{%- extends ' |
|
1 | {%- extends 'slides.tpl' -%} | |
2 |
|
2 | |||
3 |
|
3 | |||
4 |
{% block |
|
4 | {% block header %} | |
5 |
|
5 | <!DOCTYPE html> | ||
6 | {% if cell.metadata.slideshow.close_fragment %} |
|
|||
7 | </div> |
|
|||
8 | {% endif %} |
|
|||
9 | {% if cell.metadata.slideshow.close_subsection %} |
|
|||
10 | </section> |
|
|||
11 | {% endif %} |
|
|||
12 | {% if cell.metadata.slideshow.close_section %} |
|
|||
13 | </section> |
|
|||
14 | {% endif %} |
|
|||
15 |
|
||||
16 | {% if cell.metadata.slideshow.open_section %} |
|
|||
17 | <section> |
|
|||
18 | {%- endif %} |
|
|||
19 | {% if cell.metadata.slideshow.open_subsection %} |
|
|||
20 | <section> |
|
|||
21 | {%- endif %} |
|
|||
22 | {% if cell.metadata.slideshow.open_fragment %} |
|
|||
23 | <div class='fragment'> |
|
|||
24 | {% endif %} |
|
|||
25 | {% if cell.metadata.slideshow.slide_type in ['notes'] %} |
|
|||
26 | <aside class="notes"> |
|
|||
27 | {{ super() }} |
|
|||
28 | </aside> |
|
|||
29 | {% elif cell.metadata.slideshow.slide_type not in ['skip'] %} |
|
|||
30 | {{ super() }} |
|
|||
31 | {% endif %} |
|
|||
32 |
|
||||
33 | {% endblock %} |
|
|||
34 |
|
||||
35 |
|
||||
36 | {% block body %} |
|
|||
37 | <body> |
|
|||
38 | <div class="reveal"><div class="slides"> |
|
|||
39 | {{ super() }} |
|
|||
40 | </section> |
|
|||
41 | </section> |
|
|||
42 | </div></div> |
|
|||
43 |
|
||||
44 | <script src="reveal/lib/js/head.min.js"></script> |
|
|||
45 |
|
||||
46 | <script src="reveal/js/reveal.min.js"></script> |
|
|||
47 |
|
||||
48 | <script> |
|
|||
49 |
|
||||
50 | // Full list of configuration options available here: https://github.com/hakimel/reveal.js#configuration |
|
|||
51 | Reveal.initialize({ |
|
|||
52 | controls: true, |
|
|||
53 | progress: true, |
|
|||
54 | history: true, |
|
|||
55 |
|
||||
56 | theme: Reveal.getQueryHash().theme, // available themes are in /css/theme |
|
|||
57 | transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/concave/zoom/linear/none |
|
|||
58 |
|
||||
59 | // Optional libraries used to extend on reveal.js |
|
|||
60 | dependencies: [ |
|
|||
61 | { src: 'reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } }, |
|
|||
62 | { src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, |
|
|||
63 | { src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, |
|
|||
64 | { src: 'notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }, |
|
|||
65 | { src: 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML', async: true }, |
|
|||
66 | { src: 'js/revealmathjax.js', async: true} |
|
|||
67 | ] |
|
|||
68 | }); |
|
|||
69 | </script> |
|
|||
70 |
|
||||
71 | <script> |
|
|||
72 | Reveal.addEventListener( 'slidechanged', function( event ) { |
|
|||
73 | MathJax.Hub.Rerender(event.currentSlide); |
|
|||
74 | }); |
|
|||
75 | </script> |
|
|||
76 | </body> |
|
|||
77 | </html>{% endblock body %} |
|
|||
78 |
|
||||
79 |
|
||||
80 |
|
||||
81 |
|
||||
82 | {% block header %}<!DOCTYPE html> |
|
|||
83 | <html> |
|
6 | <html> | |
84 | <head> |
|
7 | <head> | |
85 |
|
8 | |||
86 | <meta charset="utf-8" /> |
|
9 | <meta charset="utf-8" /> | |
87 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> |
|
10 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
88 |
|
11 | |||
89 | <meta name="apple-mobile-web-app-capable" content="yes" /> |
|
12 | <meta name="apple-mobile-web-app-capable" content="yes" /> | |
90 | <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> |
|
13 | <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> | |
91 |
|
14 | |||
92 | <link rel="stylesheet" href="reveal/css/reveal.css"> |
|
15 | <link rel="stylesheet" href="reveal/css/reveal.css"> | |
93 | <link rel="stylesheet" href="reveal/css/theme/simple.css" id="theme"> |
|
16 | <link rel="stylesheet" href="reveal/css/theme/simple.css" id="theme"> | |
94 |
|
17 | |||
95 | <!-- For syntax highlighting --> |
|
18 | <!-- For syntax highlighting --> | |
96 | <link rel="stylesheet" href="reveal/lib/css/zenburn.css"> |
|
19 | <link rel="stylesheet" href="reveal/lib/css/zenburn.css"> | |
97 |
|
20 | |||
98 | <!-- If the query includes 'print-pdf', use the PDF print sheet --> |
|
21 | <!-- If the query includes 'print-pdf', use the PDF print sheet --> | |
99 | <script> |
|
22 | <script> | |
100 | document.write( '<link rel="stylesheet" href="reveal/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' ); |
|
23 | document.write( '<link rel="stylesheet" href="reveal/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' ); | |
101 | </script> |
|
24 | </script> | |
102 |
|
25 | |||
103 | <!--[if lt IE 9]> |
|
26 | <!--[if lt IE 9]> | |
104 | <script src="reveal/lib/js/html5shiv.js"></script> |
|
27 | <script src="reveal/lib/js/html5shiv.js"></script> | |
105 | <![endif]--> |
|
28 | <![endif]--> | |
106 |
|
29 | |||
107 | {% for css in resources.inlining.css -%} |
|
30 | {% for css in resources.inlining.css -%} | |
108 | <style type="text/css"> |
|
31 | <style type="text/css"> | |
109 | {{css}} |
|
32 | {{css}} | |
110 | </style> |
|
33 | </style> | |
111 | {% endfor %} |
|
34 | {% endfor %} | |
112 |
|
35 | |||
113 | <style type="text/css"> |
|
36 | <style type="text/css"> | |
114 | /* Overrides of notebook CSS for static HTML export */ |
|
37 | /* Overrides of notebook CSS for static HTML export */ | |
115 |
|
38 | |||
116 | .reveal { |
|
39 | .reveal { | |
117 | font-size: 20px; |
|
40 | font-size: 20px; | |
118 | } |
|
41 | } | |
119 | .reveal pre { |
|
42 | .reveal pre { | |
120 | width: 100%; |
|
43 | width: 100%; | |
121 | padding: 0.2em; |
|
44 | padding: 0.2em; | |
122 | margin: 0px auto; |
|
45 | margin: 0px auto; | |
123 | font-family: monospace, sans-serif; |
|
46 | font-family: monospace, sans-serif; | |
124 | font-size: 60%; |
|
47 | font-size: 60%; | |
125 | box-shadow: 0px 0px 0px rgba(0, 0, 0, 0); |
|
48 | box-shadow: 0px 0px 0px rgba(0, 0, 0, 0); | |
126 | } |
|
49 | } | |
127 | .reveal section img { |
|
50 | .reveal section img { | |
128 | border: 0px solid black; |
|
51 | border: 0px solid black; | |
129 | box-shadow: 0 0 10px rgba(0, 0, 0, 0); |
|
52 | box-shadow: 0 0 10px rgba(0, 0, 0, 0); | |
130 | } |
|
53 | } | |
131 | div.input_area { |
|
54 | div.input_area { | |
132 | padding: 0.2em; |
|
55 | padding: 0.2em; | |
133 | } |
|
56 | } | |
134 | div.code_cell { |
|
57 | div.code_cell { | |
135 | background-color: transparent; |
|
58 | background-color: transparent; | |
136 | } |
|
59 | } | |
137 | div.prompt { |
|
60 | div.prompt { | |
138 | width: 11ex; |
|
61 | width: 11ex; | |
139 | padding: 0.0em; |
|
62 | padding: 0.0em; | |
140 | margin: 0px; |
|
63 | margin: 0px; | |
141 | font-family: monospace; |
|
64 | font-family: monospace; | |
142 | font-size: 60%; |
|
65 | font-size: 60%; | |
143 | text-align: center; |
|
66 | text-align: center; | |
144 | } |
|
67 | } | |
145 | div.output_prompt { |
|
68 | div.output_prompt { | |
146 | /* 5px right shift to account for margin in parent container */ |
|
69 | /* 5px right shift to account for margin in parent container */ | |
147 | margin: 5px 5px 0 -5px; |
|
70 | margin: 5px 5px 0 -5px; | |
148 | } |
|
71 | } | |
149 | </style> |
|
72 | </style> | |
150 | </head>{% endblock %} |
|
73 | </head> | |
|
74 | {% endblock header%} | |||
|
75 | ||||
|
76 | ||||
|
77 | {% block body %} | |||
|
78 | <body> | |||
|
79 | <div class="reveal"><div class="slides"> | |||
|
80 | ||||
|
81 | {{ super() }} | |||
|
82 | ||||
|
83 | </div></div> | |||
|
84 | ||||
|
85 | <!-- Social buttons --> | |||
|
86 | <div class="addthis_toolbox addthis_floating_style addthis_32x32_style" style="left:20px;top:20px;"> | |||
|
87 | <a class="addthis_button_twitter"></a> | |||
|
88 | <a class="addthis_button_google_plusone_share"></a> | |||
|
89 | <a class="addthis_button_linkedin"></a> | |||
|
90 | <a class="addthis_button_facebook"></a> | |||
|
91 | <a class="addthis_button_more"></a> | |||
|
92 | </div> | |||
|
93 | <!-- End of social buttons --> | |||
|
94 | ||||
|
95 | <script src="reveal/lib/js/head.min.js"></script> | |||
|
96 | ||||
|
97 | <script src="reveal/js/reveal.min.js"></script> | |||
|
98 | ||||
|
99 | <script> | |||
|
100 | ||||
|
101 | // Full list of configuration options available here: https://github.com/hakimel/reveal.js#configuration | |||
|
102 | Reveal.initialize({ | |||
|
103 | controls: true, | |||
|
104 | progress: true, | |||
|
105 | history: true, | |||
|
106 | ||||
|
107 | theme: Reveal.getQueryHash().theme, // available themes are in /css/theme | |||
|
108 | transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/concave/zoom/linear/none | |||
|
109 | ||||
|
110 | // Optional libraries used to extend on reveal.js | |||
|
111 | dependencies: [ | |||
|
112 | { src: 'reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } }, | |||
|
113 | { src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, | |||
|
114 | { src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, | |||
|
115 | { src: 'notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }, | |||
|
116 | { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true}, | |||
|
117 | { src: 'js/revealmathjax.js', async: true}, | |||
|
118 | { src: 'js/mathjax-onload.js', async: true} | |||
|
119 | ] | |||
|
120 | }); | |||
|
121 | </script> | |||
|
122 | ||||
|
123 | <script> | |||
|
124 | Reveal.addEventListener( 'slidechanged', function( event ) { | |||
|
125 | MathJax.Hub.Rerender(event.currentSlide); | |||
|
126 | }); | |||
|
127 | </script> | |||
|
128 | ||||
|
129 | </body> | |||
|
130 | {% endblock body %} | |||
|
131 | ||||
|
132 | {% block footer %} | |||
|
133 | </html> | |||
|
134 | {% endblock footer %} No newline at end of file |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
General Comments 0
You need to be logged in to leave comments.
Login now