mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
5.1.0
This commit is contained in:
Vendored
+22
-8
@@ -2307,18 +2307,32 @@ module.exports = function (liquid) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
render: function render(scope, hash) {
|
render: function render(scope, hash) {
|
||||||
var filepath = scope.opts.dynamicPartials ? Liquid.evalValue(this.value, scope) : this.staticValue;
|
var _this = this;
|
||||||
assert(filepath, 'cannot include with empty filename');
|
|
||||||
|
var pFilepath = void 0;
|
||||||
|
if (scope.opts.dynamicPartials) {
|
||||||
|
if (lexical.quotedLine.exec(this.value)) {
|
||||||
|
var template = this.value.slice(1, -1);
|
||||||
|
pFilepath = liquid.parseAndRender(template, scope.getAll(), scope.opts);
|
||||||
|
} else {
|
||||||
|
pFilepath = Promise.resolve(Liquid.evalValue(this.value, scope));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pFilepath = Promise.resolve(this.staticValue);
|
||||||
|
}
|
||||||
|
|
||||||
var originBlocks = scope.opts.blocks;
|
var originBlocks = scope.opts.blocks;
|
||||||
var originBlockMode = scope.opts.blockMode;
|
var originBlockMode = scope.opts.blockMode;
|
||||||
scope.opts.blocks = {};
|
|
||||||
scope.opts.blockMode = 'output';
|
|
||||||
|
|
||||||
if (this.with) {
|
return pFilepath.then(function (filepath) {
|
||||||
hash[filepath] = Liquid.evalValue(this.with, scope);
|
assert(filepath, 'cannot include with empty filename');
|
||||||
}
|
scope.opts.blocks = {};
|
||||||
return liquid.getTemplate(filepath, scope.opts.root).then(function (templates) {
|
scope.opts.blockMode = 'output';
|
||||||
|
if (_this.with) {
|
||||||
|
hash[filepath] = Liquid.evalValue(_this.with, scope);
|
||||||
|
}
|
||||||
|
return liquid.getTemplate(filepath, scope.opts.root);
|
||||||
|
}).then(function (templates) {
|
||||||
scope.push(hash);
|
scope.push(hash);
|
||||||
return liquid.renderer.renderTemplates(templates, scope);
|
return liquid.renderer.renderTemplates(templates, scope);
|
||||||
}).then(function (html) {
|
}).then(function (html) {
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liquidjs",
|
"name": "liquidjs",
|
||||||
"version": "5.0.2",
|
"version": "5.1.0",
|
||||||
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user