Skip to content

Commit 5d820e5

Browse files
committed
fix: normalize output tree, close #93
1 parent aae9ecd commit 5d820e5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use strict'
22

33
const vm = require('vm')
4+
const parser = require('posthtml-parser')
5+
const render = require('posthtml-render')
46

57
const getNextTag = require('./tags')
68
const parseLoopStatement = require('./loops')
@@ -153,7 +155,7 @@ module.exports = function postHTMLExpressions (options) {
153155

154156
// kick off the parsing
155157
return function (tree) {
156-
return clearRawTag(walk({ locals: options.locals }, tree))
158+
return normalizeTree(clearRawTag(walk({ locals: options.locals }, tree)))
157159
}
158160
}
159161

@@ -412,3 +414,6 @@ function clearRawTag (tree) {
412414
return m
413415
}, [])
414416
}
417+
function normalizeTree(tree) {
418+
return parser(render(tree))
419+
}

0 commit comments

Comments
 (0)