@@ -20,19 +20,19 @@ var Note = require("./note.js");
2020var md = require ( 'reveal.js/plugin/markdown/markdown' ) ;
2121var Mustache = require ( 'mustache' ) ;
2222
23+ //reveal.js
2324var opts = {
2425 userBasePath : process . cwd ( ) ,
2526 revealBasePath : path . resolve ( require . resolve ( 'reveal.js' ) , '..' , '..' ) ,
26- template : fs . readFileSync ( path . join ( '.' , 'templates' , 'reveal.html' ) ) . toString ( ) ,
27- templateListing : fs . readFileSync ( path . join ( '.' , 'templates' , 'listing.html' ) ) . toString ( ) ,
28- theme : 'css/theme/league .css' ,
27+ template : fs . readFileSync ( path . join ( '.' , '/public/views/ templates' , 'reveal.html' ) ) . toString ( ) ,
28+ templateListing : fs . readFileSync ( path . join ( '.' , '/public/views/ templates' , 'listing.html' ) ) . toString ( ) ,
29+ theme : 'css/theme/black .css' ,
2930 highlightTheme : 'zenburn' ,
3031 separator : '^(\r\n?|\n)---(\r\n?|\n)$' ,
3132 verticalSeparator : '^(\r\n?|\n)----(\r\n?|\n)$' ,
3233 revealOptions : { }
3334} ;
3435
35-
3636//public
3737var response = {
3838 errorForbidden : function ( res ) {
@@ -52,7 +52,7 @@ var response = {
5252 showNote : showNote ,
5353 showPublishNote : showPublishNote ,
5454 showPublishSlide : showPublishSlide ,
55- showIndex : showIndex ,
55+ showIndex : showIndex ,
5656 noteActions : noteActions ,
5757 publishNoteActions : publishNoteActions
5858} ;
@@ -361,46 +361,46 @@ function noteActions(req, res, next) {
361361 }
362362 var action = req . params . action ;
363363 switch ( action ) {
364- case "publish" :
365- case "pretty" : //pretty deprecated
366- actionPublish ( req , res , noteId ) ;
367- break ;
368- case "slide" :
369- actionSlide ( req , res , noteId ) ;
370- break ;
371- case "download" :
372- actionDownload ( req , res , noteId ) ;
373- break ;
374- case "pdf" :
375- actionPDF ( req , res , noteId ) ;
376- break ;
377- default :
378- if ( noteId != config . featuresnotename )
379- res . redirect ( '/' + LZString . compressToBase64 ( noteId ) ) ;
380- else
381- res . redirect ( '/' + noteId ) ;
382- break ;
364+ case "publish" :
365+ case "pretty" : //pretty deprecated
366+ actionPublish ( req , res , noteId ) ;
367+ break ;
368+ case "slide" :
369+ actionSlide ( req , res , noteId ) ;
370+ break ;
371+ case "download" :
372+ actionDownload ( req , res , noteId ) ;
373+ break ;
374+ case "pdf" :
375+ actionPDF ( req , res , noteId ) ;
376+ break ;
377+ default :
378+ if ( noteId != config . featuresnotename )
379+ res . redirect ( '/' + LZString . compressToBase64 ( noteId ) ) ;
380+ else
381+ res . redirect ( '/' + noteId ) ;
382+ break ;
383383 }
384384}
385385
386386function publishNoteActions ( req , res , next ) {
387387 var action = req . params . action ;
388388 switch ( action ) {
389- case "edit" :
390- var shortid = req . params . shortid ;
391- if ( shortId . isValid ( shortid ) ) {
392- Note . findNote ( shortid , function ( err , note ) {
393- if ( err || ! note ) {
394- responseError ( res , "404" , "Not Found" , "oops." ) ;
395- return ;
396- }
397- if ( note . id != config . featuresnotename )
398- res . redirect ( '/' + LZString . compressToBase64 ( note . id ) ) ;
399- else
400- res . redirect ( '/' + note . id ) ;
401- } ) ;
402- }
403- break ;
389+ case "edit" :
390+ var shortid = req . params . shortid ;
391+ if ( shortId . isValid ( shortid ) ) {
392+ Note . findNote ( shortid , function ( err , note ) {
393+ if ( err || ! note ) {
394+ responseError ( res , "404" , "Not Found" , "oops." ) ;
395+ return ;
396+ }
397+ if ( note . id != config . featuresnotename )
398+ res . redirect ( '/' + LZString . compressToBase64 ( note . id ) ) ;
399+ else
400+ res . redirect ( '/' + note . id ) ;
401+ } ) ;
402+ }
403+ break ;
404404 }
405405}
406406
@@ -426,23 +426,25 @@ function showPublishSlide(req, res, next) {
426426 }
427427 var body = LZString . decompressFromBase64 ( data . rows [ 0 ] . content ) ;
428428 var text = S ( body ) . escapeHTML ( ) . s ;
429- render ( res , text ) ;
429+ render ( res , text ) ;
430430 } ) ;
431431 } ) ;
432432 } ) ;
433433 } else {
434434 responseError ( res , "404" , "Not Found" , "oops." ) ;
435435 }
436436}
437- var render = function ( res , markdown ) {
438- var slides = md . slidify ( markdown , opts ) ;
439437
440- res . end ( Mustache . to_html ( opts . template , {
441- theme : opts . theme ,
442- highlightTheme : opts . highlighTheme ,
443- slides : slides ,
444- options : JSON . stringify ( opts . revealOptions , null , 2 )
445- } ) ) ;
438+ //reveal.js render
439+ var render = function ( res , markdown ) {
440+ var slides = md . slidify ( markdown , opts ) ;
441+
442+ res . end ( Mustache . to_html ( opts . template , {
443+ theme : opts . theme ,
444+ highlightTheme : opts . highlightTheme ,
445+ slides : slides ,
446+ options : JSON . stringify ( opts . revealOptions , null , 2 )
447+ } ) ) ;
446448} ;
447449
448450
0 commit comments