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.
- checksums.yaml +4 -4
- data/lib/slide_hero/code.rb +1 -1
- data/lib/slide_hero/grouped_slides.rb +1 -1
- data/lib/slide_hero/list.rb +6 -3
- data/lib/slide_hero/list_point.rb +1 -1
- data/lib/slide_hero/presentation.rb +1 -2
- data/lib/slide_hero/slide.rb +1 -2
- data/lib/slide_hero/version.rb +1 -1
- data/lib/slide_hero/views/ordered_list.html.erb +1 -1
- data/lib/slide_hero/views/unordered_list.html.erb +1 -1
- data/lib/slide_hero.rb +9 -0
- data/slide_hero.gemspec +7 -7
- data/test/slide_hero/list_spec.rb +31 -9
- data/vendor/reveal.js/.gitignore +0 -0
- data/vendor/reveal.js/.travis.yml +0 -0
- data/vendor/reveal.js/Gruntfile.js +12 -7
- data/vendor/reveal.js/LICENSE +0 -0
- data/vendor/reveal.js/README.md +168 -33
- data/vendor/reveal.js/css/print/paper.css +0 -0
- data/vendor/reveal.js/css/print/pdf.css +1 -1
- data/vendor/reveal.js/css/reveal.css +248 -17
- data/vendor/reveal.js/css/reveal.min.css +1 -1
- data/vendor/reveal.js/css/theme/README.md +3 -1
- data/vendor/reveal.js/css/theme/beige.css +7 -1
- data/vendor/reveal.js/css/theme/blood.css +175 -0
- data/vendor/reveal.js/css/theme/default.css +7 -1
- data/vendor/reveal.js/css/theme/moon.css +7 -1
- data/vendor/reveal.js/css/theme/night.css +7 -1
- data/vendor/reveal.js/css/theme/serif.css +7 -1
- data/vendor/reveal.js/css/theme/simple.css +7 -1
- data/vendor/reveal.js/css/theme/sky.css +7 -1
- data/vendor/reveal.js/css/theme/solarized.css +7 -1
- data/vendor/reveal.js/css/theme/source/beige.scss +0 -0
- data/vendor/reveal.js/css/theme/source/blood.scss +91 -0
- data/vendor/reveal.js/css/theme/source/default.scss +0 -0
- data/vendor/reveal.js/css/theme/source/moon.scss +0 -0
- data/vendor/reveal.js/css/theme/source/night.scss +0 -0
- data/vendor/reveal.js/css/theme/source/serif.scss +0 -0
- data/vendor/reveal.js/css/theme/source/simple.scss +0 -0
- data/vendor/reveal.js/css/theme/source/sky.scss +0 -0
- data/vendor/reveal.js/css/theme/source/solarized.scss +0 -0
- data/vendor/reveal.js/css/theme/template/mixins.scss +0 -0
- data/vendor/reveal.js/css/theme/template/settings.scss +0 -0
- data/vendor/reveal.js/css/theme/template/theme.scss +8 -1
- data/vendor/reveal.js/index.html +388 -0
- data/vendor/reveal.js/js/reveal.js +887 -293
- data/vendor/reveal.js/js/reveal.min.js +3 -2
- data/vendor/reveal.js/lib/css/zenburn.css +16 -17
- data/vendor/reveal.js/lib/font/league_gothic-webfont.svg +0 -0
- data/vendor/reveal.js/lib/font/league_gothic-webfont.ttf +0 -0
- data/vendor/reveal.js/lib/font/league_gothic-webfont.woff +0 -0
- data/vendor/reveal.js/lib/font/league_gothic_license +0 -0
- data/vendor/reveal.js/lib/js/classList.js +0 -0
- data/vendor/reveal.js/lib/js/head.min.js +0 -0
- data/vendor/reveal.js/lib/js/html5shiv.js +0 -0
- data/vendor/reveal.js/package.json +10 -9
- data/vendor/reveal.js/plugin/highlight/highlight.js +3 -2
- data/vendor/reveal.js/plugin/leap/leap.js +0 -0
- data/vendor/reveal.js/plugin/markdown/example.html +34 -3
- data/vendor/reveal.js/plugin/markdown/example.md +0 -0
- data/vendor/reveal.js/plugin/markdown/markdown.js +373 -201
- data/vendor/reveal.js/plugin/markdown/marked.js +0 -0
- data/vendor/reveal.js/plugin/multiplex/client.js +0 -0
- data/vendor/reveal.js/plugin/multiplex/index.js +0 -0
- data/vendor/reveal.js/plugin/multiplex/master.js +2 -1
- data/vendor/reveal.js/plugin/notes/notes.html +10 -2
- data/vendor/reveal.js/plugin/notes/notes.js +0 -0
- data/vendor/reveal.js/plugin/notes-server/client.js +0 -0
- data/vendor/reveal.js/plugin/notes-server/index.js +0 -0
- data/vendor/reveal.js/plugin/notes-server/notes.html +0 -0
- data/vendor/reveal.js/plugin/postmessage/example.html +0 -0
- data/vendor/reveal.js/plugin/postmessage/postmessage.js +0 -0
- data/vendor/reveal.js/plugin/print-pdf/print-pdf.js +0 -0
- data/vendor/reveal.js/plugin/remotes/remotes.js +4 -4
- data/vendor/reveal.js/plugin/search/search.js +0 -0
- data/vendor/reveal.js/plugin/zoom-js/zoom.js +3 -1
- data/vendor/reveal.js/{examples → test/examples}/assets/image1.png +0 -0
- data/vendor/reveal.js/{examples → test/examples}/assets/image2.png +0 -0
- data/vendor/reveal.js/{examples → test/examples}/barebones.html +2 -3
- data/vendor/reveal.js/{examples → test/examples}/embedded-media.html +4 -4
- data/vendor/reveal.js/{examples → test/examples}/math.html +6 -6
- data/vendor/reveal.js/{examples → test/examples}/slide-backgrounds.html +26 -5
- data/vendor/reveal.js/test/qunit-1.12.0.css +244 -0
- data/vendor/reveal.js/test/qunit-1.12.0.js +2212 -0
- data/vendor/reveal.js/test/test-markdown-element-attributes.html +134 -0
- data/vendor/reveal.js/test/test-markdown-element-attributes.js +46 -0
- data/vendor/reveal.js/test/test-markdown-slide-attributes.html +128 -0
- data/vendor/reveal.js/test/test-markdown-slide-attributes.js +47 -0
- data/vendor/reveal.js/test/test-markdown.html +52 -0
- data/vendor/reveal.js/test/test-markdown.js +15 -0
- data/vendor/reveal.js/test/test.html +81 -0
- data/vendor/reveal.js/test/test.js +438 -0
- metadata +58 -45
@@ -1,220 +1,392 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
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
|
-
|
107
|
-
content: content,
|
108
|
-
asideContent: asideContent || ""
|
109
|
-
};
|
110
|
+
options = getSlidifyOptions( options );
|
110
111
|
|
111
|
-
|
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
|
-
|
120
|
-
|
121
|
-
|
114
|
+
if( notesMatch.length === 2 ) {
|
115
|
+
content = notesMatch[0] + '<aside class="notes" data-markdown>' + notesMatch[1].trim() + '</aside>';
|
116
|
+
}
|
122
117
|
|
123
|
-
|
124
|
-
(wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1]).push(markdown.substring(lastIndex));
|
118
|
+
return '<script type="text/template">' + content + '</script>';
|
125
119
|
|
126
|
-
|
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
|
-
|
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
|
-
|
128
|
+
options = getSlidifyOptions( options );
|
142
129
|
|
143
|
-
|
144
|
-
|
130
|
+
var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
|
131
|
+
horizontalSeparatorRegex = new RegExp( options.separator );
|
145
132
|
|
146
|
-
|
133
|
+
var matches,
|
134
|
+
lastIndex = 0,
|
135
|
+
isHorizontal,
|
136
|
+
wasHorizontal = true,
|
137
|
+
content,
|
138
|
+
sectionStack = [];
|
147
139
|
|
148
|
-
|
140
|
+
// iterate until all blocks between separators are stacked up
|
141
|
+
while( matches = separatorRegex.exec( markdown ) ) {
|
142
|
+
notes = null;
|
149
143
|
|
150
|
-
|
144
|
+
// determine direction (horizontal by default)
|
145
|
+
isHorizontal = horizontalSeparatorRegex.test( matches[0] );
|
151
146
|
|
152
|
-
|
153
|
-
|
147
|
+
if( !isHorizontal && wasHorizontal ) {
|
148
|
+
// create vertical stack
|
149
|
+
sectionStack.push( [] );
|
150
|
+
}
|
154
151
|
|
155
|
-
|
156
|
-
|
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
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
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
|
-
|
174
|
-
|
175
|
-
|
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
|
-
|
168
|
+
// add the remaining slide
|
169
|
+
( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );
|
181
170
|
|
182
|
-
|
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
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
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
|
-
//
|
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="'+
|
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="'+
|
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
|