Updated slide mode

This commit is contained in:
Wu Cheng-Han 2015-12-18 09:40:52 -06:00
parent 54b33f181f
commit 031c96c72d
6 changed files with 42 additions and 22 deletions

View file

@ -24,8 +24,8 @@ var Mustache = require('mustache');
var opts = {
userBasePath: process.cwd(),
revealBasePath: path.resolve(require.resolve('reveal.js'), '..', '..'),
template: fs.readFileSync(path.join('.', '/public/views/templates', 'reveal.html')).toString(),
templateListing: fs.readFileSync(path.join('.', '/public/views/templates', 'listing.html')).toString(),
template: fs.readFileSync(path.join('.', '/public/views/slide', 'reveal.hbs')).toString(),
templateListing: fs.readFileSync(path.join('.', '/public/views/slide', 'listing.hbs')).toString(),
theme: 'css/theme/black.css',
highlightTheme: 'zenburn',
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
@ -404,7 +404,6 @@ function publishNoteActions(req, res, next) {
}
}
function showPublishSlide(req, res, next) {
var shortid = req.params.shortid;
if (shortId.isValid(shortid)) {
@ -425,8 +424,12 @@ function showPublishSlide(req, res, next) {
return;
}
var body = LZString.decompressFromBase64(data.rows[0].content);
var title = data.rows[0].title;
var decodedTitle = LZString.decompressFromBase64(title);
if (decodedTitle) title = decodedTitle;
title = Note.generateWebTitle(title);
var text = S(body).escapeHTML().s;
render(res, text);
render(res, title, text);
});
});
});
@ -436,10 +439,11 @@ function showPublishSlide(req, res, next) {
}
//reveal.js render
var render = function (res, markdown) {
var render = function (res, title, markdown) {
var slides = md.slidify(markdown, opts);
res.end(Mustache.to_html(opts.template, {
title: title,
theme: opts.theme,
highlightTheme: opts.highlightTheme,
slides: slides,