Skip to content

Commit

Permalink
Merge pull request from GHSA-9jgg-4xj2-vjjj
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel authored Jun 14, 2020
1 parent 4ffd132 commit 9e08718
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion server/modules/rendering/html-core/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ const uslug = require('uslug')
const pageHelper = require('../../../helpers/page')
const URL = require('url').URL

const mustacheRegExp = /(\{|{?){2}(.+?)(\}|}?){2}/i

/* global WIKI */

module.exports = {
Expand Down Expand Up @@ -230,6 +232,16 @@ module.exports = {
headers.push(headerSlug)
})

// --------------------------------
// Wrap root text nodes
// --------------------------------

$('body').contents().toArray().forEach(item => {
if (item.type === 'text' && item.parent.name === 'body') {
$(item).wrap('<div></div>')
}
})

// --------------------------------
// Escape mustache expresions
// --------------------------------
Expand All @@ -239,7 +251,7 @@ module.exports = {
list.forEach(item => {
if (item.type === 'text') {
const rawText = $(item).text()
if (rawText.indexOf('{{') >= 0 && rawText.indexOf('}}') > 1) {
if (mustacheRegExp.test(rawText)) {
$(item).parent().attr('v-pre', true)
}
} else {
Expand Down

0 comments on commit 9e08718

Please sign in to comment.