Update slide mode, now respect all meta settings and update default styles

This commit is contained in:
Wu Cheng-Han 2016-08-14 15:02:05 +08:00
parent e08152ed03
commit be81ee22ec
4 changed files with 37 additions and 4 deletions

View file

@ -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
};

View file

@ -252,4 +252,15 @@ pre.mermaid > svg {
.reveal .slides > section,
.reveal .slides > section > section {
transform-style: flat;
}
}
.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;
}

View file

@ -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() || {};

View file

@ -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 }});