##// END OF EJS Templates
Make configurable the url where look for reveal.js library.
damianavila -
Show More
@@ -49,6 +49,17 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 'url_prefix':'//cdn.jsdelivr.net/reveal.js/2.4.0',
59 # If you want to use a local reveal.js library, just
60 # comment the previous line and uncomment the next one.
61 #'url_prefix':'reveal.js',
62 },
63 })
53 c.merge(super(RevealExporter,self).default_config)
64 c.merge(super(RevealExporter,self).default_config)
54 return c
65 return c
@@ -12,19 +12,18
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="//cdn.jsdelivr.net/reveal.js/2.4.0/css/reveal.css">
15 <!-- General and theme style sheets -->
16 <link rel="stylesheet" href="//cdn.jsdelivr.net/reveal.js/2.4.0/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="//cdn.jsdelivr.net/reveal.js/2.4.0/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 <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">
23 document.write( '<link rel="stylesheet" href="//cdn.jsdelivr.net/reveal.js/2.4.0/css/print' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
24 </script>
25
24
26 <!--[if lt IE 9]>
25 <!--[if lt IE 9]>
27 <script src="//cdn.jsdelivr.net/reveal.js/2.4.0/lib/js/html5shiv.js"></script>
26 <script src="{{resources.reveal.url_prefix}}/lib/js/html5shiv.js"></script>
28 <![endif]-->
27 <![endif]-->
29
28
30 {% for css in resources.inlining.css -%}
29 {% for css in resources.inlining.css -%}
@@ -96,7 +95,7 text-align: inherit;
96
95
97 </div></div>
96 </div></div>
98
97
99 <!--
98 <!--
100 Uncomment the following block and the addthis_widget.js (see below inside dependencies)
99 Uncomment the following block and the addthis_widget.js (see below inside dependencies)
101 to get enable social buttons.
100 to get enable social buttons.
102 -->
101 -->
@@ -111,9 +110,9 to get enable social buttons.
111 </div>
110 </div>
112 -->
111 -->
113
112
114 <script src="//cdn.jsdelivr.net/reveal.js/2.4.0/lib/js/head.min.js"></script>
113 <script src="{{resources.reveal.url_prefix}}/lib/js/head.min.js"></script>
115
114
116 <script src="//cdn.jsdelivr.net/reveal.js/2.4.0/js/reveal.js"></script>
115 <script src="{{resources.reveal.url_prefix}}/js/reveal.js"></script>' );
117
116
118 <script>
117 <script>
119
118
@@ -128,9 +127,9 transition: Reveal.getQueryHash().transition || 'linear', // default/cube/page/c
128
127
129 // Optional libraries used to extend on reveal.js
128 // Optional libraries used to extend on reveal.js
130 dependencies: [
129 dependencies: [
131 { src: '//cdn.jsdelivr.net/reveal.js/2.4.0/lib/js/classList.js', condition: function() { return !document.body.classList; } },
130 { src: "{{resources.reveal.url_prefix}}/lib/js/classList.js", condition: function() { return !document.body.classList; } },
132 { src: '//cdn.jsdelivr.net/reveal.js/2.4.0/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
131 { 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; } }
132 { 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},
133 // { src: 'http://s7.addthis.com/js/300/addthis_widget.js', async: true},
135 ]
134 ]
136 });
135 });
@@ -152,7 +151,7 MathJax.Hub.Config({
152 <!-- End of mathjax configuration -->
151 <!-- End of mathjax configuration -->
153
152
154 <script>
153 <script>
155 // We wait for the onload function to load MathJax after the page is completely loaded.
154 // 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.
155 // 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).
156 // This hack prevent problems when you load multiple js files (i.e. social button from addthis).
158 //
157 //
@@ -13,13 +13,15
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14
14
15 from .base import ConfigurableTransformer
15 from .base import ConfigurableTransformer
16
16 from IPython.utils.traitlets import Bytes
17 #-----------------------------------------------------------------------------
17 #-----------------------------------------------------------------------------
18 # Classes and functions
18 # Classes and functions
19 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
20
20
21 class RevealHelpTransformer(ConfigurableTransformer):
21 class RevealHelpTransformer(ConfigurableTransformer):
22
22
23 url_prefix = Bytes("", config=True, help="url prefix to get reveal.js files")
24
23 def call(self, nb, resources):
25 def call(self, nb, resources):
24 """
26 """
25 Called once to 'transform' contents of the notebook.
27 Called once to 'transform' contents of the notebook.
@@ -47,6 +49,10 class RevealHelpTransformer(ConfigurableTransformer):
47 worksheet.cells[i - 1].metadata.slide_helper = 'slide_end'
49 worksheet.cells[i - 1].metadata.slide_helper = 'slide_end'
48 if cell.metadata.slide_type in ['subslide']:
50 if cell.metadata.slide_type in ['subslide']:
49 worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end'
51 worksheet.cells[i - 1].metadata.slide_helper = 'subslide_end'
52
53
54 resources['reveal'] = {}
55 resources['reveal']['url_prefix'] = self.url_prefix
50
56
51 return nb, resources
57 return nb, resources
52 No newline at end of file
58
General Comments 0
You need to be logged in to leave comments. Login now