##// END OF EJS Templates
Merge pull request #3533 from damianavila/reveal_cdn...
Min RK -
r11196:719de27e merge
parent child Browse files
Show More
@@ -49,6 +49,13 b' class RevealExporter(BasicHTMLExporter):'
49
49
50 @property
50 @property
51 def default_config(self):
51 def default_config(self):
52 c = Config({'CSSHTMLHeaderTransformer':{'enabled':True}})
52 c = Config({
53 'CSSHTMLHeaderTransformer':{
54 'enabled':True
55 },
56 'RevealHelpTransformer':{
57 'enabled':True,
58 },
59 })
53 c.merge(super(RevealExporter,self).default_config)
60 c.merge(super(RevealExporter,self).default_config)
54 return c
61 return c
@@ -12,19 +12,20 b''
12 <meta name="apple-mobile-web-app-capable" content="yes" />
12 <meta name="apple-mobile-web-app-capable" content="yes" />
13 <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" />
14
14
15 <link rel="stylesheet" href="reveal.js/css/reveal.css">
15 <!-- General and theme style sheets -->
16 <link rel="stylesheet" href="reveal.js/css/theme/simple.css" id="theme">
16 <link rel="stylesheet" href="{{resources.reveal.url_prefix}}/css/reveal.css">
17 <link rel="stylesheet" href="{{resources.reveal.url_prefix}}/css/theme/simple.css" id="theme">
17
18
18 <!-- For syntax highlighting -->
19 <!-- For syntax highlighting -->
19 <link rel="stylesheet" href="reveal.js/lib/css/zenburn.css">
20 <link rel="stylesheet" href="{{resources.reveal.url_prefix}}/lib/css/zenburn.css">
20
21
21 <!-- If the query includes 'print-pdf', use the PDF print sheet -->
22 <!-- If the query includes 'print-pdf', use the PDF print sheet -->
22 <script>
23 <script>
23 document.write( '<link rel="stylesheet" href="reveal.js/css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
24 document.write( '<link rel="stylesheet" href="{{resources.reveal.url_prefix}}/css/print' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
24 </script>
25 </script>
25
26
26 <!--[if lt IE 9]>
27 <!--[if lt IE 9]>
27 <script src="reveal.js/lib/js/html5shiv.js"></script>
28 <script src="{{resources.reveal.url_prefix}}/lib/js/html5shiv.js"></script>
28 <![endif]-->
29 <![endif]-->
29
30
30 {% for css in resources.inlining.css -%}
31 {% for css in resources.inlining.css -%}
@@ -96,7 +97,7 b' text-align: inherit;'
96
97
97 </div></div>
98 </div></div>
98
99
99 <!--
100 <!--
100 Uncomment the following block and the addthis_widget.js (see below inside dependencies)
101 Uncomment the following block and the addthis_widget.js (see below inside dependencies)
101 to get enable social buttons.
102 to get enable social buttons.
102 -->
103 -->
@@ -111,9 +112,9 b' to get enable social buttons.'
111 </div>
112 </div>
112 -->
113 -->
113
114
114 <script src="reveal.js/lib/js/head.min.js"></script>
115 <script src="{{resources.reveal.url_prefix}}/lib/js/head.min.js"></script>
115
116
116 <script src="reveal.js/js/reveal.min.js"></script>
117 <script src="{{resources.reveal.url_prefix}}/js/reveal.js"></script>
117
118
118 <script>
119 <script>
119
120
@@ -128,9 +129,9 b" transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/c"
128
129
129 // Optional libraries used to extend on reveal.js
130 // Optional libraries used to extend on reveal.js
130 dependencies: [
131 dependencies: [
131 { src: 'reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
132 { src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } },
132 { src: 'reveal.js/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
133 { src: "{{resources.reveal.url_prefix}}/plugin/highlight/highlight.js", async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
133 { src: 'reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }
134 { src: "{{resources.reveal.url_prefix}}/plugin/notes/notes.js", async: true, condition: function() { return !!document.body.classList; } }
134 // { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true},
135 // { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true},
135 ]
136 ]
136 });
137 });
@@ -152,7 +153,7 b' MathJax.Hub.Config({'
152 <!-- End of mathjax configuration -->
153 <!-- End of mathjax configuration -->
153
154
154 <script>
155 <script>
155 // We wait for the onload function to load MathJax after the page is completely loaded.
156 // We wait for the onload function to load MathJax after the page is completely loaded.
156 // MathJax is loaded 1 unit of time after the page is ready.
157 // MathJax is loaded 1 unit of time after the page is ready.
157 // This hack prevent problems when you load multiple js files (i.e. social button from addthis).
158 // This hack prevent problems when you load multiple js files (i.e. social button from addthis).
158 //
159 //
@@ -13,6 +13,7 b''
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from .base import ConfigurableTransformer
15 from .base import ConfigurableTransformer
16 from IPython.utils.traitlets import Unicode
16
17
17 #-----------------------------------------------------------------------------
18 #-----------------------------------------------------------------------------
18 # Classes and functions
19 # Classes and functions
@@ -20,10 +21,15 b' from .base import ConfigurableTransformer'
20
21
21 class RevealHelpTransformer(ConfigurableTransformer):
22 class RevealHelpTransformer(ConfigurableTransformer):
22
23
24 url_prefix = Unicode('//cdn.jsdelivr.net/reveal.js/2.4.0',
25 config=True,
26 help="""If you want to use a local reveal.js library,
27 use 'url_prefix':'reveal.js' in your config object.""")
28
23 def call(self, nb, resources):
29 def call(self, nb, resources):
24 """
30 """
25 Called once to 'transform' contents of the notebook.
31 Called once to 'transform' contents of the notebook.
26
32
27 Parameters
33 Parameters
28 ----------
34 ----------
29 nb : NotebookNode
35 nb : NotebookNode
@@ -32,8 +38,8 b' class RevealHelpTransformer(ConfigurableTransformer):'
32 Additional resources used in the conversion process. Allows
38 Additional resources used in the conversion process. Allows
33 transformers to pass variables into the Jinja engine.
39 transformers to pass variables into the Jinja engine.
34 """
40 """
35
41
36
42
37 for worksheet in nb.worksheets :
43 for worksheet in nb.worksheets :
38 for i, cell in enumerate(worksheet.cells):
44 for i, cell in enumerate(worksheet.cells):
39
45
@@ -47,6 +53,10 b' class RevealHelpTransformer(ConfigurableTransformer):'
47 worksheet.cells[i - 1].metadata.slide_helper = 'slide_end'
53 worksheet.cells[i - 1].metadata.slide_helper = 'slide_end'
48 if cell.metadata.slide_type in ['subslide']:
54 if cell.metadata.slide_type in ['subslide']:
49 worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end'
55 worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end'
50
56
57
58 if 'reveal' not in resources:
59 resources['reveal'] = {}
60 resources['reveal']['url_prefix'] = self.url_prefix
61
51 return nb, resources
62 return nb, resources
52 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now