Permalink
Browse files

Initial commit

  • Loading branch information...
pvorb committed Aug 27, 2011
0 parents commit 0d613b2b0b73f7172447d1b0a7cdb89ade8a022a
Showing with 85 additions and 0 deletions.
  1. +18 −0 LICENSE.mkd
  2. +2 −0 README.mkd
  3. +23 −0 package.json
  4. +42 −0 pie.js
@@ -0,0 +1,18 @@
+Copyright © 2011 Paul Vorbach <paul@vorb.de>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the “Software”), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
+**bake-blog** is a simple blogging engine for node that uses bake, mongodb and
+markdown.
@@ -0,0 +1,23 @@
+{
+ "author": "Paul Vorbach <paul@vorb.de> (http://vorb.de)",
+ "name": "pie",
+ "description": "simple blogging engine that uses bake, mongodb and markdown",
+ "version": "0.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/pvorb/node-pie.git"
+ },
+ "bugs": {
+ "web": "https://github.com/pvorb/node-pie/issues"
+ },
+ "main": "pie.js",
+ "engines": {
+ "node": ">=0.4.0"
+ },
+ "dependencies": {
+ "bake": ">=0.5.2",
+ "Index": ">=0.0.2",
+ "mongodb": ">=0.9.6-13",
+ "marked": ">=0.0.8"
+ }
+}
42 pie.js
@@ -0,0 +1,42 @@
+var bake = require("bake"),
+ Index = require("Index"),
+ mongodb = require("mongodb"),
+ marked = require("marked");
+
+// Main function
+var pie = function(conf) {
+
+ // later holds a reference to the Index object
+ var index;
+
+ // Intialize hooks.
+ var hooks = {};
+
+ // Parse contents with `marked()`
+ hooks.__content = function(fn, prop) {
+ return marked(prop.__content);
+ };
+
+ // Add files to index
+ hooks.__writeAfter = function(fn, prop) {
+ index.add(prop);
+ };
+
+ // Write indexes, feeds and tag pages
+ hooks.__complete = function(fn, prop) {
+ if (conf.indexes != undefined)
+ index.write(conf);
+ // if (conf.tags != undefined)
+ // index.writeTags(conf.tags);
+ };
+
+ new Index(conf.dbinf, function(i) {
+ // save ref to index
+ index = i;
+
+ // Bake the pie
+ bake(conf, hooks);
+ });
+};
+
+module.exports = pie;

0 comments on commit 0d613b2

Please sign in to comment.