diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config.js | 2 | ||||
-rw-r--r-- | lib/response.js | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/lib/config.js b/lib/config.js index 1f824d0a..9f11c5b5 100644 --- a/lib/config.js +++ b/lib/config.js @@ -38,7 +38,7 @@ var indexpath = config.indexpath || './public/views/index.ejs'; var hackmdpath = config.hackmdpath || './public/views/hackmd.ejs'; var errorpath = config.errorpath || './public/views/error.ejs'; var prettypath = config.prettypath || './public/views/pretty.ejs'; -var slidepath = config.slidepath || './public/views/slide.hbs'; +var slidepath = config.slidepath || './public/views/slide.ejs'; // session var sessionname = config.sessionname || 'connect.sid'; diff --git a/lib/response.js b/lib/response.js index 062bc5db..873dfe4e 100644 --- a/lib/response.js +++ b/lib/response.js @@ -18,7 +18,6 @@ var models = require("./models"); //slides var md = require('reveal.js/plugin/markdown/markdown'); -var Mustache = require('mustache'); //reveal.js var opts = { @@ -244,7 +243,6 @@ function showPublishNote(req, res, next) { function renderPublish(data, res) { var template = config.prettypath; var options = { - url: config.serverurl, cache: !config.debug, filename: template }; @@ -512,14 +510,27 @@ function showPublishSlide(req, res, next) { var render = function (res, title, markdown) { var slides = md.slidify(markdown, opts); - res.end(Mustache.to_html(opts.template, { + var template = config.slidepath; + var options = { + cache: !config.debug, + filename: template + }; + var compiled = ejs.compile(fs.readFileSync(template, 'utf8'), options); + var html = compiled({ url: config.serverurl, title: title, theme: opts.theme, highlightTheme: opts.highlightTheme, slides: slides, options: JSON.stringify(opts.revealOptions, null, 2) - })); + }); + var buf = html; + res.writeHead(200, { + 'Content-Type': 'text/html; charset=UTF-8', + 'Cache-Control': 'private', + 'Content-Length': buf.length + }); + res.end(buf); }; module.exports = response; |