UNPKG

liquid-node

Version:

Node.js port of Tobias Lütke's Liquid template engine.

41 lines (29 loc) 1.31 kB
// Generated by CoffeeScript 1.10.0 (function() { var Assign, Liquid, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; Liquid = require("../../liquid"); module.exports = Assign = (function(superClass) { var Syntax, SyntaxHelp; extend(Assign, superClass); SyntaxHelp = "Syntax Error in 'assign' - Valid syntax: assign [var] = [source]"; Syntax = RegExp("((?:" + Liquid.VariableSignature.source + ")+)\\s*=\\s*(.*)\\s*"); function Assign(template, tagName, markup) { var match; if (match = Syntax.exec(markup)) { this.to = match[1]; this.from = new Liquid.Variable(match[2]); } else { throw new Liquid.SyntaxError(SyntaxHelp); } Assign.__super__.constructor.apply(this, arguments); } Assign.prototype.render = function(context) { context.lastScope()[this.to] = this.from.render(context); return Assign.__super__.render.call(this, context); }; return Assign; })(Liquid.Tag); }).call(this); //# sourceMappingURL=assign.js.map