FIX: Nested quotes weren't rendered properly with BBCode

This commit is contained in:
Robin Ward
2017-04-03 14:38:30 -04:00
parent a13a8dc96c
commit 0829671963
3 changed files with 13 additions and 1 deletions

View File

@ -9,6 +9,8 @@ export function register(helper, codeName, args, emitter) {
start: new RegExp("\\[" + codeName + "(=[^\\[\\]]+)?\\]([\\s\\S]*)", "igm"),
stop: new RegExp("\\[\\/" + codeName + "\\]", "igm"),
emitter(blockContents, matches) {
const options = helper.getOptions();
while (blockContents.length && (typeof blockContents[0] === "string" || blockContents[0] instanceof String)) {
blockContents[0] = String(blockContents[0]).replace(/^\s+/, '');
@ -22,7 +24,11 @@ export function register(helper, codeName, args, emitter) {
let contents = [];
if (blockContents.length) {
const nextContents = blockContents.slice(1);
blockContents = this.processBlock(blockContents[0], nextContents).concat(nextContents);
blockContents = this.processBlock(blockContents[0], nextContents);
nextContents.forEach(nc => {
blockContents = blockContents.concat(this.processBlock(nc, []));
});
blockContents.forEach(bc => {
if (typeof bc === "string" || bc instanceof String) {