Skip to content
This repository
Browse code

Added plain view engine

  • Loading branch information...
commit b1885bf1ee97ea227859815cac77fcde9848e6a7 1 parent d55e828
Ernesto Méndez mendezcode authored

Showing 1 changed file with 40 additions and 0 deletions. Show diff stats Hide diff stats

  1. +40 0 engines/plain.js
40 engines/plain.js
... ... @@ -0,0 +1,40 @@
  1 +
  2 +/**
  3 + @module engines
  4 + @namespace engine
  5 + */
  6 +
  7 +var app = protos.app,
  8 + util = require('util');
  9 +
  10 +/**
  11 + Plain engine class
  12 +
  13 + @class Plain
  14 + @extends Engine
  15 + @constructor
  16 + @param {object} app Application Instance
  17 + */
  18 +
  19 +function Plain(app) {
  20 + this.app = app;
  21 + this.module = null;
  22 + this.multiPart = true;
  23 + this.extensions = ['txt', 'plain'];
  24 +}
  25 +
  26 +util.inherits(Plain, protos.lib.engine);
  27 +
  28 +Plain.prototype.render = function(data) {
  29 + data = this.app.applyFilters('plain_template', data);
  30 + var func = this.getCachedFunction(arguments);
  31 + if (func === null) {
  32 + func = function() {
  33 + return data; // plain, just return data received
  34 + }
  35 + this.cacheFunction(func, arguments);
  36 + }
  37 + return this.evaluate(func, arguments);
  38 +}
  39 +
  40 +module.exports = Plain;

0 comments on commit b1885bf

Please sign in to comment.
Something went wrong with that request. Please try again.