Skip to content

Commit 2aaef58

Browse files
committed
fix: clear raw tag after expression, close #82
1 parent 425fc70 commit 2aaef58

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

lib/index.js

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ module.exports = function postHTMLExpressions (options) {
152152
unescapeDelimitersReplace = new RegExp(`@${delimitersSettings[0].text[0]}`, 'g')
153153

154154
// kick off the parsing
155-
return walk.bind(null, { locals: options.locals })
155+
return function (tree) {
156+
return clearRawTag(walk({ locals: options.locals }, tree))
157+
}
156158
}
157159

158160
function walk (opts, nodes) {
@@ -170,10 +172,10 @@ function walk (opts, nodes) {
170172

171173
// don't parse ignoredTag
172174
if (node.tag === ignored) {
173-
node.tag = false
175+
// node.tag = false
174176

175177
m.push(node)
176-
178+
177179
return m
178180
}
179181

@@ -396,3 +398,22 @@ function walk (opts, nodes) {
396398
return m
397399
}, [])
398400
}
401+
402+
403+
function clearRawTag(tree) {
404+
405+
return tree.reduce((m, node) => {
406+
if (node.content) {
407+
node.content = clearRawTag(node.content)
408+
}
409+
410+
if (node.tag === ignored) {
411+
node.tag = false
412+
}
413+
414+
m.push(node)
415+
416+
return m
417+
}, [])
418+
419+
}

0 commit comments

Comments
 (0)