mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 14:00:39 -07:00
feat: with & for in render tag, closes #195
This commit is contained in:
@@ -12,6 +12,6 @@ export default {
|
||||
this.value = match[2]
|
||||
},
|
||||
render: function * (ctx: Context) {
|
||||
ctx.front()[this.key] = yield this.liquid._evalValue(this.value, ctx)
|
||||
ctx.bottom()[this.key] = yield this.liquid._evalValue(this.value, ctx)
|
||||
}
|
||||
} as TagImplOptions
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import BlockMode from '../../context/block-mode'
|
||||
import { ParseStream, TagToken, Token, Template, Context, TagImplOptions, Emitter, Hash } from '../../types'
|
||||
import { ParseStream, TagToken, Token, Template, Context, TagImplOptions, Emitter } from '../../types'
|
||||
|
||||
export default {
|
||||
parse: function (token: TagToken, remainTokens: Token[]) {
|
||||
@@ -14,7 +14,7 @@ export default {
|
||||
})
|
||||
stream.start()
|
||||
},
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const blocks = ctx.getRegister('blocks')
|
||||
const childDefined = blocks[this.block]
|
||||
const r = this.liquid.renderer
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Emitter, Context, Hash } from '../../types'
|
||||
import { Emitter, Context } from '../../types'
|
||||
|
||||
export default {
|
||||
render: function (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function (ctx: Context, emitter: Emitter) {
|
||||
emitter.break = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ export default {
|
||||
render: function * (ctx: Context) {
|
||||
const r = this.liquid.renderer
|
||||
const html = yield r.renderTemplates(this.templates, ctx)
|
||||
ctx.front()[this.variable] = html
|
||||
ctx.bottom()[this.variable] = html
|
||||
}
|
||||
} as TagImplOptions
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Expression, Hash, Emitter, TagToken, Token, Context, Template, TagImplOptions, ParseStream } from '../../types'
|
||||
import { Expression, Emitter, TagToken, Token, Context, Template, TagImplOptions, ParseStream } from '../../types'
|
||||
|
||||
export default {
|
||||
parse: function (tagToken: TagToken, remainTokens: Token[]) {
|
||||
@@ -24,7 +24,7 @@ export default {
|
||||
stream.start()
|
||||
},
|
||||
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const r = this.liquid.renderer
|
||||
const cond = yield new Expression(this.cond).value(ctx)
|
||||
for (let i = 0; i < this.cases.length; i++) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Emitter, Context, Hash } from '../../types'
|
||||
import { Emitter, Context } from '../../types'
|
||||
|
||||
export default {
|
||||
render: function (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function (ctx: Context, emitter: Emitter) {
|
||||
emitter.continue = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { value as rValue } from '../../parser/lexical'
|
||||
import { Emitter, Expression, TagToken, Context, TagImplOptions, Hash } from '../../types'
|
||||
import { Emitter, Expression, TagToken, Context, TagImplOptions } from '../../types'
|
||||
|
||||
const groupRE = new RegExp(`^(?:(${rValue.source})\\s*:\\s*)?(.*)$`)
|
||||
const candidatesRE = new RegExp(rValue.source, 'g')
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
assert(this.candidates.length, `empty candidates: ${tagToken.raw}`)
|
||||
},
|
||||
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const group = yield this.group.value(ctx)
|
||||
const fingerprint = `cycle:${group}:` + this.candidates.join(',')
|
||||
const groups = ctx.getRegister('cycle')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { identifier } from '../../parser/lexical'
|
||||
import { Emitter, TagToken, Context, TagImplOptions, Hash } from '../../types'
|
||||
import { Emitter, TagToken, Context, TagImplOptions } from '../../types'
|
||||
import { isNumber, stringify } from '../../util/underscore'
|
||||
|
||||
export default {
|
||||
@@ -9,7 +9,7 @@ export default {
|
||||
assert(match, `illegal identifier ${token.args}`)
|
||||
this.variable = match[0]
|
||||
},
|
||||
render: function (context: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function (context: Context, emitter: Emitter) {
|
||||
const scope = context.environments
|
||||
if (!isNumber(scope[this.variable])) {
|
||||
scope[this.variable] = 0
|
||||
|
||||
+9
-19
@@ -1,16 +1,12 @@
|
||||
import { Emitter, TagToken, Token, Context, Template, TagImplOptions, ParseStream } from '../../types'
|
||||
import { isString, isObject, isArray } from '../../util/underscore'
|
||||
import { toCollection } from '../../util/collection'
|
||||
import { Expression } from '../../render/expression'
|
||||
import { assert } from '../../util/assert'
|
||||
import { identifier, value, hash } from '../../parser/lexical'
|
||||
import { identifier, value } from '../../parser/lexical'
|
||||
import { ForloopDrop } from '../../drop/forloop-drop'
|
||||
import { Hash } from '../../template/tag/hash'
|
||||
|
||||
const re = new RegExp(`^(${identifier.source})\\s+in\\s+` +
|
||||
`(${value.source})` +
|
||||
`(?:\\s+${hash.source})*` +
|
||||
`(?:\\s+(reversed))?` +
|
||||
`(?:\\s+${hash.source})*$`)
|
||||
const re = new RegExp(`^(${identifier.source})\\s+in\\s+(${value.source})`)
|
||||
|
||||
export default {
|
||||
type: 'block',
|
||||
@@ -19,8 +15,7 @@ export default {
|
||||
assert(match, `illegal tag: ${tagToken.raw}`)
|
||||
this.variable = match[1]
|
||||
this.collection = match[2]
|
||||
this.reversed = !!match[3]
|
||||
|
||||
this.hash = new Hash(tagToken.args.slice(match[0].length))
|
||||
this.templates = []
|
||||
this.elseTemplates = []
|
||||
|
||||
@@ -36,27 +31,22 @@ export default {
|
||||
|
||||
stream.start()
|
||||
},
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const r = this.liquid.renderer
|
||||
let collection = yield new Expression(this.collection).value(ctx)
|
||||
collection = toCollection(collection)
|
||||
|
||||
if (!isArray(collection)) {
|
||||
if (isString(collection) && collection.length > 0) {
|
||||
collection = [collection] as string[]
|
||||
} else if (isObject(collection)) {
|
||||
collection = Object.keys(collection).map((key) => [key, collection[key]])
|
||||
}
|
||||
}
|
||||
if (!isArray(collection) || !collection.length) {
|
||||
if (!collection.length) {
|
||||
yield r.renderTemplates(this.elseTemplates, ctx, emitter)
|
||||
return
|
||||
}
|
||||
|
||||
const hash = yield this.hash.render(ctx)
|
||||
const offset = hash.offset || 0
|
||||
const limit = (hash.limit === undefined) ? collection.length : hash.limit
|
||||
|
||||
collection = collection.slice(offset, offset + limit)
|
||||
if (this.reversed) collection.reverse()
|
||||
if ('reversed' in hash) collection.reverse()
|
||||
|
||||
const scope = { forloop: new ForloopDrop(collection.length) }
|
||||
ctx.push(scope)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Hash, Emitter, isTruthy, Expression, TagToken, Token, Context, Template, TagImplOptions, ParseStream } from '../../types'
|
||||
import { Emitter, isTruthy, Expression, TagToken, Token, Context, Template, TagImplOptions, ParseStream } from '../../types'
|
||||
|
||||
export default {
|
||||
parse: function (tagToken: TagToken, remainTokens: Token[]) {
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
stream.start()
|
||||
},
|
||||
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const r = this.liquid.renderer
|
||||
|
||||
for (const branch of this.branches) {
|
||||
|
||||
+25
-35
@@ -1,49 +1,39 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { Expression, Hash, Emitter, TagToken, Context, TagImplOptions } from '../../types'
|
||||
import { value, quotedLine } from '../../parser/lexical'
|
||||
import { quoted, value, quotedLine } from '../../parser/lexical'
|
||||
import BlockMode from '../../context/block-mode'
|
||||
|
||||
const staticFileRE = /[^\s,]+/
|
||||
const withRE = new RegExp(`with\\s+(${value.source})`)
|
||||
const rFile = new RegExp(`^(${quoted.source}|[^\\s,]+)(?:\\s+with\\s+(${value.source}))?`)
|
||||
|
||||
export default {
|
||||
parse: function (token: TagToken) {
|
||||
let match = staticFileRE.exec(token.args)
|
||||
if (match) this.staticValue = match[0]
|
||||
|
||||
match = value.exec(token.args)
|
||||
if (match) this.value = match[0]
|
||||
|
||||
match = withRE.exec(token.args)
|
||||
if (match) this.with = match[1]
|
||||
},
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
let filepath
|
||||
if (ctx.opts.dynamicPartials) {
|
||||
if (quotedLine.exec(this.value)) {
|
||||
const template = this.value.slice(1, -1)
|
||||
filepath = yield this.liquid._parseAndRender(template, ctx.getAll(), ctx.opts, ctx.sync)
|
||||
} else {
|
||||
filepath = yield new Expression(this.value).value(ctx)
|
||||
}
|
||||
} else {
|
||||
filepath = this.staticValue
|
||||
const match = rFile.exec(token.args)
|
||||
if (!match) {
|
||||
throw new Error(`illegal argument "${token.args}"`)
|
||||
}
|
||||
assert(filepath, `cannot include with empty filename`)
|
||||
|
||||
const originBlocks = ctx.getRegister('blocks')
|
||||
const originBlockMode = ctx.getRegister('blockMode')
|
||||
this.file = match[1]
|
||||
this.hash = new Hash(token.args.slice(match[0].length))
|
||||
this.withVar = match[2]
|
||||
},
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const { liquid, hash, withVar, file } = this
|
||||
const { renderer } = liquid
|
||||
const filepath = ctx.opts.dynamicPartials
|
||||
? (quotedLine.exec(file)
|
||||
? yield renderer.renderTemplates(liquid.parse(file.slice(1, -1)), ctx)
|
||||
: yield new Expression(file).value(ctx))
|
||||
: file
|
||||
assert(filepath, `illegal filename "${file}":"${filepath}"`)
|
||||
|
||||
const saved = ctx.saveRegister('blocks', 'blockMode')
|
||||
ctx.setRegister('blocks', {})
|
||||
ctx.setRegister('blockMode', BlockMode.OUTPUT)
|
||||
if (this.with) {
|
||||
hash[filepath] = yield new Expression(this.with).evaluate(ctx)
|
||||
}
|
||||
const templates = yield this.liquid._parseFile(filepath, ctx.opts, ctx.sync)
|
||||
ctx.push(hash)
|
||||
yield this.liquid.renderer.renderTemplates(templates, ctx, emitter)
|
||||
const scope = yield hash.render(ctx)
|
||||
if (withVar) scope[filepath] = yield new Expression(withVar).evaluate(ctx)
|
||||
const templates = yield liquid._parseFile(filepath, ctx.opts, ctx.sync)
|
||||
ctx.push(scope)
|
||||
yield renderer.renderTemplates(templates, ctx, emitter)
|
||||
ctx.pop()
|
||||
ctx.setRegister('blocks', originBlocks)
|
||||
ctx.setRegister('blockMode', originBlockMode)
|
||||
ctx.restoreRegister(saved)
|
||||
}
|
||||
} as TagImplOptions
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { identifier } from '../../parser/lexical'
|
||||
import { isNumber, stringify } from '../../util/underscore'
|
||||
import { Emitter, TagToken, Context, TagImplOptions, Hash } from '../../types'
|
||||
import { Emitter, TagToken, Context, TagImplOptions } from '../../types'
|
||||
|
||||
export default {
|
||||
parse: function (token: TagToken) {
|
||||
@@ -9,7 +9,7 @@ export default {
|
||||
assert(match, `illegal identifier ${token.args}`)
|
||||
this.variable = match![0]
|
||||
},
|
||||
render: function (context: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function (context: Context, emitter: Emitter) {
|
||||
const scope = context.environments
|
||||
if (!isNumber(scope[this.variable])) {
|
||||
scope[this.variable] = 0
|
||||
|
||||
+21
-24
@@ -1,42 +1,39 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { value as rValue } from '../../parser/lexical'
|
||||
import { quotedLine, quoted } from '../../parser/lexical'
|
||||
import { Emitter, Hash, Expression, TagToken, Token, Context, TagImplOptions } from '../../types'
|
||||
import BlockMode from '../../context/block-mode'
|
||||
|
||||
const staticFileRE = /\S+/
|
||||
const rFile = new RegExp(`^(${quoted.source}|[^\\s,]+)`)
|
||||
|
||||
export default {
|
||||
parse: function (token: TagToken, remainTokens: Token[]) {
|
||||
let match = staticFileRE.exec(token.args)
|
||||
if (match) {
|
||||
this.staticLayout = match[0]
|
||||
const match = rFile.exec(token.args)
|
||||
if (!match) {
|
||||
throw new Error(`illegal argument "${token.args}"`)
|
||||
}
|
||||
|
||||
match = rValue.exec(token.args)
|
||||
if (match) {
|
||||
this.layout = match[0]
|
||||
}
|
||||
|
||||
this.file = match[1]
|
||||
this.hash = new Hash(token.args.slice(match[0].length))
|
||||
this.tpls = this.liquid.parser.parse(remainTokens)
|
||||
},
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
const layout = ctx.opts.dynamicPartials
|
||||
? yield new Expression(this.layout).value(ctx)
|
||||
: this.staticLayout
|
||||
assert(layout, `cannot apply layout with empty filename`)
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const { liquid, hash, file } = this
|
||||
const { renderer } = liquid
|
||||
const filepath = ctx.opts.dynamicPartials
|
||||
? (quotedLine.exec(file)
|
||||
? yield renderer.renderTemplates(liquid.parse(file.slice(1, -1)), ctx)
|
||||
: yield new Expression(file).value(ctx))
|
||||
: this.file
|
||||
assert(filepath, `illegal filename "${file}":"${filepath}"`)
|
||||
|
||||
// render the remaining tokens immediately
|
||||
ctx.setRegister('blockMode', BlockMode.STORE)
|
||||
const blocks = ctx.getRegister('blocks')
|
||||
const r = this.liquid.renderer
|
||||
const html = yield r.renderTemplates(this.tpls, ctx)
|
||||
if (blocks[''] === undefined) {
|
||||
blocks[''] = html
|
||||
}
|
||||
const templates = yield this.liquid._parseFile(layout, ctx.opts, ctx.sync)
|
||||
ctx.push(hash)
|
||||
const html = yield renderer.renderTemplates(this.tpls, ctx)
|
||||
if (blocks[''] === undefined) blocks[''] = html
|
||||
const templates = yield liquid._parseFile(filepath, ctx.opts, ctx.sync)
|
||||
ctx.push(yield hash.render(ctx))
|
||||
ctx.setRegister('blockMode', BlockMode.OUTPUT)
|
||||
const partial = yield r.renderTemplates(templates, ctx)
|
||||
const partial = yield renderer.renderTemplates(templates, ctx)
|
||||
ctx.pop()
|
||||
emitter.write(partial)
|
||||
}
|
||||
|
||||
+49
-36
@@ -1,50 +1,63 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { ForloopDrop } from '../../drop/forloop-drop'
|
||||
import { toCollection } from '../../util/collection'
|
||||
import { Expression, Hash, Emitter, TagToken, Context, TagImplOptions } from '../../types'
|
||||
import { value, quotedLine } from '../../parser/lexical'
|
||||
import BlockMode from '../../context/block-mode'
|
||||
import { identifier, value, quoted, quotedLine } from '../../parser/lexical'
|
||||
|
||||
const staticFileRE = /[^\s,]+/
|
||||
const withRE = new RegExp(`with\\s+(${value.source})`)
|
||||
const rFile = new RegExp(`^(${quoted.source}|[^\\s,]+)`)
|
||||
const rWith = new RegExp(`^\\s+with\\s+(${value.source})(?:\\s+as\\s+(${identifier.source}))?`)
|
||||
const rFor = new RegExp(`^\\s+for\\s+(${value.source})\\s+as\\s+(${identifier.source})`)
|
||||
|
||||
export default {
|
||||
parse: function (token: TagToken) {
|
||||
let match = staticFileRE.exec(token.args)
|
||||
if (match) this.staticValue = match[0]
|
||||
let args = token.args
|
||||
let match = rFile.exec(args)
|
||||
|
||||
match = value.exec(token.args)
|
||||
if (match) this.value = match[0]
|
||||
assert(match, `illegal argument "${token.args}"`)
|
||||
this.file = match![1]
|
||||
args = args.substr(match![0].length)
|
||||
|
||||
match = withRE.exec(token.args)
|
||||
if (match) this.with = match[1]
|
||||
},
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
let filepath
|
||||
if (ctx.opts.dynamicPartials) {
|
||||
if (quotedLine.exec(this.value)) {
|
||||
const template = this.value.slice(1, -1)
|
||||
filepath = yield this.liquid._parseAndRender(template, ctx.getAll(), ctx.opts, ctx.sync)
|
||||
} else {
|
||||
filepath = yield new Expression(this.value).value(ctx)
|
||||
}
|
||||
} else {
|
||||
filepath = this.staticValue
|
||||
while (true) {
|
||||
if ((match = rWith.exec(args))) {
|
||||
this.withVar = match[1]
|
||||
this.withAs = match[2]
|
||||
args = args.substr(match[0].length)
|
||||
} else if ((match = rFor.exec(args))) {
|
||||
this.forVar = match[1]
|
||||
this.forAs = match[2]
|
||||
args = args.substr(match[0].length)
|
||||
} else break
|
||||
}
|
||||
assert(filepath, `cannot render with empty filename`)
|
||||
|
||||
const originBlocks = ctx.getRegister('blocks')
|
||||
const originBlockMode = ctx.getRegister('blockMode')
|
||||
this.hash = new Hash(args)
|
||||
},
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const { liquid, withVar, withAs, forVar, forAs, file, hash } = this
|
||||
const { renderer } = liquid
|
||||
const filepath = ctx.opts.dynamicPartials
|
||||
? (quotedLine.exec(file)
|
||||
? yield renderer.renderTemplates(liquid.parse(file.slice(1, -1)), ctx)
|
||||
: yield new Expression(file).value(ctx))
|
||||
: this.file
|
||||
assert(filepath, `illegal filename "${file}":"${filepath}"`)
|
||||
|
||||
const childCtx = new Context({}, ctx.opts, ctx.sync)
|
||||
childCtx.setRegister('blocks', {})
|
||||
childCtx.setRegister('blockMode', BlockMode.OUTPUT)
|
||||
if (this.with) {
|
||||
hash[filepath] = yield new Expression(this.with).evaluate(ctx)
|
||||
}
|
||||
childCtx.push(hash)
|
||||
const templates = yield this.liquid._parseFile(filepath, childCtx.opts, childCtx.sync)
|
||||
yield this.liquid.renderer.renderTemplates(templates, childCtx, emitter)
|
||||
const scope = yield hash.render(ctx)
|
||||
if (withVar) scope[withAs || filepath] = yield new Expression(withVar).evaluate(ctx)
|
||||
childCtx.push(scope)
|
||||
|
||||
childCtx.setRegister('blocks', originBlocks)
|
||||
childCtx.setRegister('blockMode', originBlockMode)
|
||||
if (forVar) {
|
||||
let collection = yield new Expression(forVar).value(ctx)
|
||||
collection = toCollection(collection)
|
||||
scope['forloop'] = new ForloopDrop(collection.length)
|
||||
for (const item of collection) {
|
||||
scope[forAs] = item
|
||||
const templates = yield liquid._parseFile(filepath, childCtx.opts, childCtx.sync)
|
||||
yield renderer.renderTemplates(templates, childCtx, emitter)
|
||||
scope.forloop.next()
|
||||
}
|
||||
} else {
|
||||
const templates = yield liquid._parseFile(filepath, childCtx.opts, childCtx.sync)
|
||||
yield renderer.renderTemplates(templates, childCtx, emitter)
|
||||
}
|
||||
}
|
||||
} as TagImplOptions
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { assert } from '../../util/assert'
|
||||
import { toCollection } from '../../util/collection'
|
||||
import { Expression, Emitter, Hash, TagToken, Token, Context, Template, TagImplOptions, ParseStream } from '../../types'
|
||||
import { identifier, value, hash } from '../../parser/lexical'
|
||||
import { identifier, value } from '../../parser/lexical'
|
||||
import { TablerowloopDrop } from '../../drop/tablerowloop-drop'
|
||||
|
||||
const re = new RegExp(`^(${identifier.source})\\s+in\\s+` +
|
||||
`(${value.source})` +
|
||||
`(?:\\s+${hash.source})*$`)
|
||||
`(${value.source})`)
|
||||
|
||||
export default {
|
||||
parse: function (tagToken: TagToken, remainTokens: Token[]) {
|
||||
@@ -15,6 +15,7 @@ export default {
|
||||
this.variable = match[1]
|
||||
this.collection = match[2]
|
||||
this.templates = []
|
||||
this.hash = new Hash(tagToken.args.slice(match[0].length))
|
||||
|
||||
let p
|
||||
const stream: ParseStream = this.liquid.parser.parseStream(remainTokens)
|
||||
@@ -28,8 +29,9 @@ export default {
|
||||
stream.start()
|
||||
},
|
||||
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
let collection = (yield new Expression(this.collection).value(ctx)) || []
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
let collection = toCollection(yield new Expression(this.collection).value(ctx))
|
||||
const hash = yield this.hash.render(ctx)
|
||||
const offset = hash.offset || 0
|
||||
const limit = (hash.limit === undefined) ? collection.length : hash.limit
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Emitter, Expression, isFalsy, ParseStream, Context, TagImplOptions, Token, Hash, TagToken } from '../../types'
|
||||
import { Emitter, Expression, isFalsy, ParseStream, Context, TagImplOptions, Token, TagToken } from '../../types'
|
||||
|
||||
export default {
|
||||
parse: function (tagToken: TagToken, remainTokens: Token[]) {
|
||||
@@ -20,7 +20,7 @@ export default {
|
||||
stream.start()
|
||||
},
|
||||
|
||||
render: function * (ctx: Context, hash: Hash, emitter: Emitter) {
|
||||
render: function * (ctx: Context, emitter: Emitter) {
|
||||
const r = this.liquid.renderer
|
||||
const cond = yield new Expression(this.cond).value(ctx)
|
||||
yield (isFalsy(cond)
|
||||
|
||||
Reference in New Issue
Block a user