Update to support slideOptions in the YAML metadata

This commit is contained in:
Wu Cheng-Han 2016-08-01 00:08:22 +08:00
parent 7ea56c78a2
commit b367e110b6
4 changed files with 9 additions and 1 deletions

View File

@ -237,6 +237,8 @@ module.exports = function (sequelize, DataTypes) {
_meta.robots = meta.robots; _meta.robots = meta.robots;
if (meta.GA && (typeof meta.GA == "string" || typeof meta.GA == "number")) if (meta.GA && (typeof meta.GA == "string" || typeof meta.GA == "number"))
_meta.GA = meta.GA; _meta.GA = meta.GA;
if (meta.slideOptions && (typeof meta.slideOptions == "object"))
_meta.slideOptions = meta.slideOptions;
} }
return _meta; return _meta;
} }

View File

@ -555,6 +555,7 @@ function showPublishSlide(req, res, next) {
title: title, title: title,
description: meta.description, description: meta.description,
slides: slides, slides: slides,
slideOptions: JSON.stringify(meta.slideOptions || {}),
GA: meta.GA, GA: meta.GA,
useCDN: config.usecdn useCDN: config.usecdn
}; };

View File

@ -44,10 +44,13 @@ var defaultOptions = {
dependencies: deps dependencies: deps
}; };
// options from yaml meta
var options = JSON.parse($("#options").text());
// options from URL query string // options from URL query string
var queryOptions = Reveal.getQueryHash() || {}; var queryOptions = Reveal.getQueryHash() || {};
var options = extend(defaultOptions, queryOptions); var options = extend(defaultOptions, options, queryOptions);
Reveal.initialize(options); Reveal.initialize(options);
viewAjaxCallback = function () { viewAjaxCallback = function () {

View File

@ -50,6 +50,8 @@
<div class="slides"><%- slides %></div> <div class="slides"><%- slides %></div>
</div> </div>
<div id="options" class="hidden"><%- slideOptions %></div>
<script type="text/x-mathjax-config"> <script type="text/x-mathjax-config">
MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }}); MathJax.Hub.Config({ messageStyle: "none", skipStartupTypeset: true ,tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']], processEscapes: true }});
</script> </script>