diff options
author | hakimel <hakim.elhattab@gmail.com> | 2012-08-03 21:49:29 -0400 |
---|---|---|
committer | hakimel <hakim.elhattab@gmail.com> | 2012-08-03 21:50:06 -0400 |
commit | 9a657e26768a3724e6edf9e5fbdd72a4e54da8f4 (patch) | |
tree | fa2b1848adff80914ea4c4ca4039c3e198ded0f4 /lib/js | |
parent | 6bc92af17c3e08ae6deef43a625b5e9007199627 (diff) | |
download | fosdem-2018-presentation-9a657e26768a3724e6edf9e5fbdd72a4e54da8f4.tar fosdem-2018-presentation-9a657e26768a3724e6edf9e5fbdd72a4e54da8f4.tar.gz |
ie8 support (closes #96)
Diffstat (limited to 'lib/js')
-rw-r--r-- | lib/js/data-markdown.js | 34 | ||||
-rw-r--r-- | lib/js/html5shiv.js | 7 |
2 files changed, 25 insertions, 16 deletions
diff --git a/lib/js/data-markdown.js b/lib/js/data-markdown.js index 8972475..b10592a 100644 --- a/lib/js/data-markdown.js +++ b/lib/js/data-markdown.js @@ -2,24 +2,26 @@ // Modified by Hakim to handle markdown indented with tabs (function(){ - [].forEach.call( document.querySelectorAll('[data-markdown]'), function fn(elem){ - - // strip leading whitespace so it isn't evaluated as code - var text = elem.innerHTML; - - var leadingWs = text.match(/^\n?(\s*)/)[1].length, - leadingTabs = text.match(/^\n?(\t*)/)[1].length; + var slides = document.querySelectorAll('[data-markdown]'); - if( leadingTabs > 0 ) { - text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); - } - else if( leadingWs > 1 ) { - text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); - } + for( var i = 0, len = slides.length; i < len; i++ ) { + var elem = slides[i]; + + // strip leading whitespace so it isn't evaluated as code + var text = elem.innerHTML; - // here, have sum HTML - elem.innerHTML = (new Showdown.converter()).makeHtml(text); + var leadingWs = text.match(/^\n?(\s*)/)[1].length, + leadingTabs = text.match(/^\n?(\t*)/)[1].length; - }); + if( leadingTabs > 0 ) { + text = text.replace( new RegExp('\\n?\\t{' + leadingTabs + '}','g'), '\n' ); + } + else if( leadingWs > 1 ) { + text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' ); + } + + // here, have sum HTML + elem.innerHTML = (new Showdown.converter()).makeHtml(text); + } })();
\ No newline at end of file diff --git a/lib/js/html5shiv.js b/lib/js/html5shiv.js new file mode 100644 index 0000000..50649b9 --- /dev/null +++ b/lib/js/html5shiv.js @@ -0,0 +1,7 @@ +document.createElement('header'); +document.createElement('nav'); +document.createElement('section'); +document.createElement('article'); +document.createElement('aside'); +document.createElement('footer'); +document.createElement('hgroup');
\ No newline at end of file |