##// END OF EJS Templates
Merge pull request #3863 from damianavila/speaker_notes...
Matthias Bussonnier -
r12197:4565b731 merge
parent child Browse files
Show More
@@ -61,7 +61,9 b' nbconvert_aliases.update({'
61 61 'template' : 'Exporter.template_file',
62 62 'writer' : 'NbConvertApp.writer_class',
63 63 'post': 'NbConvertApp.post_processor_class',
64 'output': 'NbConvertApp.output_base'
64 'output': 'NbConvertApp.output_base',
65 'offline-slides': 'RevealHelpTransformer.url_prefix',
66 'slide-notes': 'RevealHelpTransformer.speaker_notes'
65 67 })
66 68
67 69 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
@@ -26,6 +29,11 b' class RevealHelpTransformer(Transformer):'
26 29 help="""If you want to use a local reveal.js library,
27 30 use 'url_prefix':'reveal.js' in your config object.""")
28 31
32 speaker_notes = Bool(False,
33 config=True,
34 help="""If you want to use the speaker notes
35 set this to True.""")
36
29 37 def call(self, nb, resources):
30 38 """
31 39 Called once to 'transform' contents of the notebook.
@@ -57,5 +65,30 b' class RevealHelpTransformer(Transformer):'
57 65 if not isinstance(resources['reveal'], dict):
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,12 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 ``--slide-notes=True`` on the command-line.
68 For low connectivity environments, you can use a local copy of the reveal.js library,
69 just add ``--offline-slides=reveal.js`` on the command-line, and do not forget to move
70 your downloaded ``reveal.js`` library to the same folder where your slides are located.
71
67 72 * ``--to markdown``
68 73
69 74 Simple markdown output. Markdown cells are unaffected,
General Comments 0
You need to be logged in to leave comments. Login now