Skip to content

Commit

Permalink
tweaks for #1200
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Jul 7, 2015
1 parent 399d4f6 commit d44125d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions plugin/markdown/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';

var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';


/**
* Retrieves the markdown contents of a slide section
Expand All @@ -42,8 +44,10 @@

// strip leading whitespace so it isn't evaluated as code
var text = ( template || section ).textContent;
// restore script end tag
text = text.replace(/__SCRIPT_END__/g, '</script>');

// restore script end tags
text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '</script>' );

var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
leadingTabs = text.match( /^\n?(\t*)/ )[1].length;

Expand Down Expand Up @@ -115,8 +119,11 @@
if( notesMatch.length === 2 ) {
content = notesMatch[0] + '<aside class="notes" data-markdown>' + notesMatch[1].trim() + '</aside>';
}
//handle script end tag bug
content = content.replace(/<\/script>/g, '__SCRIPT_END__');

// prevent script end tags in the content from interfering
// with parsing
content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER );

return '<script type="text/template">' + content + '</script>';

}
Expand Down

0 comments on commit d44125d

Please sign in to comment.