This commit is contained in:
harttle
2017-10-21 10:50:44 +08:00
parent 118624ca7d
commit d42e01acaa
4 changed files with 94 additions and 97 deletions
+8 -11
View File
@@ -2092,7 +2092,9 @@ module.exports = function (liquid) {
if (_.isString(collection) && collection.length > 0) {
collection = [collection];
} else if (_.isObject(collection)) {
collection = Object.keys(collection);
collection = Object.keys(collection).map(function (key) {
return [key, collection[key]];
});
}
}
if (!Array.isArray(collection) || !collection.length) {
@@ -2210,7 +2212,6 @@ var withRE = new RegExp('with\\s+(' + lexical.value.source + ')');
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);
@@ -2296,7 +2297,6 @@ var lexical = Liquid.lexical;
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);
@@ -2314,18 +2314,16 @@ module.exports = function (liquid) {
// now register.blocks contains rendered blocks
.then(function () {
return liquid.getTemplate(layout, register.root);
})
}).then(function (templates) {
// push the hash
.then(function (templates) {
return scope.push(hash), templates;
})
scope.push(hash);
// render the parent
.then(function (templates) {
return liquid.renderer.renderTemplates(templates, scope);
})
// pop the hash
.then(function (partial) {
return scope.pop(), partial;
scope.pop();
return partial;
});
}
});
@@ -2358,9 +2356,8 @@ module.exports = function (liquid) {
register.blocks[_this2.block] = partial;
return partial;
});
}
} else {
// if already defined by desendents
else {
register.blocks[this.block] = html;
return Promise.resolve(html);
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "liquidjs",
"version": "1.9.6",
"version": "1.9.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "liquidjs",
"version": "1.9.6",
"version": "1.9.7",
"description": "A Liquid template engine for Node.js and browsers, with all shopify/liquid features.",
"main": "index.js",
"scripts": {