/new page implemented
This commit is contained in:
+8
-3
@@ -1,10 +1,15 @@
|
||||
var marked = require("marked");
|
||||
var fs = require("fs");
|
||||
|
||||
var template = fs.readFileSync("resources/template.html", "utf-8");
|
||||
var buildHTML = (id, title, content) => template
|
||||
var pageTemplate = fs.readFileSync("resources/template.html", "utf-8");
|
||||
var newNoteTemplate = fs.readFileSync("resources/new.html", "utf-8");
|
||||
var buildPage = (id, title, content) => pageTemplate
|
||||
.replace("%TITLE%", title)
|
||||
.replace(/%LINK%/g, id)
|
||||
.replace("%CONTENT%", content);
|
||||
|
||||
module.exports.build = note => buildHTML(note.id, note.title, marked(note.text));
|
||||
module.exports.buildNote = note => buildPage(note.id, note.title, marked(note.text));
|
||||
|
||||
module.exports.newNotePage = session => newNoteTemplate
|
||||
.replace("%METHOD%", "POST")
|
||||
.replace("%SESSION%", session);
|
||||
|
||||
Reference in New Issue
Block a user