slide_hero 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/slide_hero/code.rb +1 -1
  3. data/lib/slide_hero/grouped_slides.rb +1 -1
  4. data/lib/slide_hero/list.rb +6 -3
  5. data/lib/slide_hero/list_point.rb +1 -1
  6. data/lib/slide_hero/presentation.rb +1 -2
  7. data/lib/slide_hero/slide.rb +1 -2
  8. data/lib/slide_hero/version.rb +1 -1
  9. data/lib/slide_hero/views/ordered_list.html.erb +1 -1
  10. data/lib/slide_hero/views/unordered_list.html.erb +1 -1
  11. data/lib/slide_hero.rb +9 -0
  12. data/slide_hero.gemspec +7 -7
  13. data/test/slide_hero/list_spec.rb +31 -9
  14. data/vendor/reveal.js/.gitignore +0 -0
  15. data/vendor/reveal.js/.travis.yml +0 -0
  16. data/vendor/reveal.js/Gruntfile.js +12 -7
  17. data/vendor/reveal.js/LICENSE +0 -0
  18. data/vendor/reveal.js/README.md +168 -33
  19. data/vendor/reveal.js/css/print/paper.css +0 -0
  20. data/vendor/reveal.js/css/print/pdf.css +1 -1
  21. data/vendor/reveal.js/css/reveal.css +248 -17
  22. data/vendor/reveal.js/css/reveal.min.css +1 -1
  23. data/vendor/reveal.js/css/theme/README.md +3 -1
  24. data/vendor/reveal.js/css/theme/beige.css +7 -1
  25. data/vendor/reveal.js/css/theme/blood.css +175 -0
  26. data/vendor/reveal.js/css/theme/default.css +7 -1
  27. data/vendor/reveal.js/css/theme/moon.css +7 -1
  28. data/vendor/reveal.js/css/theme/night.css +7 -1
  29. data/vendor/reveal.js/css/theme/serif.css +7 -1
  30. data/vendor/reveal.js/css/theme/simple.css +7 -1
  31. data/vendor/reveal.js/css/theme/sky.css +7 -1
  32. data/vendor/reveal.js/css/theme/solarized.css +7 -1
  33. data/vendor/reveal.js/css/theme/source/beige.scss +0 -0
  34. data/vendor/reveal.js/css/theme/source/blood.scss +91 -0
  35. data/vendor/reveal.js/css/theme/source/default.scss +0 -0
  36. data/vendor/reveal.js/css/theme/source/moon.scss +0 -0
  37. data/vendor/reveal.js/css/theme/source/night.scss +0 -0
  38. data/vendor/reveal.js/css/theme/source/serif.scss +0 -0
  39. data/vendor/reveal.js/css/theme/source/simple.scss +0 -0
  40. data/vendor/reveal.js/css/theme/source/sky.scss +0 -0
  41. data/vendor/reveal.js/css/theme/source/solarized.scss +0 -0
  42. data/vendor/reveal.js/css/theme/template/mixins.scss +0 -0
  43. data/vendor/reveal.js/css/theme/template/settings.scss +0 -0
  44. data/vendor/reveal.js/css/theme/template/theme.scss +8 -1
  45. data/vendor/reveal.js/index.html +388 -0
  46. data/vendor/reveal.js/js/reveal.js +887 -293
  47. data/vendor/reveal.js/js/reveal.min.js +3 -2
  48. data/vendor/reveal.js/lib/css/zenburn.css +16 -17
  49. data/vendor/reveal.js/lib/font/league_gothic-webfont.svg +0 -0
  50. data/vendor/reveal.js/lib/font/league_gothic-webfont.ttf +0 -0
  51. data/vendor/reveal.js/lib/font/league_gothic-webfont.woff +0 -0
  52. data/vendor/reveal.js/lib/font/league_gothic_license +0 -0
  53. data/vendor/reveal.js/lib/js/classList.js +0 -0
  54. data/vendor/reveal.js/lib/js/head.min.js +0 -0
  55. data/vendor/reveal.js/lib/js/html5shiv.js +0 -0
  56. data/vendor/reveal.js/package.json +10 -9
  57. data/vendor/reveal.js/plugin/highlight/highlight.js +3 -2
  58. data/vendor/reveal.js/plugin/leap/leap.js +0 -0
  59. data/vendor/reveal.js/plugin/markdown/example.html +34 -3
  60. data/vendor/reveal.js/plugin/markdown/example.md +0 -0
  61. data/vendor/reveal.js/plugin/markdown/markdown.js +373 -201
  62. data/vendor/reveal.js/plugin/markdown/marked.js +0 -0
  63. data/vendor/reveal.js/plugin/multiplex/client.js +0 -0
  64. data/vendor/reveal.js/plugin/multiplex/index.js +0 -0
  65. data/vendor/reveal.js/plugin/multiplex/master.js +2 -1
  66. data/vendor/reveal.js/plugin/notes/notes.html +10 -2
  67. data/vendor/reveal.js/plugin/notes/notes.js +0 -0
  68. data/vendor/reveal.js/plugin/notes-server/client.js +0 -0
  69. data/vendor/reveal.js/plugin/notes-server/index.js +0 -0
  70. data/vendor/reveal.js/plugin/notes-server/notes.html +0 -0
  71. data/vendor/reveal.js/plugin/postmessage/example.html +0 -0
  72. data/vendor/reveal.js/plugin/postmessage/postmessage.js +0 -0
  73. data/vendor/reveal.js/plugin/print-pdf/print-pdf.js +0 -0
  74. data/vendor/reveal.js/plugin/remotes/remotes.js +4 -4
  75. data/vendor/reveal.js/plugin/search/search.js +0 -0
  76. data/vendor/reveal.js/plugin/zoom-js/zoom.js +3 -1
  77. data/vendor/reveal.js/{examples → test/examples}/assets/image1.png +0 -0
  78. data/vendor/reveal.js/{examples → test/examples}/assets/image2.png +0 -0
  79. data/vendor/reveal.js/{examples → test/examples}/barebones.html +2 -3
  80. data/vendor/reveal.js/{examples → test/examples}/embedded-media.html +4 -4
  81. data/vendor/reveal.js/{examples → test/examples}/math.html +6 -6
  82. data/vendor/reveal.js/{examples → test/examples}/slide-backgrounds.html +26 -5
  83. data/vendor/reveal.js/test/qunit-1.12.0.css +244 -0
  84. data/vendor/reveal.js/test/qunit-1.12.0.js +2212 -0
  85. data/vendor/reveal.js/test/test-markdown-element-attributes.html +134 -0
  86. data/vendor/reveal.js/test/test-markdown-element-attributes.js +46 -0
  87. data/vendor/reveal.js/test/test-markdown-slide-attributes.html +128 -0
  88. data/vendor/reveal.js/test/test-markdown-slide-attributes.js +47 -0
  89. data/vendor/reveal.js/test/test-markdown.html +52 -0
  90. data/vendor/reveal.js/test/test-markdown.js +15 -0
  91. data/vendor/reveal.js/test/test.html +81 -0
  92. data/vendor/reveal.js/test/test.js +438 -0
  93. metadata +58 -45
@@ -1,220 +1,392 @@
1
- // From https://gist.github.com/1343518
2
- // Modified by Hakim to handle Markdown indented with tabs
3
- (function(){
4
-
5
- if( typeof marked === 'undefined' ) {
6
- throw 'The reveal.js Markdown plugin requires marked to be loaded';
7
- }
8
-
9
- if (typeof hljs !== 'undefined') {
10
- marked.setOptions({
11
- highlight: function (lang, code) {
12
- return hljs.highlightAuto(lang, code).value;
13
- }
14
- });
15
- }
16
-
17
- var stripLeadingWhitespace = function(section) {
18
-
19
- var template = section.querySelector( 'script' );
20
-
21
- // strip leading whitespace so it isn't evaluated as code
22
- var text = ( template || section ).textContent;
23
-
24
- var leadingWs = text.match(/^\n?(\s*)/)[1].length,
25
- leadingTabs = text.match(/^\n?(\t*)/)[1].length;
26
-
27
- if( leadingTabs > 0 ) {
28
- text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
29
- }
30
- else if( leadingWs > 1 ) {
31
- text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' );
32
- }
33
-
34
- return text;
35
-
36
- };
37
-
38
- var twrap = function(el) {
39
- var content = el.content || el;
40
- content += el.asideContent ? ('<aside class="notes" data-markdown>' + el.asideContent + '</aside>') : '';
41
- return '<script type="text/template">' + content + '</script>';
42
- };
43
-
44
- var getForwardedAttributes = function(section) {
45
- var attributes = section.attributes;
46
- var result = [];
47
-
48
- for( var i = 0, len = attributes.length; i < len; i++ ) {
49
- var name = attributes[i].name,
50
- value = attributes[i].value;
51
-
52
- // disregard attributes that are used for markdown loading/parsing
53
- if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
54
-
55
- if( value ) {
56
- result.push( name + '=' + value );
57
- }
58
- else {
59
- result.push( name );
60
- }
61
- }
62
-
63
- return result.join( ' ' );
64
- };
65
-
66
- var slidifyMarkdown = function(markdown, separator, vertical, notes, attributes) {
67
-
68
- separator = separator || '^\n---\n$';
69
- notes = notes || 'note:';
70
-
71
- var separatorRegex = new RegExp( separator + ( vertical ? '|' + vertical : '' ), 'mg' ),
72
- horizontalSeparatorRegex = new RegExp( separator ),
73
- notesSeparatorRegex = new RegExp( notes, 'mgi' ),
74
- matches,
75
- noteMatch,
76
- lastIndex = 0,
77
- isHorizontal,
78
- wasHorizontal = true,
79
- content,
80
- asideContent,
81
- slide,
82
- sectionStack = [],
83
- markdownSections = '';
84
-
85
- // iterate until all blocks between separators are stacked up
86
- while( matches = separatorRegex.exec( markdown ) ) {
87
- asideContent = null;
88
-
89
- // determine direction (horizontal by default)
90
- isHorizontal = horizontalSeparatorRegex.test( matches[0] );
91
-
92
- if( !isHorizontal && wasHorizontal ) {
93
- // create vertical stack
94
- sectionStack.push( [] );
95
- }
96
-
97
- // pluck slide content from markdown input
98
- content = markdown.substring( lastIndex, matches.index );
99
- noteMatch = content.split( notesSeparatorRegex );
100
-
101
- if( noteMatch.length === 2 ) {
102
- content = noteMatch[0];
103
- asideContent = noteMatch[1].trim();
104
- }
1
+ /**
2
+ * The reveal.js markdown plugin. Handles parsing of
3
+ * markdown inside of presentations as well as loading
4
+ * of external markdown documents.
5
+ */
6
+ (function( root, factory ) {
7
+ if( typeof exports === 'object' ) {
8
+ module.exports = factory( require( './marked' ) );
9
+ }
10
+ else {
11
+ // Browser globals (root is window)
12
+ root.RevealMarkdown = factory( root.marked );
13
+ root.RevealMarkdown.initialize();
14
+ }
15
+ }( this, function( marked ) {
16
+
17
+ if( typeof marked === 'undefined' ) {
18
+ throw 'The reveal.js Markdown plugin requires marked to be loaded';
19
+ }
20
+
21
+ if( typeof hljs !== 'undefined' ) {
22
+ marked.setOptions({
23
+ highlight: function( lang, code ) {
24
+ return hljs.highlightAuto( lang, code ).value;
25
+ }
26
+ });
27
+ }
28
+
29
+ var DEFAULT_SLIDE_SEPARATOR = '^\n---\n$',
30
+ DEFAULT_NOTES_SEPARATOR = 'note:',
31
+ DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
32
+ DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
33
+
34
+
35
+ /**
36
+ * Retrieves the markdown contents of a slide section
37
+ * element. Normalizes leading tabs/whitespace.
38
+ */
39
+ function getMarkdownFromSlide( section ) {
40
+
41
+ var template = section.querySelector( 'script' );
42
+
43
+ // strip leading whitespace so it isn't evaluated as code
44
+ var text = ( template || section ).textContent;
45
+
46
+ var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
47
+ leadingTabs = text.match( /^\n?(\t*)/ )[1].length;
48
+
49
+ if( leadingTabs > 0 ) {
50
+ text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' );
51
+ }
52
+ else if( leadingWs > 1 ) {
53
+ text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' );
54
+ }
55
+
56
+ return text;
57
+
58
+ }
59
+
60
+ /**
61
+ * Given a markdown slide section element, this will
62
+ * return all arguments that aren't related to markdown
63
+ * parsing. Used to forward any other user-defined arguments
64
+ * to the output markdown slide.
65
+ */
66
+ function getForwardedAttributes( section ) {
67
+
68
+ var attributes = section.attributes;
69
+ var result = [];
70
+
71
+ for( var i = 0, len = attributes.length; i < len; i++ ) {
72
+ var name = attributes[i].name,
73
+ value = attributes[i].value;
74
+
75
+ // disregard attributes that are used for markdown loading/parsing
76
+ if( /data\-(markdown|separator|vertical|notes)/gi.test( name ) ) continue;
77
+
78
+ if( value ) {
79
+ result.push( name + '=' + value );
80
+ }
81
+ else {
82
+ result.push( name );
83
+ }
84
+ }
85
+
86
+ return result.join( ' ' );
87
+
88
+ }
89
+
90
+ /**
91
+ * Inspects the given options and fills out default
92
+ * values for what's not defined.
93
+ */
94
+ function getSlidifyOptions( options ) {
95
+
96
+ options = options || {};
97
+ options.separator = options.separator || DEFAULT_SLIDE_SEPARATOR;
98
+ options.notesSeparator = options.notesSeparator || DEFAULT_NOTES_SEPARATOR;
99
+ options.attributes = options.attributes || '';
100
+
101
+ return options;
102
+
103
+ }
104
+
105
+ /**
106
+ * Helper function for constructing a markdown slide.
107
+ */
108
+ function createMarkdownSlide( content, options ) {
105
109
 
106
- slide = {
107
- content: content,
108
- asideContent: asideContent || ""
109
- };
110
+ options = getSlidifyOptions( options );
110
111
 
111
- if( isHorizontal && wasHorizontal ) {
112
- // add to horizontal stack
113
- sectionStack.push(slide);
114
- } else {
115
- // add to vertical stack
116
- sectionStack[sectionStack.length-1].push(slide);
117
- }
112
+ var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
118
113
 
119
- lastIndex = separatorRegex.lastIndex;
120
- wasHorizontal = isHorizontal;
121
- }
114
+ if( notesMatch.length === 2 ) {
115
+ content = notesMatch[0] + '<aside class="notes" data-markdown>' + notesMatch[1].trim() + '</aside>';
116
+ }
122
117
 
123
- // add the remaining slide
124
- (wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1]).push(markdown.substring(lastIndex));
118
+ return '<script type="text/template">' + content + '</script>';
125
119
 
126
- // flatten the hierarchical stack, and insert <section data-markdown> tags
127
- for( var k = 0, klen = sectionStack.length; k < klen; k++ ) {
128
- // vertical
129
- if( sectionStack[k].propertyIsEnumerable(length) && typeof sectionStack[k].splice === 'function' ) {
130
- markdownSections += '<section '+ attributes +'>' +
131
- '<section data-markdown>' + sectionStack[k].map(twrap).join('</section><section data-markdown>') + '</section>' +
132
- '</section>';
133
- } else {
134
- markdownSections += '<section '+ attributes +' data-markdown>' + twrap( sectionStack[k] ) + '</section>';
135
- }
136
- }
120
+ }
137
121
 
138
- return markdownSections;
139
- };
122
+ /**
123
+ * Parses a data string into multiple slides based
124
+ * on the passed in separator arguments.
125
+ */
126
+ function slidify( markdown, options ) {
140
127
 
141
- var querySlidingMarkdown = function() {
128
+ options = getSlidifyOptions( options );
142
129
 
143
- var sections = document.querySelectorAll( '[data-markdown]'),
144
- section;
130
+ var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
131
+ horizontalSeparatorRegex = new RegExp( options.separator );
145
132
 
146
- for( var j = 0, jlen = sections.length; j < jlen; j++ ) {
133
+ var matches,
134
+ lastIndex = 0,
135
+ isHorizontal,
136
+ wasHorizontal = true,
137
+ content,
138
+ sectionStack = [];
147
139
 
148
- section = sections[j];
140
+ // iterate until all blocks between separators are stacked up
141
+ while( matches = separatorRegex.exec( markdown ) ) {
142
+ notes = null;
149
143
 
150
- if( section.getAttribute('data-markdown').length ) {
144
+ // determine direction (horizontal by default)
145
+ isHorizontal = horizontalSeparatorRegex.test( matches[0] );
151
146
 
152
- var xhr = new XMLHttpRequest(),
153
- url = section.getAttribute('data-markdown');
147
+ if( !isHorizontal && wasHorizontal ) {
148
+ // create vertical stack
149
+ sectionStack.push( [] );
150
+ }
154
151
 
155
- datacharset = section.getAttribute('data-charset');
156
- // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
157
- if (datacharset != null && datacharset != '') {
158
- xhr.overrideMimeType('text/html; charset=' + datacharset);
159
- }
152
+ // pluck slide content from markdown input
153
+ content = markdown.substring( lastIndex, matches.index );
160
154
 
161
- xhr.onreadystatechange = function () {
162
- if( xhr.readyState === 4 ) {
163
- if (xhr.status >= 200 && xhr.status < 300) {
164
- section.outerHTML = slidifyMarkdown( xhr.responseText, section.getAttribute('data-separator'), section.getAttribute('data-vertical'), section.getAttribute('data-notes'), getForwardedAttributes(section) );
165
- } else {
166
- section.outerHTML = '<section data-state="alert">ERROR: The attempt to fetch ' + url + ' failed with the HTTP status ' + xhr.status +
167
- '. Check your browser\'s JavaScript console for more details.' +
168
- '<p>Remember that you need to serve the presentation HTML from a HTTP server and the Markdown file must be there too.</p></section>';
169
- }
170
- }
171
- };
155
+ if( isHorizontal && wasHorizontal ) {
156
+ // add to horizontal stack
157
+ sectionStack.push( content );
158
+ }
159
+ else {
160
+ // add to vertical stack
161
+ sectionStack[sectionStack.length-1].push( content );
162
+ }
172
163
 
173
- xhr.open('GET', url, false);
174
- try {
175
- xhr.send();
176
- } catch (e) {
177
- alert('Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e);
178
- }
164
+ lastIndex = separatorRegex.lastIndex;
165
+ wasHorizontal = isHorizontal;
166
+ }
179
167
 
180
- } else if( section.getAttribute('data-separator') ) {
168
+ // add the remaining slide
169
+ ( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
181
170
 
182
- var markdown = stripLeadingWhitespace(section);
183
- section.outerHTML = slidifyMarkdown( markdown, section.getAttribute('data-separator'), section.getAttribute('data-vertical'), section.getAttribute('data-notes'), getForwardedAttributes(section) );
171
+ var markdownSections = '';
184
172
 
185
- }
186
- }
173
+ // flatten the hierarchical stack, and insert <section data-markdown> tags
174
+ for( var i = 0, len = sectionStack.length; i < len; i++ ) {
175
+ // vertical
176
+ if( sectionStack[i] instanceof Array ) {
177
+ markdownSections += '<section '+ options.attributes +'>';
178
+
179
+ sectionStack[i].forEach( function( child ) {
180
+ markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
181
+ } );
187
182
 
188
- };
189
-
190
- var queryMarkdownSlides = function() {
191
-
192
- var sections = document.querySelectorAll( '[data-markdown]');
193
-
194
- for( var j = 0, jlen = sections.length; j < jlen; j++ ) {
195
-
196
- makeHtml(sections[j]);
197
-
198
- }
199
-
200
- };
201
-
202
- var makeHtml = function(section) {
203
-
204
- var notes = section.querySelector( 'aside.notes' );
205
-
206
- var markdown = stripLeadingWhitespace(section);
207
-
208
- section.innerHTML = marked(markdown);
209
-
210
- if( notes ) {
211
- section.appendChild( notes );
212
- }
213
-
214
- };
215
-
216
- querySlidingMarkdown();
217
-
218
- queryMarkdownSlides();
219
-
220
- })();
183
+ markdownSections += '</section>';
184
+ }
185
+ else {
186
+ markdownSections += '<section '+ options.attributes +' data-markdown>' + createMarkdownSlide( sectionStack[i], options ) + '</section>';
187
+ }
188
+ }
189
+
190
+ return markdownSections;
191
+
192
+ }
193
+
194
+ /**
195
+ * Parses any current data-markdown slides, splits
196
+ * multi-slide markdown into separate sections and
197
+ * handles loading of external markdown.
198
+ */
199
+ function processSlides() {
200
+
201
+ var sections = document.querySelectorAll( '[data-markdown]'),
202
+ section;
203
+
204
+ for( var i = 0, len = sections.length; i < len; i++ ) {
205
+
206
+ section = sections[i];
207
+
208
+ if( section.getAttribute( 'data-markdown' ).length ) {
209
+
210
+ var xhr = new XMLHttpRequest(),
211
+ url = section.getAttribute( 'data-markdown' );
212
+
213
+ datacharset = section.getAttribute( 'data-charset' );
214
+
215
+ // see https://developer.mozilla.org/en-US/docs/Web/API/element.getAttribute#Notes
216
+ if( datacharset != null && datacharset != '' ) {
217
+ xhr.overrideMimeType( 'text/html; charset=' + datacharset );
218
+ }
219
+
220
+ xhr.onreadystatechange = function() {
221
+ if( xhr.readyState === 4 ) {
222
+ if ( xhr.status >= 200 && xhr.status < 300 ) {
223
+
224
+ section.outerHTML = slidify( xhr.responseText, {
225
+ separator: section.getAttribute( 'data-separator' ),
226
+ verticalSeparator: section.getAttribute( 'data-vertical' ),
227
+ notesSeparator: section.getAttribute( 'data-notes' ),
228
+ attributes: getForwardedAttributes( section )
229
+ });
230
+
231
+ }
232
+ else {
233
+
234
+ section.outerHTML = '<section data-state="alert">' +
235
+ 'ERROR: The attempt to fetch ' + url + ' failed with HTTP status ' + xhr.status + '.' +
236
+ 'Check your browser\'s JavaScript console for more details.' +
237
+ '<p>Remember that you need to serve the presentation HTML from a HTTP server.</p>' +
238
+ '</section>';
239
+
240
+ }
241
+ }
242
+ };
243
+
244
+ xhr.open( 'GET', url, false );
245
+
246
+ try {
247
+ xhr.send();
248
+ }
249
+ catch ( e ) {
250
+ alert( 'Failed to get the Markdown file ' + url + '. Make sure that the presentation and the file are served by a HTTP server and the file can be found there. ' + e );
251
+ }
252
+
253
+ }
254
+ else if( section.getAttribute( 'data-separator' ) || section.getAttribute( 'data-vertical' ) || section.getAttribute( 'data-notes' ) ) {
255
+
256
+ section.outerHTML = slidify( getMarkdownFromSlide( section ), {
257
+ separator: section.getAttribute( 'data-separator' ),
258
+ verticalSeparator: section.getAttribute( 'data-vertical' ),
259
+ notesSeparator: section.getAttribute( 'data-notes' ),
260
+ attributes: getForwardedAttributes( section )
261
+ });
262
+
263
+ }
264
+ else {
265
+ section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
266
+ }
267
+ }
268
+
269
+ }
270
+
271
+ /**
272
+ * Check if a node value has the attributes pattern.
273
+ * If yes, extract it and add that value as one or several attributes
274
+ * the the terget element.
275
+ *
276
+ * You need Cache Killer on Chrome to see the effect on any FOM transformation
277
+ * directly on refresh (F5)
278
+ * http://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development/7000899#answer-11786277
279
+ */
280
+ function addAttributeInElement( node, elementTarget, separator ) {
281
+
282
+ var mardownClassesInElementsRegex = new RegExp( separator, 'mg' );
283
+ var mardownClassRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' );
284
+ var nodeValue = node.nodeValue;
285
+ if( matches = mardownClassesInElementsRegex.exec( nodeValue ) ) {
286
+
287
+ var classes = matches[1];
288
+ nodeValue = nodeValue.substring( 0, matches.index ) + nodeValue.substring( mardownClassesInElementsRegex.lastIndex );
289
+ node.nodeValue = nodeValue;
290
+ while( matchesClass = mardownClassRegex.exec( classes ) ) {
291
+ elementTarget.setAttribute( matchesClass[1], matchesClass[2] );
292
+ }
293
+ return true;
294
+ }
295
+ return false;
296
+ }
297
+
298
+ /**
299
+ * Add attributes to the parent element of a text node,
300
+ * or the element of an attribute node.
301
+ */
302
+ function addAttributes( section, element, previousElement, separatorElementAttributes, separatorSectionAttributes ) {
303
+
304
+ if ( element != null && element.childNodes != undefined && element.childNodes.length > 0 ) {
305
+ previousParentElement = element;
306
+ for( var i = 0; i < element.childNodes.length; i++ ) {
307
+ childElement = element.childNodes[i];
308
+ if ( i > 0 ) {
309
+ j = i - 1;
310
+ while ( j >= 0 ) {
311
+ aPreviousChildElement = element.childNodes[j];
312
+ if ( typeof aPreviousChildElement.setAttribute == 'function' && aPreviousChildElement.tagName != "BR" ) {
313
+ previousParentElement = aPreviousChildElement;
314
+ break;
315
+ }
316
+ j = j - 1;
317
+ }
318
+ }
319
+ parentSection = section;
320
+ if( childElement.nodeName == "section" ) {
321
+ parentSection = childElement ;
322
+ previousParentElement = childElement ;
323
+ }
324
+ if ( typeof childElement.setAttribute == 'function' || childElement.nodeType == Node.COMMENT_NODE ) {
325
+ addAttributes( parentSection, childElement, previousParentElement, separatorElementAttributes, separatorSectionAttributes );
326
+ }
327
+ }
328
+ }
329
+
330
+ if ( element.nodeType == Node.COMMENT_NODE ) {
331
+ if ( addAttributeInElement( element, previousElement, separatorElementAttributes ) == false ) {
332
+ addAttributeInElement( element, section, separatorSectionAttributes );
333
+ }
334
+ }
335
+ }
336
+
337
+ /**
338
+ * Converts any current data-markdown slides in the
339
+ * DOM to HTML.
340
+ */
341
+ function convertSlides() {
342
+
343
+ var sections = document.querySelectorAll( '[data-markdown]');
344
+
345
+ for( var i = 0, len = sections.length; i < len; i++ ) {
346
+
347
+ var section = sections[i];
348
+
349
+ // Only parse the same slide once
350
+ if( !section.getAttribute( 'data-markdown-parsed' ) ) {
351
+
352
+ section.setAttribute( 'data-markdown-parsed', true )
353
+
354
+ var notes = section.querySelector( 'aside.notes' );
355
+ var markdown = getMarkdownFromSlide( section );
356
+
357
+ section.innerHTML = marked( markdown );
358
+ addAttributes( section, section, null, section.getAttribute( 'data-element-attributes' ) ||
359
+ section.parentNode.getAttribute( 'data-element-attributes' ) ||
360
+ DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR,
361
+ section.getAttribute( 'data-attributes' ) ||
362
+ section.parentNode.getAttribute( 'data-attributes' ) ||
363
+ DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR);
364
+
365
+ // If there were notes, we need to re-add them after
366
+ // having overwritten the section's HTML
367
+ if( notes ) {
368
+ section.appendChild( notes );
369
+ }
370
+
371
+ }
372
+
373
+ }
374
+
375
+ }
376
+
377
+ // API
378
+ return {
379
+
380
+ initialize: function() {
381
+ processSlides();
382
+ convertSlides();
383
+ },
384
+
385
+ // TODO: Do these belong in the API?
386
+ processSlides: processSlides,
387
+ convertSlides: convertSlides,
388
+ slidify: slidify
389
+
390
+ };
391
+
392
+ }));
File without changes
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  (function() {
2
- // don't emit events from inside the previews themselves
2
+ // Don't emit events from inside of notes windows
3
3
  if ( window.location.search.match( /receiver/gi ) ) { return; }
4
+
4
5
  var multiplex = Reveal.getConfig().multiplex;
5
6
 
6
7
  var socket = io.connect(multiplex.url);
@@ -138,12 +138,20 @@
138
138
 
139
139
  <body>
140
140
 
141
+ <script>
142
+ function getNotesURL( controls ) {
143
+ return window.opener.location.protocol + '//' + window.opener.location.host + window.opener.location.pathname + '?receiver&controls='+ ( controls || 'false' ) +'&progress=false&overview=false' + window.opener.location.hash;
144
+ }
145
+ var notesCurrentSlideURL = getNotesURL( true );
146
+ var notesNextSlideURL = getNotesURL( false );
147
+ </script>
148
+
141
149
  <div id="wrap-current-slide" class="slides">
142
- <script>document.write( '<iframe width="1280" height="1024" id="current-slide" src="'+ window.opener.location.href +'"></iframe>' );</script>
150
+ <script>document.write( '<iframe width="1280" height="1024" id="current-slide" src="'+ notesCurrentSlideURL +'"></iframe>' );</script>
143
151
  </div>
144
152
 
145
153
  <div id="wrap-next-slide" class="slides">
146
- <script>document.write( '<iframe width="640" height="512" id="next-slide" src="'+ window.opener.location.href +'"></iframe>' );</script>
154
+ <script>document.write( '<iframe width="640" height="512" id="next-slide" src="'+ notesNextSlideURL +'"></iframe>' );</script>
147
155
  <span>UPCOMING:</span>
148
156
  </div>
149
157
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes