Permalink
Browse files

Added plain view engine

  • Loading branch information...
1 parent d55e828 commit b1885bf1ee97ea227859815cac77fcde9848e6a7 @mendezcode mendezcode committed Sep 10, 2012
Showing with 40 additions and 0 deletions.
  1. +40 −0 engines/plain.js
View
40 engines/plain.js
@@ -0,0 +1,40 @@
+
+/**
+ @module engines
+ @namespace engine
+ */
+
+var app = protos.app,
+ util = require('util');
+
+/**
+ Plain engine class
+
+ @class Plain
+ @extends Engine
+ @constructor
+ @param {object} app Application Instance
+ */
+
+function Plain(app) {
+ this.app = app;
+ this.module = null;
+ this.multiPart = true;
+ this.extensions = ['txt', 'plain'];
+}
+
+util.inherits(Plain, protos.lib.engine);
+
+Plain.prototype.render = function(data) {
+ data = this.app.applyFilters('plain_template', data);
+ var func = this.getCachedFunction(arguments);
+ if (func === null) {
+ func = function() {
+ return data; // plain, just return data received
+ }
+ this.cacheFunction(func, arguments);
+ }
+ return this.evaluate(func, arguments);
+}
+
+module.exports = Plain;

0 comments on commit b1885bf

Please sign in to comment.