From b5bf667c6e3674c79dadaab914fb877d3b4e86d4 Mon Sep 17 00:00:00 2001 From: Aiko Mastboom Date: Sun, 21 Apr 2013 12:19:33 +0200 Subject: [PATCH] updated documentation --- README.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 136 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 417101a..12c3c50 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,148 @@ +# Getting started. + npm install -change the mongo url to your mongodb +Change the mongo url to your mongodb npm start http://localhost:8000/index.html -import index.html into db: +Import content defined in index.html into db: http://localhost:8000/importer/index.html -dogfood viewing of index.html from db: +Dogfood viewing of index.html from db: http://localhost:8000/page/app/main.index.html + + +# Features: + +* Realtime, thru sharejs. +* Run and develop at the same time. +* Importing, driven by comment markers. +* Serverside templating, driven by comment markers. + + +# Examples: + +all functionality is found index.html + + +# Interface: + +## sharejs: + + // [type:collection:name] + var main_documentId = 'json:app:main' + sharejs.open( main_documentId, 'json', function (error, mainDoc) { + + // [type:collection:nameDoc.id:attribute] + var attribute_documentId = 'text:app:'+mainDoc._id + ':index'; + sharejs.open( attribute_documentId, 'text', function (error, attributeDoc) { + + // see https://github.com/josephg/ShareJS/wiki + } + } + +## http.get: + +Get an attribute and use apply the preview markers to its content. + + /page/[collection]/[main].[attribute].html + + +Get raw attribute content + + /content/[collection]/[name]/[attribute].(css|less|js|html) + /data/[collection]/[parent._id]/[attribute].(css|less|js|html) + +Get raw document content + + /content/[collection]/[name].json + /data/[collection]/[name._id].json + +Import content: + + /importer/[filename] + + +# Comment markers: + +## Importer: + +Content can be imported into the site using the /importer/[filename] interface. + +Filename is taken from /public folder by default. + +### Importing text into attributes: + + import__[collection]_[name]_[attribute]_ + _end_import__[collection]_[name]_[attribute] + +### Importing json into documents: + + import__[collection]_[name]_json_ + _end_import__[collection]_[name]_json + +moves content between marker into /collection/name/attribute + + +### Importing content of a file into an attribute: + + import_file__[filename]__into__[collection]_[name]_[attribute] + + +### Importing content of a file as data into a document: + + import_file__[filename]__into__[collection]_[name]_json + +read filename into /collection/name/attribute and processes import marker inside it. + + +## Previewer: + +when content is requested thru the /page/collection/name/attribute.html interface +the following markers are handled. + + + +### replace: + + [type]__[collection]_[name]_[attribute] + +Where type is: + +script -> + +