mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-20 15:00:42 -07:00
3.0.0
This commit is contained in:
Vendored
+11
-11
@@ -279,10 +279,6 @@ var _engine = {
|
|||||||
return _this2.render(templates, ctx, opts);
|
return _this2.render(templates, ctx, opts);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
evalOutput: function evalOutput(str, scope) {
|
|
||||||
console.warn('[liquidjs:deprecated] use .evalValue() instead of .evalOutput');
|
|
||||||
return this.evalValue(str, scope);
|
|
||||||
},
|
|
||||||
evalValue: function evalValue(str, scope) {
|
evalValue: function evalValue(str, scope) {
|
||||||
var tpl = this.parser.parseValue(str.trim());
|
var tpl = this.parser.parseValue(str.trim());
|
||||||
return this.renderer.evalValue(tpl, scope);
|
return this.renderer.evalValue(tpl, scope);
|
||||||
@@ -933,9 +929,6 @@ var Scope = {
|
|||||||
return ctx;
|
return ctx;
|
||||||
},
|
},
|
||||||
get: function get(str) {
|
get: function get(str) {
|
||||||
if (str === 'liquid') {
|
|
||||||
throw new Error('NO LONGER SUPPORTED: use scope.opts instead of scope.get("liquid")');
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
return this.getPropertyByPath(this.scopes, str);
|
return this.getPropertyByPath(this.scopes, str);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1053,12 +1046,19 @@ function setPropertyByPath(obj, path, val) {
|
|||||||
var paths = (path + '').replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
var paths = (path + '').replace(/\[/g, '.').replace(/\]/g, '').split('.');
|
||||||
for (var i = 0; i < paths.length; i++) {
|
for (var i = 0; i < paths.length; i++) {
|
||||||
var key = paths[i];
|
var key = paths[i];
|
||||||
|
if (!_.isObject(obj)) {
|
||||||
|
// cannot set property of non-object
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// for end point
|
||||||
if (i === paths.length - 1) {
|
if (i === paths.length - 1) {
|
||||||
return obj[key] = val;
|
return obj[key] = val;
|
||||||
}
|
}
|
||||||
if (undefined === obj[key]) obj[key] = {};
|
// if path not exist
|
||||||
// case for readonly objects
|
if (undefined === obj[key]) {
|
||||||
obj = obj[key] || {};
|
obj[key] = {};
|
||||||
|
}
|
||||||
|
obj = obj[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1301,7 +1301,7 @@ function parse(input, file, options) {
|
|||||||
|
|
||||||
function parseHTMLToken(begin, end) {
|
function parseHTMLToken(begin, end) {
|
||||||
var htmlFragment = input.slice(begin, end);
|
var htmlFragment = input.slice(begin, end);
|
||||||
currIndent = _.last((htmlFragment || '').split('\n')).length;
|
currIndent = _.last(htmlFragment.split('\n')).length;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'html',
|
type: '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": "2.2.1",
|
"version": "3.0.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