mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
refactor: pop the same context as the pushed one
This commit is contained in:
+1
-1
@@ -42,7 +42,7 @@ module.exports = function (liquid) {
|
||||
return liquid.renderer.renderTemplates(templates, scope)
|
||||
})
|
||||
.then((html) => {
|
||||
scope.pop()
|
||||
scope.pop(hash)
|
||||
scope.opts.blocks = originBlocks
|
||||
scope.opts.blockMode = originBlockMode
|
||||
return html
|
||||
|
||||
+1
-3
@@ -38,14 +38,12 @@ module.exports = function (liquid) {
|
||||
return liquid.getTemplate(layout, scope.opts.root)
|
||||
})
|
||||
.then(templates => {
|
||||
// push the hash
|
||||
scope.push(hash)
|
||||
scope.opts.blockMode = 'output'
|
||||
return liquid.renderer.renderTemplates(templates, scope)
|
||||
})
|
||||
// pop the hash
|
||||
.then(partial => {
|
||||
scope.pop()
|
||||
scope.pop(hash)
|
||||
return partial
|
||||
})
|
||||
}
|
||||
|
||||
+2
-3
@@ -43,11 +43,10 @@ module.exports = function (liquid) {
|
||||
// build array of arguments to pass to sequential promises...
|
||||
collection = collection.slice(offset, offset + limit)
|
||||
if (!cols) cols = collection.length
|
||||
var contexts = []
|
||||
collection.some((item, i) => {
|
||||
var contexts = collection.map((item, i) => {
|
||||
var ctx = {}
|
||||
ctx[this.variable] = item
|
||||
contexts.push(ctx)
|
||||
return ctx
|
||||
})
|
||||
|
||||
return mapSeries(contexts,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
'use strict'
|
||||
const chai = require('chai')
|
||||
const expect = chai.expect
|
||||
|
||||
|
||||
Reference in New Issue
Block a user