Updated and merge reveal.js to use bower

This commit is contained in:
Wu Cheng-Han 2015-11-29 01:04:20 -06:00
parent baed9eb33d
commit b070de8fa9
77 changed files with 123 additions and 14199 deletions

View file

@ -20,19 +20,19 @@ var Note = require("./note.js");
var md = require('reveal.js/plugin/markdown/markdown');
var Mustache = require('mustache');
//reveal.js
var opts = {
userBasePath: process.cwd(),
revealBasePath: path.resolve(require.resolve('reveal.js'), '..', '..'),
template: fs.readFileSync(path.join('.', 'templates', 'reveal.html')).toString(),
templateListing: fs.readFileSync(path.join('.', 'templates', 'listing.html')).toString(),
theme: 'css/theme/league.css',
template: fs.readFileSync(path.join('.', '/public/views/templates', 'reveal.html')).toString(),
templateListing: fs.readFileSync(path.join('.', '/public/views/templates', 'listing.html')).toString(),
theme: 'css/theme/black.css',
highlightTheme: 'zenburn',
separator: '^(\r\n?|\n)---(\r\n?|\n)$',
verticalSeparator: '^(\r\n?|\n)----(\r\n?|\n)$',
revealOptions: {}
};
//public
var response = {
errorForbidden: function (res) {
@ -52,7 +52,7 @@ var response = {
showNote: showNote,
showPublishNote: showPublishNote,
showPublishSlide: showPublishSlide,
showIndex: showIndex,
showIndex: showIndex,
noteActions: noteActions,
publishNoteActions: publishNoteActions
};
@ -361,46 +361,46 @@ function noteActions(req, res, next) {
}
var action = req.params.action;
switch (action) {
case "publish":
case "pretty": //pretty deprecated
actionPublish(req, res, noteId);
break;
case "slide":
actionSlide(req, res, noteId);
break;
case "download":
actionDownload(req, res, noteId);
break;
case "pdf":
actionPDF(req, res, noteId);
break;
default:
if (noteId != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(noteId));
else
res.redirect('/' + noteId);
break;
case "publish":
case "pretty": //pretty deprecated
actionPublish(req, res, noteId);
break;
case "slide":
actionSlide(req, res, noteId);
break;
case "download":
actionDownload(req, res, noteId);
break;
case "pdf":
actionPDF(req, res, noteId);
break;
default:
if (noteId != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(noteId));
else
res.redirect('/' + noteId);
break;
}
}
function publishNoteActions(req, res, next) {
var action = req.params.action;
switch (action) {
case "edit":
var shortid = req.params.shortid;
if (shortId.isValid(shortid)) {
Note.findNote(shortid, function (err, note) {
if (err || !note) {
responseError(res, "404", "Not Found", "oops.");
return;
}
if (note.id != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(note.id));
else
res.redirect('/' + note.id);
});
}
break;
case "edit":
var shortid = req.params.shortid;
if (shortId.isValid(shortid)) {
Note.findNote(shortid, function (err, note) {
if (err || !note) {
responseError(res, "404", "Not Found", "oops.");
return;
}
if (note.id != config.featuresnotename)
res.redirect('/' + LZString.compressToBase64(note.id));
else
res.redirect('/' + note.id);
});
}
break;
}
}
@ -426,7 +426,7 @@ function showPublishSlide(req, res, next) {
}
var body = LZString.decompressFromBase64(data.rows[0].content);
var text = S(body).escapeHTML().s;
render(res, text);
render(res, text);
});
});
});
@ -434,15 +434,17 @@ function showPublishSlide(req, res, next) {
responseError(res, "404", "Not Found", "oops.");
}
}
var render = function(res, markdown) {
var slides = md.slidify(markdown, opts);
res.end(Mustache.to_html(opts.template, {
theme: opts.theme,
highlightTheme: opts.highlighTheme,
slides: slides,
options: JSON.stringify(opts.revealOptions, null, 2)
}));
//reveal.js render
var render = function (res, markdown) {
var slides = md.slidify(markdown, opts);
res.end(Mustache.to_html(opts.template, {
theme: opts.theme,
highlightTheme: opts.highlightTheme,
slides: slides,
options: JSON.stringify(opts.revealOptions, null, 2)
}));
};