Show More
@@ -180,6 +180,16 b' class ConverterReveal(ConverterHTML):' | |||||
180 | slide[i] = right + left |
|
180 | slide[i] = right + left | |
181 | return list(itertools.chain(*slides)) |
|
181 | return list(itertools.chain(*slides)) | |
182 |
|
182 | |||
|
183 | def render(self): | |||
|
184 | "read, convert, and save self.infile" | |||
|
185 | self.notes = self.template_notes() | |||
|
186 | self.notesjs = self.template_notesjs() | |||
|
187 | if not hasattr(self, 'nb'): | |||
|
188 | self.read() | |||
|
189 | self.output = self.convert() | |||
|
190 | assert(type(self.output) == unicode) | |||
|
191 | return self.save() | |||
|
192 | ||||
183 | def save(self, outfile=None, encoding=None): |
|
193 | def save(self, outfile=None, encoding=None): | |
184 | "read and parse notebook into self.nb" |
|
194 | "read and parse notebook into self.nb" | |
185 | if outfile is None: |
|
195 | if outfile is None: | |
@@ -218,11 +228,11 b' class ConverterReveal(ConverterHTML):' | |||||
218 | dict(type='"text/css"'))) |
|
228 | dict(type='"text/css"'))) | |
219 | return header |
|
229 | return header | |
220 |
|
230 | |||
221 | def template_read(self): |
|
231 | def template_read(self, templ): | |
222 | "read the reveal_template.html" |
|
232 | "read the reveal_template.html" | |
223 | here = os.path.split(os.path.realpath(__file__))[0] |
|
233 | here = os.path.split(os.path.realpath(__file__))[0] | |
224 | reveal_template = os.path.join(here, '..', 'templates', |
|
234 | reveal_template = os.path.join(here, '..', 'templates', | |
225 |
|
|
235 | templ) | |
226 | with io.open(reveal_template, 'r', encoding='utf-8') as f: |
|
236 | with io.open(reveal_template, 'r', encoding='utf-8') as f: | |
227 | template = f.readlines() |
|
237 | template = f.readlines() | |
228 | template = [s.strip() for s in template] |
|
238 | template = [s.strip() for s in template] | |
@@ -230,11 +240,35 b' class ConverterReveal(ConverterHTML):' | |||||
230 |
|
240 | |||
231 | def template_split(self): |
|
241 | def template_split(self): | |
232 | "split the reveal_template.html in header and footer lists" |
|
242 | "split the reveal_template.html in header and footer lists" | |
233 | temp = self.template_read() |
|
243 | temp = self.template_read('reveal_base.html') | |
234 | splitted_temp = [list(x[1]) for x in itertools.groupby(temp, |
|
244 | splitted_temp = [list(x[1]) for x in itertools.groupby(temp, | |
235 | lambda x: x == u'%slides%') if not x[0]] |
|
245 | lambda x: x == u'%slides%') if not x[0]] | |
236 | return splitted_temp |
|
246 | return splitted_temp | |
237 |
|
247 | |||
|
248 | def template_notesjs(self): | |||
|
249 | #"split the reveal_template.html in header and footer lists" | |||
|
250 | temp = self.template_read('notes_base.js') | |||
|
251 | for i, j in enumerate(temp): | |||
|
252 | if j == u'%source%': | |||
|
253 | temp[i] = '\'' + self.outbase + '_notes.html\'' | |||
|
254 | here = os.path.split(os.path.realpath(__file__))[0] | |||
|
255 | path_js = os.path.join(here, '..', 'js', self.outbase + '_notes.js') | |||
|
256 | with io.open(path_js, 'w', | |||
|
257 | encoding=self.default_encoding) as f: | |||
|
258 | f.write('\n'.join(temp)) | |||
|
259 | return [] | |||
|
260 | ||||
|
261 | def template_notes(self): | |||
|
262 | #"split the reveal_template.html in header and footer lists" | |||
|
263 | temp = self.template_read('notes_base.html') | |||
|
264 | for i, j in enumerate(temp): | |||
|
265 | if j == u'%source%': | |||
|
266 | temp[i] = 'src=\"' + self.outbase + '_slides.html\"' | |||
|
267 | with io.open(self.outbase + '_notes.html', 'w', | |||
|
268 | encoding=self.default_encoding) as f: | |||
|
269 | f.write('\n'.join(temp)) | |||
|
270 | return [] | |||
|
271 | ||||
238 | def optional_header(self): |
|
272 | def optional_header(self): | |
239 | optional_header_body = self.template_split() |
|
273 | optional_header_body = self.template_split() | |
240 | return ['<!DOCTYPE html>', '<html>', '<head>'] + \ |
|
274 | return ['<!DOCTYPE html>', '<html>', '<head>'] + \ | |
@@ -243,4 +277,8 b' class ConverterReveal(ConverterHTML):' | |||||
243 |
|
277 | |||
244 | def optional_footer(self): |
|
278 | def optional_footer(self): | |
245 | optional_footer_body = self.template_split() |
|
279 | optional_footer_body = self.template_split() | |
|
280 | for i, j in enumerate(optional_footer_body[1]): | |||
|
281 | if j == u'%source%': | |||
|
282 | optional_footer_body[1][i] = \ | |||
|
283 | 'src: \'js/' + self.outbase + '_notes.js\'' | |||
246 | return optional_footer_body[1] + ['</body>', '</html>'] No newline at end of file |
|
284 | return optional_footer_body[1] + ['</body>', '</html>'] |
@@ -89,11 +89,17 b'' | |||||
89 | <body> |
|
89 | <body> | |
90 |
|
90 | |||
91 | <div id="wrap-current-slide" class="slides"> |
|
91 | <div id="wrap-current-slide" class="slides"> | |
92 | <iframe src="../example_nb_tour_slides.html" width="1280" height="1024" id="current-slide"></iframe> |
|
92 | <iframe | |
|
93 | %source% | |||
|
94 | width="1280" height="1024" id="current-slide"> | |||
|
95 | </iframe> | |||
93 | </div> |
|
96 | </div> | |
94 |
|
97 | |||
95 | <div id="wrap-next-slide" class="slides"> |
|
98 | <div id="wrap-next-slide" class="slides"> | |
96 | <iframe src="../example_nb_tour_slides.html" width="640" height="512" id="next-slide"></iframe> |
|
99 | <iframe | |
|
100 | %source% | |||
|
101 | width="640" height="512" id="next-slide"> | |||
|
102 | </iframe> | |||
97 | <span>UPCOMING:</span> |
|
103 | <span>UPCOMING:</span> | |
98 | </div> |
|
104 | </div> | |
99 | <div id="notes"></div> |
|
105 | <div id="notes"></div> |
@@ -5,7 +5,9 b'' | |||||
5 | var RevealNotes = (function() { |
|
5 | var RevealNotes = (function() { | |
6 |
|
6 | |||
7 | function openNotes() { |
|
7 | function openNotes() { | |
8 | var notesPopup = window.open( 'templates/notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); |
|
8 | var notesPopup = window.open( | |
|
9 | %source% | |||
|
10 | , 'reveal.js - Notes', 'width=1120,height=850' ); | |||
9 |
|
11 | |||
10 | // Fires when slide is changed |
|
12 | // Fires when slide is changed | |
11 | Reveal.addEventListener( 'slidechanged', function( event ) { |
|
13 | Reveal.addEventListener( 'slidechanged', function( event ) { |
@@ -42,7 +42,9 b'' | |||||
42 | { src: 'reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } }, |
|
42 | { src: 'reveal/lib/js/classList.js', condition: function() { return !document.body.classList; } }, | |
43 | { src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, |
|
43 | { src: 'reveal/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, | |
44 | { src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, |
|
44 | { src: 'reveal/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }, | |
45 | { src: 'js/notes.js', async: true, condition: function() { return !!document.body.classList; } }, |
|
45 | { | |
|
46 | %source% | |||
|
47 | , async: true, condition: function() { return !!document.body.classList; } }, | |||
46 | { src: 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML', async: true }, |
|
48 | { src: 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML', async: true }, | |
47 | { src: 'js/revealmathjax.js', async: true} |
|
49 | { src: 'js/revealmathjax.js', async: true} | |
48 | ] |
|
50 | ] |
General Comments 0
You need to be logged in to leave comments.
Login now