fix: escape mustache template chars in content
This commit is contained in:
@@ -230,12 +230,31 @@ module.exports = {
|
||||
headers.push(headerSlug)
|
||||
})
|
||||
|
||||
let output = decodeEscape($.html('body').replace('<body>', '').replace('</body>', ''))
|
||||
// --------------------------------
|
||||
// Escape mustache expresions
|
||||
// --------------------------------
|
||||
|
||||
function iterateMustacheNode (node) {
|
||||
const list = $(node).contents().toArray()
|
||||
list.forEach(item => {
|
||||
if (item.type === 'text') {
|
||||
const rawText = $(item).text()
|
||||
if (rawText.indexOf('{{') >= 0 && rawText.indexOf('}}') > 1) {
|
||||
$(item).parent().attr('v-pre', true)
|
||||
}
|
||||
} else {
|
||||
iterateMustacheNode(item)
|
||||
}
|
||||
})
|
||||
}
|
||||
iterateMustacheNode($.root())
|
||||
|
||||
// --------------------------------
|
||||
// STEP: POST
|
||||
// --------------------------------
|
||||
|
||||
let output = decodeEscape($.html('body').replace('<body>', '').replace('</body>', ''))
|
||||
|
||||
for (let child of _.sortBy(_.filter(this.children, ['step', 'post']), ['order'])) {
|
||||
const renderer = require(`../${_.kebabCase(child.key)}/renderer.js`)
|
||||
output = await renderer.init(output, child.config)
|
||||
|
Reference in New Issue
Block a user