diff options
author | Wu Cheng-Han | 2016-08-14 15:02:05 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2016-08-14 15:02:05 +0800 |
commit | be81ee22ecc1af1db6d24a44109594d30461d8c9 (patch) | |
tree | fdf863eaab4a2fbc5ebf2608e04fe7dc535a5683 | |
parent | e08152ed03639cfa0592678840b4b8d0b98aa19b (diff) |
Update slide mode, now respect all meta settings and update default styles
-rw-r--r-- | lib/response.js | 2 | ||||
-rw-r--r-- | public/css/slide.css | 13 | ||||
-rw-r--r-- | public/js/slide.js | 24 | ||||
-rw-r--r-- | public/views/slide.ejs | 2 |
4 files changed, 37 insertions, 4 deletions
diff --git a/lib/response.js b/lib/response.js index 9df2ee9f..5c5798c8 100644 --- a/lib/response.js +++ b/lib/response.js @@ -555,7 +555,7 @@ function showPublishSlide(req, res, next) { title: title, description: meta.description, slides: slides, - slideOptions: JSON.stringify(meta.slideOptions || {}), + meta: JSON.stringify(obj.meta || {}), GA: meta.GA, useCDN: config.usecdn }; diff --git a/public/css/slide.css b/public/css/slide.css index 195981b3..40bb6ea1 100644 --- a/public/css/slide.css +++ b/public/css/slide.css @@ -252,4 +252,15 @@ pre.mermaid > svg { .reveal .slides > section, .reveal .slides > section > section { transform-style: flat; -}
\ No newline at end of file +} + +.reveal.rtl .slides, +.reveal.rtl .slides h1, +.reveal.rtl .slides h2, +.reveal.rtl .slides h3, +.reveal.rtl .slides h4, +.reveal.rtl .slides h5, +.reveal.rtl .slides h6 { + direction: rtl; + font-family: inherit; +} diff --git a/public/js/slide.js b/public/js/slide.js index 996610fb..fe3cb1e8 100644 --- a/public/js/slide.js +++ b/public/js/slide.js @@ -45,7 +45,29 @@ var defaultOptions = { }; // options from yaml meta -var options = JSON.parse($("#options").text()); +var meta = JSON.parse($("#meta").text()); +var options = meta.slideOptions || {}; + +var view = $('.reveal'); + +//text language +if (meta.lang && typeof meta.lang == "string") { + view.attr('lang', meta.lang); +} else { + view.removeAttr('lang'); +} +//text direction +if (meta.dir && typeof meta.dir == "string" && meta.dir == "rtl") { + options.rtl = true; +} else { + options.rtl = false; +} +//breaks +if (typeof meta.breaks === 'boolean' && !meta.breaks) { + md.options.breaks = false; +} else { + md.options.breaks = true; +} // options from URL query string var queryOptions = Reveal.getQueryHash() || {}; diff --git a/public/views/slide.ejs b/public/views/slide.ejs index 5817a200..8a8fbae0 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -50,7 +50,7 @@ <div class="slides"><%- slides %></div> </div> - <div id="options" class="hidden"><%- slideOptions %></div> + <div id="meta" style="display: none;"><%- meta %></div> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }}); |