Permalink
Browse files

Add default parsers and templates

  • Loading branch information...
1 parent 77350ff commit 9ed9bf98859130cc02cbb40afb99401d0b9cb48d @pvorb committed Dec 24, 2011
Showing with 46 additions and 1 deletion.
  1. +18 −0 test/.tpl/parsers/props-markdown.js
  2. +12 −0 test/.tpl/templates/default.ejs
  3. +11 −0 test/.tpl/templates/ejs.js
  4. +5 −1 test/data/test.mkd
@@ -0,0 +1,18 @@
+;(function() {
+var fs = require('fs');
+var props = require('props');
+var marked = require('marked');
+
+// parse the file and return it's contents
+module.exports = function parser(file) {
+ var content = fs.readFileSync(file, 'utf8');
+
+ // parse content
+ var doc = props(content);
+ // markdown -> HTML
+ doc.__content = marked(doc.__content);
+
+ return doc;
+};
+
+}).call(this);
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title><%= title %></title>
+ </head>
+ <body>
+ <h1><%= title %></h1>
+ <p class="date"><%= date.getFullYear() %>-<%= date.getMonth()+1 %>-<%= date.getDate() %></p>
+ <%- __content %>
+ </body>
+</html>
View
@@ -0,0 +1,11 @@
+;(function() {
+
+var fs = require('fs');
+var ejs = require('ejs');
+
+module.exports = function tplEngine(file, data) {
+ var tpl = fs.readFileSync(file, 'utf8');
+ return ejs.render(tpl, data);
+};
+
+}).call(this);
View
@@ -1 +1,5 @@
-**test**
+title: Test
+date: 2011-12-24
+
+
+This is a _simple_ Test.

0 comments on commit 9ed9bf9

Please sign in to comment.