Skip to content

Commit 8426495

Browse files
committed
Fix: bugs about mustache
1 parent f1b0a2e commit 8426495

File tree

4 files changed

+1194
-3
lines changed

4 files changed

+1194
-3
lines changed

src/html/intermediate-tokenizer.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ export class IntermediateTokenizer {
166166
// Concatenate the deferred tokens to the committed token.
167167
const start = this.expressionStartToken
168168
const end = lodash.last(this.expressionTokens) || start
169-
const value = this.expressionTokens.reduce(concat, start.value) + (start !== end ? end.value : "")
169+
const value = this.expressionTokens.reduce(concat, start.value)
170170
this.expressionStartToken = null
171171
this.expressionTokens = []
172172

@@ -515,11 +515,20 @@ export class IntermediateTokenizer {
515515
if (this.expressionStartToken == null) {
516516
return this.processText(token)
517517
}
518-
this.tokens.push(token)
519518

520-
// Clear state.
521519
const start = this.expressionStartToken
520+
const end = lodash.last(this.expressionTokens) || start
521+
522+
// If invalid notation `</>` exists directly before this token, separate it.
523+
if (end.range[1] !== token.range[0]) {
524+
const result = this.commit()
525+
this.processText(token)
526+
return result
527+
}
528+
529+
// Clear state.
522530
const value = this.expressionTokens.reduce(concat, "")
531+
this.tokens.push(token)
523532
this.expressionStartToken = null
524533
this.expressionTokens = []
525534

0 commit comments

Comments
 (0)