Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added plain view engine

  • Loading branch information...
commit b1885bf1ee97ea227859815cac77fcde9848e6a7 1 parent d55e828
Ernesto Méndez mendezcode authored
Showing with 40 additions and 0 deletions.
  1. +40 −0 engines/plain.js
40 engines/plain.js
View
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.