Show More
@@ -24,15 +24,14 b' from IPython.utils.traitlets import Unicode, Bool' | |||||
24 |
|
24 | |||
25 | class RevealHelpPreprocessor(Preprocessor): |
|
25 | class RevealHelpPreprocessor(Preprocessor): | |
26 |
|
26 | |||
27 | url_prefix = Unicode('//cdn.jsdelivr.net/reveal.js/2.4.0', |
|
27 | url_prefix = Unicode('https://cdn.jsdelivr.net/reveal.js/2.4.0', config=True, | |
28 | config=True, |
|
28 | help="""The URL prefix for reveal.js. | |
29 |
|
|
29 | This can be a a relative URL for a local copy of reveal.js, | |
30 | use 'url_prefix':'reveal.js' in your config object.""") |
|
30 | or point to a CDN. | |
31 |
|
31 | |||
32 | speaker_notes = Bool(False, |
|
32 | For speaker notes to work, a local reveal.js must be used. | |
33 |
|
|
33 | """ | |
34 | help="""If you want to use the speaker notes |
|
34 | ) | |
35 | set this to True.""") |
|
|||
36 |
|
35 | |||
37 | def preprocess(self, nb, resources): |
|
36 | def preprocess(self, nb, resources): | |
38 | """ |
|
37 | """ | |
@@ -65,30 +64,4 b' class RevealHelpPreprocessor(Preprocessor):' | |||||
65 | if not isinstance(resources['reveal'], dict): |
|
64 | if not isinstance(resources['reveal'], dict): | |
66 | resources['reveal'] = {} |
|
65 | resources['reveal'] = {} | |
67 | resources['reveal']['url_prefix'] = self.url_prefix |
|
66 | resources['reveal']['url_prefix'] = self.url_prefix | |
68 | resources['reveal']['notes_prefix'] = self.url_prefix |
|
|||
69 |
|
||||
70 | cdn = 'http://cdn.jsdelivr.net/reveal.js/2.4.0' |
|
|||
71 | local = 'local' |
|
|||
72 | html_path = 'plugin/notes/notes.html' |
|
|||
73 | js_path = 'plugin/notes/notes.js' |
|
|||
74 |
|
||||
75 | html_infile = os.path.join(cdn, html_path) |
|
|||
76 | js_infile = os.path.join(cdn, js_path) |
|
|||
77 | html_outfile = os.path.join(local, html_path) |
|
|||
78 | js_outfile = os.path.join(local, js_path) |
|
|||
79 |
|
||||
80 | if self.speaker_notes: |
|
|||
81 | if 'outputs' not in resources: |
|
|||
82 | resources['outputs'] = {} |
|
|||
83 | resources['outputs'][html_outfile] = self.notes_helper(html_infile) |
|
|||
84 | resources['outputs'][js_outfile] = self.notes_helper(js_infile) |
|
|||
85 | resources['reveal']['notes_prefix'] = local |
|
|||
86 |
|
||||
87 | return nb, resources |
|
67 | return nb, resources | |
88 |
|
||||
89 | def notes_helper(self, infile): |
|
|||
90 | """Helper function to get the content from an url.""" |
|
|||
91 |
|
||||
92 | content = urllib2.urlopen(infile).read() |
|
|||
93 |
|
||||
94 | return content |
|
@@ -135,7 +135,7 b" transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/c" | |||||
135 | dependencies: [ |
|
135 | dependencies: [ | |
136 | { src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } }, |
|
136 | { src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } }, | |
137 | { src: "{{resources.reveal.url_prefix}}/plugin/highlight/highlight.js", async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, |
|
137 | { src: "{{resources.reveal.url_prefix}}/plugin/highlight/highlight.js", async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, | |
138 |
{ src: "{{resources.reveal. |
|
138 | { src: "{{resources.reveal.url_prefix}}/plugin/notes/notes.js", async: true, condition: function() { return !!document.body.classList; } } | |
139 | // { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true}, |
|
139 | // { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true}, | |
140 | ] |
|
140 | ] | |
141 | }); |
|
141 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now