UNPKG

liquid-node

Version:

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

47 lines (35 loc) 1.39 kB
// Generated by CoffeeScript 1.10.0 (function() { var Capture, 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 = Capture = (function(superClass) { var Syntax, SyntaxHelp; extend(Capture, superClass); Syntax = /(\w+)/; SyntaxHelp = "Syntax Error in 'capture' - Valid syntax: capture [var]"; function Capture(template, tagName, markup) { var match; match = Syntax.exec(markup); if (match) { this.to = match[1]; } else { throw new Liquid.SyntaxError(SyntaxHelp); } Capture.__super__.constructor.apply(this, arguments); } Capture.prototype.render = function(context) { return Capture.__super__.render.apply(this, arguments).then((function(_this) { return function(chunks) { var output; output = Liquid.Helpers.toFlatString(chunks); context.lastScope()[_this.to] = output; return ""; }; })(this)); }; return Capture; })(Liquid.Block); }).call(this); //# sourceMappingURL=capture.js.map