##// END OF EJS Templates
Added working speaker notes for slides.
damianavila -
Show More
@@ -62,7 +62,9 b' nbconvert_aliases.update({'
62 62 'notebooks' : 'NbConvertApp.notebooks',
63 63 'writer' : 'NbConvertApp.writer_class',
64 64 'post': 'NbConvertApp.post_processor_class',
65 'output': 'NbConvertApp.output_base'
65 'output': 'NbConvertApp.output_base',
66 'local': 'RevealHelpTransformer.url_prefix',
67 'notes': 'RevealHelpTransformer.speaker_notes'
66 68 })
67 69
68 70 nbconvert_flags = {}
@@ -135,7 +135,7 b" transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/c"
135 135 dependencies: [
136 136 { src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } },
137 137 { src: "{{resources.reveal.url_prefix}}/plugin/highlight/highlight.js", async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
138 { src: "{{resources.reveal.url_prefix}}/plugin/notes/notes.js", async: true, condition: function() { return !!document.body.classList; } }
138 { src: "{{resources.reveal.notes_prefix}}/plugin/notes/notes.js", async: true, condition: function() { return !!document.body.classList; } }
139 139 // { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true},
140 140 ]
141 141 });
@@ -12,8 +12,11 b''
12 12 # Imports
13 13 #-----------------------------------------------------------------------------
14 14
15 import os
16 import urllib2
17
15 18 from .base import Transformer
16 from IPython.utils.traitlets import Unicode
19 from IPython.utils.traitlets import Unicode, Bool
17 20
18 21 #-----------------------------------------------------------------------------
19 22 # Classes and functions
@@ -24,7 +27,12 b' class RevealHelpTransformer(Transformer):'
24 27 url_prefix = Unicode('//cdn.jsdelivr.net/reveal.js/2.4.0',
25 28 config=True,
26 29 help="""If you want to use a local reveal.js library,
27 use 'url_prefix':'reveal.js' in your config object.""")
30 use 'url_prefix':'reveal.js' in your config object or
31 --local reveal.js in command line.""")
32
33 speaker_notes = Bool(False, config=True, help="""
34 If you want to use the speaker notes set speaker_notes:True
35 in your config object or --notes True in command line.""")
28 36
29 37 def call(self, nb, resources):
30 38 """
@@ -57,5 +65,30 b' class RevealHelpTransformer(Transformer):'
57 65 if 'reveal' not in resources:
58 66 resources['reveal'] = {}
59 67 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
60 86
61 87 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
@@ -63,7 +63,11 b' The currently supported export formats are:'
63 63 This generates a Reveal.js HTML slideshow.
64 64 It must be served by an HTTP server. The easiest way to get this is to add
65 65 ``--post serve`` on the command-line.
66
66 If you want to use the speaker notes plugin, just add
67 ``--notes True`` on the command-line.
68 For low connectivity environments, you can use a local copy of the reveal.js library, just add
69 ``--local reveal.js`` on the command-line, and do not forget to move your downloaded ``reveal.js`` library to the same folder where your slides are located.
70
67 71 * ``--to markdown``
68 72
69 73 Simple markdown output. Markdown cells are unaffected,
General Comments 0
You need to be logged in to leave comments. Login now