reveal-ck 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +24 -129
  3. data/bin/reveal-ck +3 -2
  4. data/lib/reveal-ck.rb +1 -1
  5. data/lib/reveal-ck/presentation_builder.rb +5 -5
  6. data/lib/reveal-ck/template_processor.rb +29 -0
  7. data/lib/reveal-ck/version.rb +1 -1
  8. data/reveal.js/Gruntfile.js +6 -2
  9. data/reveal.js/README.md +139 -31
  10. data/reveal.js/css/print/paper.css +1 -1
  11. data/reveal.js/css/print/pdf.css +1 -1
  12. data/reveal.js/css/reveal.css +134 -88
  13. data/reveal.js/css/reveal.min.css +1 -1
  14. data/reveal.js/css/theme/template/settings.scss +1 -0
  15. data/reveal.js/css/theme/template/theme.scss +1 -1
  16. data/reveal.js/index.html +7 -6
  17. data/reveal.js/js/reveal.js +496 -299
  18. data/reveal.js/js/reveal.min.js +2 -2
  19. data/reveal.js/lib/css/zenburn.css +16 -17
  20. data/reveal.js/package.json +10 -9
  21. data/reveal.js/plugin/leap/leap.js +157 -0
  22. data/reveal.js/plugin/markdown/example.html +3 -2
  23. data/reveal.js/plugin/markdown/example.md +2 -0
  24. data/reveal.js/plugin/markdown/markdown.js +273 -143
  25. data/reveal.js/plugin/math/math.js +64 -0
  26. data/reveal.js/plugin/notes/notes.html +27 -17
  27. data/reveal.js/plugin/notes/notes.js +25 -47
  28. data/reveal.js/{examples → test/examples}/assets/image1.png +0 -0
  29. data/reveal.js/{examples → test/examples}/assets/image2.png +0 -0
  30. data/reveal.js/{examples → test/examples}/barebones.html +3 -3
  31. data/reveal.js/{examples → test/examples}/embedded-media.html +4 -4
  32. data/reveal.js/test/examples/math.html +185 -0
  33. data/reveal.js/{examples → test/examples}/slide-backgrounds.html +4 -4
  34. data/reveal.js/test/qunit-1.12.0.css +244 -0
  35. data/reveal.js/test/qunit-1.12.0.js +2212 -0
  36. data/reveal.js/test/test-markdown.html +52 -0
  37. data/reveal.js/test/test-markdown.js +15 -0
  38. data/reveal.js/test/test.html +62 -0
  39. data/reveal.js/test/test.js +353 -0
  40. data/spec/data/haml/basic.haml +2 -2
  41. data/spec/data/html/converted_basic_slim.html +10 -0
  42. data/spec/data/slim/basic.slim +5 -0
  43. data/spec/lib/reveal-ck/template_processor_spec.rb +29 -0
  44. metadata +50 -9
  45. data/lib/reveal-ck/haml_processor.rb +0 -26
  46. data/spec/lib/reveal-ck/haml_processor_spec.rb +0 -40
@@ -0,0 +1,64 @@
1
+ /**
2
+ * A plugin which enables rendering of math equations inside
3
+ * of reveal.js slides. Essentially a thin wrapper for MathJax.
4
+ *
5
+ * @author Hakim El Hattab
6
+ */
7
+ var RevealMath = window.RevealMath || (function(){
8
+
9
+ var options = Reveal.getConfig().math || {};
10
+ options.mathjax = options.mathjax || 'http://cdn.mathjax.org/mathjax/latest/MathJax.js';
11
+ options.config = options.config || 'TeX-AMS_HTML-full';
12
+
13
+ loadScript( options.mathjax + '?config=' + options.config, function() {
14
+
15
+ MathJax.Hub.Config({
16
+ messageStyle: 'none',
17
+ tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] },
18
+ skipStartupTypeset: true
19
+ });
20
+
21
+ // Typeset followed by an immediate reveal.js layout since
22
+ // the typesetting process could affect slide height
23
+ MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub ] );
24
+ MathJax.Hub.Queue( Reveal.layout );
25
+
26
+ // Reprocess equations in slides when they turn visible
27
+ Reveal.addEventListener( 'slidechanged', function( event ) {
28
+
29
+ MathJax.Hub.Queue( [ 'Typeset', MathJax.Hub, event.currentSlide ] );
30
+
31
+ } );
32
+
33
+ } );
34
+
35
+ function loadScript( url, callback ) {
36
+
37
+ var head = document.querySelector( 'head' );
38
+ var script = document.createElement( 'script' );
39
+ script.type = 'text/javascript';
40
+ script.src = url;
41
+
42
+ // Wrapper for callback to make sure it only fires once
43
+ var finish = function() {
44
+ if( typeof callback === 'function' ) {
45
+ callback.call();
46
+ callback = null;
47
+ }
48
+ }
49
+
50
+ script.onload = finish;
51
+
52
+ // IE
53
+ script.onreadystatechange = function() {
54
+ if ( this.readyState === 'loaded' ) {
55
+ finish();
56
+ }
57
+ }
58
+
59
+ // Normal browsers
60
+ head.appendChild( script );
61
+
62
+ }
63
+
64
+ })();
@@ -169,10 +169,12 @@
169
169
 
170
170
  var notes = document.getElementById( 'notes' ),
171
171
  currentSlide = document.getElementById( 'current-slide' ),
172
- nextSlide = document.getElementById( 'next-slide' );
172
+ nextSlide = document.getElementById( 'next-slide' ),
173
+ silenced = false;
173
174
 
174
175
  window.addEventListener( 'message', function( event ) {
175
176
  var data = JSON.parse( event.data );
177
+
176
178
  // No need for updating the notes in case of fragment changes
177
179
  if ( data.notes !== undefined) {
178
180
  if( data.markdown ) {
@@ -183,18 +185,13 @@
183
185
  }
184
186
  }
185
187
 
186
- // Showing and hiding fragments
187
- if( data.fragment === 'next' ) {
188
- currentSlide.contentWindow.Reveal.nextFragment();
189
- }
190
- else if( data.fragment === 'prev' ) {
191
- currentSlide.contentWindow.Reveal.prevFragment();
192
- }
193
- else {
194
- // Update the note slides
195
- currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv );
196
- nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
197
- }
188
+ silenced = true;
189
+
190
+ // Update the note slides
191
+ currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
192
+ nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
193
+
194
+ silenced = false;
198
195
 
199
196
  }, false );
200
197
 
@@ -226,12 +223,25 @@
226
223
 
227
224
  }, 1000 );
228
225
 
229
- // Navigate the main window when the notes slide changes
230
- currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', function( event ) {
226
+ // Broadcasts the state of the notes window to synchronize
227
+ // the main window
228
+ function synchronizeMainWindow() {
229
+
230
+ if( !silenced ) {
231
+ var indices = currentSlide.contentWindow.Reveal.getIndices();
232
+ window.opener.Reveal.slide( indices.h, indices.v, indices.f );
233
+ }
231
234
 
232
- window.opener.Reveal.slide( event.indexh, event.indexv );
235
+ }
236
+
237
+ // Navigate the main window when the notes slide changes
238
+ currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', synchronizeMainWindow );
239
+ currentSlide.contentWindow.Reveal.addEventListener( 'fragmentshown', synchronizeMainWindow );
240
+ currentSlide.contentWindow.Reveal.addEventListener( 'fragmenthidden', synchronizeMainWindow );
233
241
 
234
- } );
242
+ // Reconfigure the notes window to remove needless UI
243
+ currentSlide.contentWindow.Reveal.configure({ controls: false, progress: false, overview: false });
244
+ nextSlide.contentWindow.Reveal.configure({ controls: false, progress: false, overview: false });
235
245
 
236
246
  }
237
247
  else {
@@ -10,72 +10,50 @@ var RevealNotes = (function() {
10
10
  var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' );
11
11
 
12
12
  // Fires when slide is changed
13
- Reveal.addEventListener( 'slidechanged', function( event ) {
14
- post('slidechanged');
15
- } );
13
+ Reveal.addEventListener( 'slidechanged', post );
16
14
 
17
15
  // Fires when a fragment is shown
18
- Reveal.addEventListener( 'fragmentshown', function( event ) {
19
- post('fragmentshown');
20
- } );
16
+ Reveal.addEventListener( 'fragmentshown', post );
21
17
 
22
18
  // Fires when a fragment is hidden
23
- Reveal.addEventListener( 'fragmenthidden', function( event ) {
24
- post('fragmenthidden');
25
- } );
19
+ Reveal.addEventListener( 'fragmenthidden', post );
26
20
 
27
21
  /**
28
22
  * Posts the current slide data to the notes window
29
- *
30
- * @param {String} eventType Expecting 'slidechanged', 'fragmentshown'
31
- * or 'fragmenthidden' set in the events above to define the needed
32
- * slideDate.
33
23
  */
34
- function post( eventType ) {
24
+ function post() {
35
25
  var slideElement = Reveal.getCurrentSlide(),
26
+ slideIndices = Reveal.getIndices(),
36
27
  messageData;
37
28
 
38
- if( eventType === 'slidechanged' ) {
39
- var notes = slideElement.querySelector( 'aside.notes' ),
40
- indexh = Reveal.getIndices().h,
41
- indexv = Reveal.getIndices().v,
42
- nextindexh,
43
- nextindexv;
29
+ var notes = slideElement.querySelector( 'aside.notes' ),
30
+ nextindexh,
31
+ nextindexv;
44
32
 
45
- if( slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION' ) {
46
- nextindexh = indexh;
47
- nextindexv = indexv + 1;
48
- } else {
49
- nextindexh = indexh + 1;
50
- nextindexv = 0;
51
- }
52
-
53
- messageData = {
54
- notes : notes ? notes.innerHTML : '',
55
- indexh : indexh,
56
- indexv : indexv,
57
- nextindexh : nextindexh,
58
- nextindexv : nextindexv,
59
- markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false
60
- };
61
- }
62
- else if( eventType === 'fragmentshown' ) {
63
- messageData = {
64
- fragment : 'next'
65
- };
66
- }
67
- else if( eventType === 'fragmenthidden' ) {
68
- messageData = {
69
- fragment : 'prev'
70
- };
33
+ if( slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION' ) {
34
+ nextindexh = slideIndices.h;
35
+ nextindexv = slideIndices.v + 1;
36
+ } else {
37
+ nextindexh = slideIndices.h + 1;
38
+ nextindexv = 0;
71
39
  }
72
40
 
41
+ messageData = {
42
+ notes : notes ? notes.innerHTML : '',
43
+ indexh : slideIndices.h,
44
+ indexv : slideIndices.v,
45
+ indexf : slideIndices.f,
46
+ nextindexh : nextindexh,
47
+ nextindexv : nextindexv,
48
+ markdown : notes ? typeof notes.getAttribute( 'data-markdown' ) === 'string' : false
49
+ };
50
+
73
51
  notesPopup.postMessage( JSON.stringify( messageData ), '*' );
74
52
  }
75
53
 
76
54
  // Navigate to the current slide when the notes are loaded
77
55
  notesPopup.addEventListener( 'load', function( event ) {
78
- post('slidechanged');
56
+ post();
79
57
  }, false );
80
58
  }
81
59
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  <title>reveal.js - Barebones</title>
8
8
 
9
- <link rel="stylesheet" href="../css/reveal.min.css">
9
+ <link rel="stylesheet" href="../../css/reveal.min.css">
10
10
  </head>
11
11
 
12
12
  <body>
@@ -29,8 +29,8 @@
29
29
 
30
30
  </div>
31
31
 
32
- <script src="../lib/js/head.min.js"></script>
33
- <script src="../js/reveal.min.js"></script>
32
+ <script src="../../lib/js/head.min.js"></script>
33
+ <script src="../../js/reveal.min.js"></script>
34
34
 
35
35
  <script>
36
36
 
@@ -8,8 +8,8 @@
8
8
 
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
10
10
 
11
- <link rel="stylesheet" href="../css/reveal.min.css">
12
- <link rel="stylesheet" href="../css/theme/default.css" id="theme">
11
+ <link rel="stylesheet" href="../../css/reveal.min.css">
12
+ <link rel="stylesheet" href="../../css/theme/default.css" id="theme">
13
13
  </head>
14
14
 
15
15
  <body>
@@ -34,8 +34,8 @@
34
34
 
35
35
  </div>
36
36
 
37
- <script src="../lib/js/head.min.js"></script>
38
- <script src="../js/reveal.min.js"></script>
37
+ <script src="../../lib/js/head.min.js"></script>
38
+ <script src="../../js/reveal.min.js"></script>
39
39
 
40
40
  <script>
41
41
 
@@ -0,0 +1,185 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+
7
+ <title>reveal.js - Math Plugin</title>
8
+
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
10
+
11
+ <link rel="stylesheet" href="../../css/reveal.min.css">
12
+ <link rel="stylesheet" href="../../css/theme/night.css" id="theme">
13
+ </head>
14
+
15
+ <body>
16
+
17
+ <div class="reveal">
18
+
19
+ <div class="slides">
20
+
21
+ <section>
22
+ <h2>reveal.js Math Plugin</h2>
23
+ <p>A thin wrapper for MathJax</p>
24
+ </section>
25
+
26
+ <section>
27
+ <h3>The Lorenz Equations</h3>
28
+
29
+ \[\begin{aligned}
30
+ \dot{x} &amp; = \sigma(y-x) \\
31
+ \dot{y} &amp; = \rho x - y - xz \\
32
+ \dot{z} &amp; = -\beta z + xy
33
+ \end{aligned} \]
34
+ </section>
35
+
36
+ <section>
37
+ <h3>The Cauchy-Schwarz Inequality</h3>
38
+
39
+ <script type="math/tex; mode=display">
40
+ \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right)
41
+ </script>
42
+ </section>
43
+
44
+ <section>
45
+ <h3>A Cross Product Formula</h3>
46
+
47
+ \[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
48
+ \mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
49
+ \frac{\partial X}{\partial u} &amp; \frac{\partial Y}{\partial u} &amp; 0 \\
50
+ \frac{\partial X}{\partial v} &amp; \frac{\partial Y}{\partial v} &amp; 0
51
+ \end{vmatrix} \]
52
+ </section>
53
+
54
+ <section>
55
+ <h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
56
+
57
+ \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
58
+ </section>
59
+
60
+ <section>
61
+ <h3>An Identity of Ramanujan</h3>
62
+
63
+ \[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
64
+ 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
65
+ {1+\frac{e^{-8\pi}} {1+\ldots} } } } \]
66
+ </section>
67
+
68
+ <section>
69
+ <h3>A Rogers-Ramanujan Identity</h3>
70
+
71
+ \[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
72
+ \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\]
73
+ </section>
74
+
75
+ <section>
76
+ <h3>Maxwell&#8217;s Equations</h3>
77
+
78
+ \[ \begin{aligned}
79
+ \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &amp; = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} &amp; = 4 \pi \rho \\
80
+ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
81
+ \nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
82
+ \]
83
+ </section>
84
+
85
+ <section>
86
+ <section>
87
+ <h3>The Lorenz Equations</h3>
88
+
89
+ <div class="fragment">
90
+ \[\begin{aligned}
91
+ \dot{x} &amp; = \sigma(y-x) \\
92
+ \dot{y} &amp; = \rho x - y - xz \\
93
+ \dot{z} &amp; = -\beta z + xy
94
+ \end{aligned} \]
95
+ </div>
96
+ </section>
97
+
98
+ <section>
99
+ <h3>The Cauchy-Schwarz Inequality</h3>
100
+
101
+ <div class="fragment">
102
+ \[ \left( \sum_{k=1}^n a_k b_k \right)^2 \leq \left( \sum_{k=1}^n a_k^2 \right) \left( \sum_{k=1}^n b_k^2 \right) \]
103
+ </div>
104
+ </section>
105
+
106
+ <section>
107
+ <h3>A Cross Product Formula</h3>
108
+
109
+ <div class="fragment">
110
+ \[\mathbf{V}_1 \times \mathbf{V}_2 = \begin{vmatrix}
111
+ \mathbf{i} &amp; \mathbf{j} &amp; \mathbf{k} \\
112
+ \frac{\partial X}{\partial u} &amp; \frac{\partial Y}{\partial u} &amp; 0 \\
113
+ \frac{\partial X}{\partial v} &amp; \frac{\partial Y}{\partial v} &amp; 0
114
+ \end{vmatrix} \]
115
+ </div>
116
+ </section>
117
+
118
+ <section>
119
+ <h3>The probability of getting \(k\) heads when flipping \(n\) coins is</h3>
120
+
121
+ <div class="fragment">
122
+ \[P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
123
+ </div>
124
+ </section>
125
+
126
+ <section>
127
+ <h3>An Identity of Ramanujan</h3>
128
+
129
+ <div class="fragment">
130
+ \[ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} =
131
+ 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}}
132
+ {1+\frac{e^{-8\pi}} {1+\ldots} } } } \]
133
+ </div>
134
+ </section>
135
+
136
+ <section>
137
+ <h3>A Rogers-Ramanujan Identity</h3>
138
+
139
+ <div class="fragment">
140
+ \[ 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots =
141
+ \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}\]
142
+ </div>
143
+ </section>
144
+
145
+ <section>
146
+ <h3>Maxwell&#8217;s Equations</h3>
147
+
148
+ <div class="fragment">
149
+ \[ \begin{aligned}
150
+ \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &amp; = \frac{4\pi}{c}\vec{\mathbf{j}} \\ \nabla \cdot \vec{\mathbf{E}} &amp; = 4 \pi \rho \\
151
+ \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, \frac{\partial\vec{\mathbf{B}}}{\partial t} &amp; = \vec{\mathbf{0}} \\
152
+ \nabla \cdot \vec{\mathbf{B}} &amp; = 0 \end{aligned}
153
+ \]
154
+ </div>
155
+ </section>
156
+ </section>
157
+
158
+ </div>
159
+
160
+ </div>
161
+
162
+ <script src="../../lib/js/head.min.js"></script>
163
+ <script src="../../js/reveal.min.js"></script>
164
+
165
+ <script>
166
+
167
+ Reveal.initialize({
168
+ history: true,
169
+ transition: 'linear',
170
+
171
+ math: {
172
+ // mathjax: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
173
+ config: 'TeX-AMS_HTML-full'
174
+ },
175
+
176
+ dependencies: [
177
+ { src: '../../lib/js/classList.js' },
178
+ { src: '../../plugin/math/math.js', async: true }
179
+ ]
180
+ });
181
+
182
+ </script>
183
+
184
+ </body>
185
+ </html>