reveal-ck 0.1.8 → 0.2.0

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 (47) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +3 -11
  3. data/bin/reveal-ck +38 -3
  4. data/lib/reveal-ck.rb +2 -0
  5. data/lib/reveal-ck/markdown.rb +2 -0
  6. data/lib/reveal-ck/markdown/slide_markdown.rb +22 -0
  7. data/lib/reveal-ck/markdown/slide_markdown_template.rb +22 -0
  8. data/lib/reveal-ck/tilt/config.rb +2 -0
  9. data/lib/reveal-ck/version.rb +1 -1
  10. data/reveal.js/Gruntfile.js +4 -3
  11. data/reveal.js/README.md +135 -13
  12. data/reveal.js/css/print/pdf.css +1 -1
  13. data/reveal.js/css/reveal.css +242 -15
  14. data/reveal.js/css/reveal.min.css +1 -1
  15. data/reveal.js/css/theme/beige.css +7 -1
  16. data/reveal.js/css/theme/blood.css +175 -0
  17. data/reveal.js/css/theme/default.css +7 -1
  18. data/reveal.js/css/theme/moon.css +7 -1
  19. data/reveal.js/css/theme/night.css +7 -1
  20. data/reveal.js/css/theme/serif.css +7 -1
  21. data/reveal.js/css/theme/simple.css +7 -1
  22. data/reveal.js/css/theme/sky.css +7 -1
  23. data/reveal.js/css/theme/solarized.css +7 -1
  24. data/reveal.js/css/theme/source/blood.scss +91 -0
  25. data/reveal.js/css/theme/template/theme.scss +8 -1
  26. data/reveal.js/index.html +9 -4
  27. data/reveal.js/js/reveal.js +804 -199
  28. data/reveal.js/js/reveal.min.js +3 -2
  29. data/reveal.js/package.json +1 -1
  30. data/reveal.js/plugin/highlight/highlight.js +3 -2
  31. data/reveal.js/plugin/markdown/example.html +34 -3
  32. data/reveal.js/plugin/markdown/markdown.js +75 -3
  33. data/reveal.js/plugin/notes/notes.html +10 -6
  34. data/reveal.js/plugin/remotes/remotes.js +1 -1
  35. data/reveal.js/plugin/zoom-js/zoom.js +3 -1
  36. data/reveal.js/test/examples/barebones.html +0 -1
  37. data/reveal.js/test/examples/slide-backgrounds.html +22 -1
  38. data/reveal.js/test/test-markdown-element-attributes.html +134 -0
  39. data/reveal.js/test/test-markdown-element-attributes.js +46 -0
  40. data/reveal.js/test/test-markdown-slide-attributes.html +128 -0
  41. data/reveal.js/test/test-markdown-slide-attributes.js +47 -0
  42. data/reveal.js/test/test.html +26 -7
  43. data/reveal.js/test/test.js +95 -10
  44. data/spec/lib/reveal-ck/markdown/slide_markdown_spec.rb +76 -0
  45. data/spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb +29 -0
  46. data/spec/lib/reveal-ck/tilt/config_spec.rb +9 -0
  47. metadata +34 -4
@@ -0,0 +1,128 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+
7
+ <title>reveal.js - Test Markdown Attributes</title>
8
+
9
+ <link rel="stylesheet" href="../css/reveal.min.css">
10
+ <link rel="stylesheet" href="qunit-1.12.0.css">
11
+ </head>
12
+
13
+ <body style="overflow: auto;">
14
+
15
+ <div id="qunit"></div>
16
+ <div id="qunit-fixture"></div>
17
+
18
+ <div class="reveal" style="display: none;">
19
+
20
+ <div class="slides">
21
+
22
+ <!-- <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section> -->
23
+
24
+ <!-- Slides are separated by three lines, vertical slides by two lines, attributes are one any line starting with (spaces and) two dashes -->
25
+ <section data-markdown data-separator="^\n\n\n"
26
+ data-vertical="^\n\n"
27
+ data-notes="^Note:"
28
+ data-attributes="--\s(.*?)$"
29
+ data-charset="utf-8">
30
+ <script type="text/template">
31
+ # Test attributes in Markdown
32
+ ## Slide 1
33
+
34
+
35
+
36
+ ## Slide 2
37
+ <!-- -- id="slide2" data-transition="zoom" data-background="#A0C66B" -->
38
+
39
+
40
+ ## Slide 2.1
41
+ <!-- -- data-background="#ff0000" data-transition="fade" -->
42
+
43
+
44
+ ## Slide 2.2
45
+ [Link to Slide2](#/slide2)
46
+
47
+
48
+
49
+ ## Slide 3
50
+ <!-- -- data-transition="zoom" data-background="#C6916B" -->
51
+
52
+
53
+
54
+ ## Slide 4
55
+ </script>
56
+ </section>
57
+
58
+ <section data-markdown data-separator="^\n\n\n"
59
+ data-vertical="^\n\n"
60
+ data-notes="^Note:"
61
+ data-charset="utf-8">
62
+ <script type="text/template">
63
+ # Test attributes in Markdown with default separator
64
+ ## Slide 1 Def
65
+
66
+
67
+
68
+ ## Slide 2 Def
69
+ <!-- .slide: id="slide2def" data-transition="concave" data-background="#A7C66B" -->
70
+
71
+
72
+ ## Slide 2.1 Def
73
+ <!-- .slide: data-background="#f70000" data-transition="page" -->
74
+
75
+
76
+ ## Slide 2.2 Def
77
+ [Link to Slide2](#/slide2def)
78
+
79
+
80
+
81
+ ## Slide 3 Def
82
+ <!-- .slide: data-transition="concave" data-background="#C7916B" -->
83
+
84
+
85
+
86
+ ## Slide 4
87
+ </script>
88
+ </section>
89
+
90
+ <section data-markdown>
91
+ <script type="text/template">
92
+ <!-- .slide: data-background="#ff0000" -->
93
+ ## Hello world
94
+ </script>
95
+ </section>
96
+
97
+ <section data-markdown>
98
+ <script type="text/template">
99
+ ## Hello world
100
+ <!-- .slide: data-background="#ff0000" -->
101
+ </script>
102
+ </section>
103
+
104
+ <section data-markdown>
105
+ <script type="text/template">
106
+ ## Hello world
107
+
108
+ Test
109
+ <!-- .slide: data-background="#ff0000" -->
110
+
111
+ More Test
112
+ </script>
113
+ </section>
114
+
115
+ </div>
116
+
117
+ </div>
118
+
119
+ <script src="../lib/js/head.min.js"></script>
120
+ <script src="../js/reveal.min.js"></script>
121
+ <script src="../plugin/markdown/marked.js"></script>
122
+ <script src="../plugin/markdown/markdown.js"></script>
123
+ <script src="qunit-1.12.0.js"></script>
124
+
125
+ <script src="test-markdown-slide-attributes.js"></script>
126
+
127
+ </body>
128
+ </html>
@@ -0,0 +1,47 @@
1
+
2
+
3
+ Reveal.addEventListener( 'ready', function() {
4
+
5
+ QUnit.module( 'Markdown' );
6
+
7
+ test( 'Vertical separator', function() {
8
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 6, 'found six vertical slides' );
9
+ });
10
+
11
+ test( 'Id on slide', function() {
12
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section#slide2' ).length, 1, 'found one slide with id slide2' );
13
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section a[href="#/slide2"]' ).length, 1, 'found one slide with a link to slide2' );
14
+ });
15
+
16
+ test( 'data-background attributes', function() {
17
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A0C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
18
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#ff0000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
19
+ strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C6916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
20
+ });
21
+
22
+ test( 'data-transition attributes', function() {
23
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="zoom"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
24
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="fade"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
25
+ strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="zoom"]' ).length, 1, 'found one slide with data-transition="zoom"' );
26
+ });
27
+
28
+ test( 'data-background attributes with default separator', function() {
29
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#A7C66B"]' ).length, 1, 'found one vertical slide with data-background="#A0C66B"' );
30
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-background="#f70000"]' ).length, 1, 'found one vertical slide with data-background="#ff0000"' );
31
+ strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#C7916B"]' ).length, 1, 'found one slide with data-background="#C6916B"' );
32
+ });
33
+
34
+ test( 'data-transition attributes with default separator', function() {
35
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="concave"]' ).length, 1, 'found one vertical slide with data-transition="zoom"' );
36
+ strictEqual( document.querySelectorAll( '.reveal .slides>section>section[data-transition="page"]' ).length, 1, 'found one vertical slide with data-transition="fade"' );
37
+ strictEqual( document.querySelectorAll( '.reveal .slides section [data-transition="concave"]' ).length, 1, 'found one slide with data-transition="zoom"' );
38
+ });
39
+
40
+ test( 'data-transition attributes with inline content', function() {
41
+ strictEqual( document.querySelectorAll( '.reveal .slides>section[data-background="#ff0000"]' ).length, 3, 'found three horizontal slides with data-background="#ff0000"' );
42
+ });
43
+
44
+ } );
45
+
46
+ Reveal.initialize();
47
+
@@ -35,13 +35,32 @@
35
35
  </section>
36
36
  </section>
37
37
 
38
- <section>
39
- <h1>4</h1>
40
- <ul>
41
- <li class="fragment">4.1</li>
42
- <li class="fragment">4.2</li>
43
- <li class="fragment">4.3</li>
44
- </ul>
38
+ <section id="fragment-slides">
39
+ <section>
40
+ <h1>3.1</h1>
41
+ <ul>
42
+ <li class="fragment">4.1</li>
43
+ <li class="fragment">4.2</li>
44
+ <li class="fragment">4.3</li>
45
+ </ul>
46
+ </section>
47
+
48
+ <section>
49
+ <h1>3.2</h1>
50
+ <ul>
51
+ <li class="fragment" data-fragment-index="0">4.1</li>
52
+ <li class="fragment" data-fragment-index="0">4.2</li>
53
+ </ul>
54
+ </section>
55
+
56
+ <section>
57
+ <h1>3.3</h1>
58
+ <ul>
59
+ <li class="fragment" data-fragment-index="1">3.3.1</li>
60
+ <li class="fragment" data-fragment-index="4">3.3.2</li>
61
+ <li class="fragment" data-fragment-index="4">3.3.3</li>
62
+ </ul>
63
+ </section>
45
64
  </section>
46
65
 
47
66
  <section>
@@ -5,11 +5,28 @@
5
5
  // 1
6
6
  // 2 - Three sub-slides
7
7
  // 3 - Three fragment elements
8
+ // 3 - Two fragments with same data-fragment-index
8
9
  // 4
9
10
 
10
11
 
11
12
  Reveal.addEventListener( 'ready', function() {
12
13
 
14
+ // ---------------------------------------------------------------
15
+ // DOM TESTS
16
+
17
+ QUnit.module( 'DOM' );
18
+
19
+ test( 'Initial slides classes', function() {
20
+ var horizontalSlides = document.querySelectorAll( '.reveal .slides>section' )
21
+
22
+ strictEqual( document.querySelectorAll( '.reveal .slides section.past' ).length, 0, 'no .past slides' );
23
+ strictEqual( document.querySelectorAll( '.reveal .slides section.present' ).length, 1, 'one .present slide' );
24
+ strictEqual( document.querySelectorAll( '.reveal .slides>section.future' ).length, horizontalSlides.length - 1, 'remaining horizontal slides are .future' );
25
+
26
+ strictEqual( document.querySelectorAll( '.reveal .slides section.stack' ).length, 2, 'two .stacks' );
27
+
28
+ ok( document.querySelectorAll( '.reveal .slides section.stack' )[0].querySelectorAll( '.future' ).length > 0, 'vertical slides are given .future' );
29
+ });
13
30
 
14
31
  // ---------------------------------------------------------------
15
32
  // API TESTS
@@ -128,7 +145,7 @@ Reveal.addEventListener( 'ready', function() {
128
145
  test( 'Reveal.next', function() {
129
146
  Reveal.slide( 0, 0 );
130
147
 
131
- // Step through the vertical child slides
148
+ // Step through vertical child slides
132
149
  Reveal.next();
133
150
  deepEqual( Reveal.getIndices(), { h: 1, v: 0, f: undefined } );
134
151
 
@@ -138,7 +155,10 @@ Reveal.addEventListener( 'ready', function() {
138
155
  Reveal.next();
139
156
  deepEqual( Reveal.getIndices(), { h: 1, v: 2, f: undefined } );
140
157
 
141
- // There's fragments on this slide
158
+ // Step through fragments
159
+ Reveal.next();
160
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 } );
161
+
142
162
  Reveal.next();
143
163
  deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 } );
144
164
 
@@ -147,14 +167,15 @@ Reveal.addEventListener( 'ready', function() {
147
167
 
148
168
  Reveal.next();
149
169
  deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 } );
170
+ });
150
171
 
151
- Reveal.next();
152
- deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 3 } );
172
+ test( 'Reveal.next at end', function() {
173
+ Reveal.slide( 3 );
153
174
 
175
+ // We're at the end, this should have no effect
154
176
  Reveal.next();
155
177
  deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
156
178
 
157
- // We're at the end, this should have no effect
158
179
  Reveal.next();
159
180
  deepEqual( Reveal.getIndices(), { h: 3, v: 0, f: undefined } );
160
181
  });
@@ -166,6 +187,9 @@ Reveal.addEventListener( 'ready', function() {
166
187
  QUnit.module( 'Fragments' );
167
188
 
168
189
  test( 'Sliding to fragments', function() {
190
+ Reveal.slide( 2, 0, -1 );
191
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: -1 }, 'Reveal.slide( 2, 0, -1 )' );
192
+
169
193
  Reveal.slide( 2, 0, 0 );
170
194
  deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'Reveal.slide( 2, 0, 0 )' );
171
195
 
@@ -176,19 +200,45 @@ Reveal.addEventListener( 'ready', function() {
176
200
  deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'Reveal.slide( 2, 0, 1 )' );
177
201
  });
178
202
 
179
- test( 'Stepping through fragments', function() {
203
+ test( 'Hiding all fragments', function() {
204
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
205
+
180
206
  Reveal.slide( 2, 0, 0 );
207
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 1, 'one fragment visible when index is 0' );
208
+
209
+ Reveal.slide( 2, 0, -1 );
210
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when index is -1' );
211
+ });
212
+
213
+ test( 'Current fragment', function() {
214
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
215
+
216
+ Reveal.slide( 2, 0 );
217
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment at index -1' );
218
+
219
+ Reveal.slide( 2, 0, 0 );
220
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 1, 'one current fragment at index 0' );
221
+
222
+ Reveal.slide( 1, 0, 0 );
223
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to previous slide' );
224
+
225
+ Reveal.slide( 3, 0, 0 );
226
+ strictEqual( fragmentSlide.querySelectorAll( '.fragment.current-fragment' ).length, 0, 'no current fragment when navigating to next slide' );
227
+ });
228
+
229
+ test( 'Stepping through fragments', function() {
230
+ Reveal.slide( 2, 0, -1 );
181
231
 
182
232
  // forwards:
183
233
 
184
234
  Reveal.next();
185
- deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'next() goes to next fragment' );
235
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'next() goes to next fragment' );
186
236
 
187
237
  Reveal.right();
188
- deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'right() goes to next fragment' );
238
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'right() goes to next fragment' );
189
239
 
190
240
  Reveal.down();
191
- deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 3 }, 'down() goes to next fragment' );
241
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 2 }, 'down() goes to next fragment' );
192
242
 
193
243
  Reveal.down(); // moves to f #3
194
244
 
@@ -201,7 +251,42 @@ Reveal.addEventListener( 'ready', function() {
201
251
  deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 1 }, 'left() goes to prev fragment' );
202
252
 
203
253
  Reveal.up();
204
- deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'left() goes to prev fragment' );
254
+ deepEqual( Reveal.getIndices(), { h: 2, v: 0, f: 0 }, 'up() goes to prev fragment' );
255
+ });
256
+
257
+ test( 'Stepping past fragments', function() {
258
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
259
+
260
+ Reveal.slide( 0, 0, 0 );
261
+ equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 0, 'no fragments visible when on previous slide' );
262
+
263
+ Reveal.slide( 3, 0, 0 );
264
+ equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 3, 'all fragments visible when on future slide' );
265
+ });
266
+
267
+ test( 'Fragment indices', function() {
268
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(2)' );
269
+
270
+ Reveal.slide( 3, 0, 0 );
271
+ equal( fragmentSlide.querySelectorAll( '.fragment.visible' ).length, 2, 'both fragments of same index are shown' );
272
+ });
273
+
274
+ test( 'Index generation', function() {
275
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(1)' );
276
+
277
+ // These have no indices defined to start with
278
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
279
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
280
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '2' );
281
+ });
282
+
283
+ test( 'Index normalization', function() {
284
+ var fragmentSlide = document.querySelector( '#fragment-slides>section:nth-child(3)' );
285
+
286
+ // These start out as 1-4-4 and should normalize to 0-1-1
287
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[0].getAttribute( 'data-fragment-index' ), '0' );
288
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[1].getAttribute( 'data-fragment-index' ), '1' );
289
+ equal( fragmentSlide.querySelectorAll( '.fragment' )[2].getAttribute( 'data-fragment-index' ), '1' );
205
290
  });
206
291
 
207
292
  asyncTest( 'fragmentshown event', function() {
@@ -0,0 +1,76 @@
1
+ require 'spec_helper'
2
+
3
+ module RevealCK
4
+ module Markdown
5
+
6
+ describe SlideMarkdown, '#postprocess' do
7
+
8
+ let :slide_markdown do
9
+ SlideMarkdown.new
10
+ end
11
+
12
+ let :basic_input do
13
+ <<-eos
14
+ <h1>First Slide</h1>
15
+
16
+ <hr>
17
+
18
+ <h1>Second Slide</h1>
19
+ eos
20
+ end
21
+
22
+ let :leading_hr_input do
23
+ <<-eos
24
+ <hr>
25
+
26
+ <h1>First Slide</h1>
27
+
28
+ <hr>
29
+
30
+ <h1>Second Slide</h1>
31
+ eos
32
+ end
33
+
34
+ let :trailing_hr_input do
35
+ <<-eos
36
+ <h1>First Slide</h1>
37
+
38
+ <hr>
39
+
40
+ <h1>Second Slide</h1>
41
+
42
+ <hr>
43
+ eos
44
+ end
45
+
46
+ it 'prepends an opening "<section>"' do
47
+ output = slide_markdown.postprocess(basic_input)
48
+ output.should start_with "<section>"
49
+ end
50
+
51
+ it 'appends a closing "</section>"' do
52
+ output = slide_markdown.postprocess(basic_input)
53
+ output.should end_with "</section>"
54
+ end
55
+
56
+ it 'replaces "<hr>"s with section breaks' do
57
+ output = slide_markdown.postprocess(basic_input)
58
+ output.should include '<h1>First Slide</h1>'
59
+ output.should include "</section>\n<section>"
60
+ output.should include '<h1>Second Slide</h1>'
61
+ end
62
+
63
+ it 'trims off an initial <hr>' do
64
+ output = slide_markdown.postprocess(leading_hr_input)
65
+ output.should_not start_with "<section>\n</section>"
66
+ end
67
+
68
+ it 'trims off a trailing <hr>' do
69
+ output = slide_markdown.postprocess(trailing_hr_input)
70
+ output.should_not =~ /<section>\s*<\/section>/m
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+ end