Unverified Commit 9e08718e authored by Nicolas Giard's avatar Nicolas Giard Committed by GitHub

Merge pull request from GHSA-9jgg-4xj2-vjjj

parent 4ffd1325
...@@ -4,6 +4,8 @@ const uslug = require('uslug') ...@@ -4,6 +4,8 @@ const uslug = require('uslug')
const pageHelper = require('../../../helpers/page') const pageHelper = require('../../../helpers/page')
const URL = require('url').URL const URL = require('url').URL
const mustacheRegExp = /(\{|{?){2}(.+?)(\}|}?){2}/i
/* global WIKI */ /* global WIKI */
module.exports = { module.exports = {
...@@ -231,6 +233,16 @@ module.exports = { ...@@ -231,6 +233,16 @@ module.exports = {
}) })
// -------------------------------- // --------------------------------
// Wrap root text nodes
// --------------------------------
$('body').contents().toArray().forEach(item => {
if (item.type === 'text' && item.parent.name === 'body') {
$(item).wrap('<div></div>')
}
})
// --------------------------------
// Escape mustache expresions // Escape mustache expresions
// -------------------------------- // --------------------------------
...@@ -239,7 +251,7 @@ module.exports = { ...@@ -239,7 +251,7 @@ module.exports = {
list.forEach(item => { list.forEach(item => {
if (item.type === 'text') { if (item.type === 'text') {
const rawText = $(item).text() const rawText = $(item).text()
if (rawText.indexOf('{{') >= 0 && rawText.indexOf('}}') > 1) { if (mustacheRegExp.test(rawText)) {
$(item).parent().attr('v-pre', true) $(item).parent().attr('v-pre', true)
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment