From fddb5012d49353ca62b7e504952a6315c64d641d Mon Sep 17 00:00:00 2001 From: Aiko Mastboom Date: Mon, 22 Apr 2013 16:07:19 +0200 Subject: [PATCH] add preview button --- README.md | 7 ++++--- preview.js | 5 +++-- public/index.html | 27 +++++++++++++++++++++++++++ responder.js | 3 ++- routes.js | 15 ++++++++++++--- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 12c3c50..6eb214d 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,16 @@ Change the mongo url to your mongodb npm start - http://localhost:8000/index.html +[/index.html](http://localhost:8000/index.html) Import content defined in index.html into db: - http://localhost:8000/importer/index.html +[/importer/index.html](http://localhost:8000/importer/index.html) + Dogfood viewing of index.html from db: - http://localhost:8000/page/app/main.index.html +[/page/app/main.index.html](http://localhost:8000/page/app/main.index.html) # Features: diff --git a/preview.js b/preview.js index 87319a3..123b510 100644 --- a/preview.js +++ b/preview.js @@ -174,13 +174,14 @@ module.exports = function (config, mongoDataInstance) { var attribute = { collection: parts[1], name: parts[2], - attribute: parts[3] + attribute: parts[3], + query: { name: parts[2] } }; return mongoDataInstance.getMongoAttribute(attribute, function handleMarkdownContent(err, markdown_result) { if (err) { return callback(err); } - var html = markdown.toHTML(markdown_result[options.attribute]); + var html = markdown.toHTML(markdown_result[attribute.attribute]); return callback(null, { regExp: new RegExp(result, 'gmi'), value: html diff --git a/public/index.html b/public/index.html index 0041d12..c595b2e 100644 --- a/public/index.html +++ b/public/index.html @@ -55,6 +55,7 @@ +