swig
Version:
A simple, powerful, and extendable templating engine for node.js and browsers, similar to Django, Jinja2, and Twig.
26 lines (23 loc) • 744 B
JavaScript
/**
* Defines a block in a template that can be overridden by a template extending this one and/or will override the current template's parent template block of the same name.
*
* See <a href="#inheritance">Template Inheritance</a> for more information.
*
* @alias block
*
* @example
* {% block body %}...{% endblock %}
*
* @param {literal} name Name of the block for use in parent and extended templates.
*/
exports.compile = function (compiler, args, content, parents, options) {
return compiler(content, parents, options, args.join(''));
};
exports.parse = function (str, line, parser) {
parser.on('*', function (token) {
this.out.push(token.match);
});
return true;
};
exports.ends = true;
exports.block = true;