FIX: BBCode blocks parser no longer mangles JsonML arrays

This commit is contained in:
Jens Maier 2014-09-22 00:50:01 +02:00
parent d97548114f
commit 9cca64cf69
2 changed files with 4 additions and 1 deletions

View File

@ -55,7 +55,7 @@ Discourse.BBCode.register = function(codeName, args, emitter) {
} }
}); });
} }
if (!args.singlePara && contents.length === 1) { if (!args.singlePara && contents.length === 1 && contents[0] instanceof Array && contents[0][0] === "para") {
contents[0].shift(); contents[0].shift();
contents = contents[0]; contents = contents[0];
} }

View File

@ -65,6 +65,9 @@ test("size tags", function() {
format("[size=35]NEWLINE\n\ntest[/size]", format("[size=35]NEWLINE\n\ntest[/size]",
"<span class=\"bbcode-size-35\"><p>NEWLINE</p><p>test</p></span>", "<span class=\"bbcode-size-35\"><p>NEWLINE</p><p>test</p></span>",
"works with newlines"); "works with newlines");
format("[size=35][quote=\"user\"]quote[/quote][/size]",
"<span class=\"bbcode-size-35\"><aside class=\"quote\"><div class=\"title\"><div class=\"quote-controls\"></div>user:</div><blockquote><p>quote</p></blockquote></aside></span>",
"works with nested complex blocks");
}); });
test("quotes", function() { test("quotes", function() {