aboutsummaryrefslogtreecommitdiff
path: root/plugin/markdown
diff options
context:
space:
mode:
authorVonC <vonc@laposte.net>2013-11-06 11:06:03 +0100
committerVonC <vonc@laposte.net>2013-11-06 11:06:03 +0100
commit4b0fe47bb6cbbded27666ece92a28ba0af885b13 (patch)
tree5ed57b1d718e504ae68b1e568f82c06de6ea0cc6 /plugin/markdown
parentefbb31cf295e9abcaed7a117a81ccb1a7f38e56e (diff)
downloadfreenode-live-2017-presentation-4b0fe47bb6cbbded27666ece92a28ba0af885b13.tar
freenode-live-2017-presentation-4b0fe47bb6cbbded27666ece92a28ba0af885b13.tar.gz
Add slide attributes for single slide section case.
Diffstat (limited to 'plugin/markdown')
-rwxr-xr-xplugin/markdown/markdown.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index 00d2538..9564208 100755
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -283,9 +283,18 @@
}
else {
-
- section.innerHTML = createMarkdownSlide( getMarkdownFromSlide( section ) );
-
+ var content = getMarkdownFromSlide( section );
+ var slideAttributesSeparatorRegex = new RegExp( section.getAttribute( 'data-attributes' ) || DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR, 'm' );
+ var matchAttributes = slideAttributesSeparatorRegex.exec( content );
+ if ( matchAttributes ) {
+ var slideAttributes = matchAttributes[1];
+ content = content.replace( slideAttributesSeparatorRegex,"" );
+ var slideAttributesRegex = new RegExp( "([^\"= ]+?)=\"([^\"=]+?)\"", 'mg' );
+ while( matchesAttributes = slideAttributesRegex.exec( slideAttributes ) ) {
+ section.setAttribute( matchesAttributes[1], matchesAttributes[2] );
+ }
+ }
+ section.innerHTML = createMarkdownSlide( content );
}
}