mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 09:05:14 -07:00
3.1.1
This commit is contained in:
Vendored
+22
-9
@@ -2391,14 +2391,21 @@ module.exports = function (liquid) {
|
||||
var Liquid = require('..');
|
||||
var lexical = Liquid.lexical;
|
||||
var withRE = new RegExp('with\\s+(' + lexical.value.source + ')');
|
||||
var staticFileRE = /\S+/;
|
||||
var assert = require('../src/util/assert.js');
|
||||
|
||||
module.exports = function (liquid) {
|
||||
liquid.registerTag('include', {
|
||||
parse: function parse(token) {
|
||||
var match = lexical.value.exec(token.args);
|
||||
assert(match, 'illegal token ' + token.raw);
|
||||
var match = staticFileRE.exec(token.args);
|
||||
if (match) {
|
||||
this.staticValue = match[0];
|
||||
}
|
||||
|
||||
match = lexical.value.exec(token.args);
|
||||
if (match) {
|
||||
this.value = match[0];
|
||||
}
|
||||
|
||||
match = withRE.exec(token.args);
|
||||
if (match) {
|
||||
@@ -2406,10 +2413,8 @@ module.exports = function (liquid) {
|
||||
}
|
||||
},
|
||||
render: function render(scope, hash) {
|
||||
var filepath = this.value;
|
||||
if (scope.opts.dynamicPartials) {
|
||||
filepath = Liquid.evalValue(this.value, scope);
|
||||
}
|
||||
var filepath = scope.opts.dynamicPartials ? Liquid.evalValue(this.value, scope) : this.staticValue;
|
||||
assert(filepath, 'cannot include with empty filename');
|
||||
|
||||
var originBlocks = scope.opts.blocks;
|
||||
var originBlockMode = scope.opts.blockMode;
|
||||
@@ -2481,6 +2486,7 @@ var Liquid = require('..');
|
||||
var Promise = require('any-promise');
|
||||
var lexical = Liquid.lexical;
|
||||
var assert = require('../src/util/assert.js');
|
||||
var staticFileRE = /\S+/;
|
||||
|
||||
/*
|
||||
* blockMode:
|
||||
@@ -2491,14 +2497,21 @@ var assert = require('../src/util/assert.js');
|
||||
module.exports = function (liquid) {
|
||||
liquid.registerTag('layout', {
|
||||
parse: function parse(token, remainTokens) {
|
||||
var match = lexical.value.exec(token.args);
|
||||
assert(match, 'illegal token ' + token.raw);
|
||||
var match = staticFileRE.exec(token.args);
|
||||
if (match) {
|
||||
this.staticLayout = match[0];
|
||||
}
|
||||
|
||||
match = lexical.value.exec(token.args);
|
||||
if (match) {
|
||||
this.layout = match[0];
|
||||
}
|
||||
|
||||
this.tpls = liquid.parser.parse(remainTokens);
|
||||
},
|
||||
render: function render(scope, hash) {
|
||||
var layout = scope.opts.dynamicPartials ? Liquid.evalValue(this.layout, scope) : this.layout;
|
||||
var layout = scope.opts.dynamicPartials ? Liquid.evalValue(this.layout, scope) : this.staticLayout;
|
||||
assert(layout, 'cannot apply layout with empty filename');
|
||||
|
||||
// render the remaining tokens immediately
|
||||
scope.opts.blockMode = 'store';
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "liquidjs",
|
||||
"version": "3.1.0",
|
||||
"version": "3.1.1",
|
||||
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user