FIX: Indented code blocks followed by `<blockquote>` weren't working.

This commit is contained in:
Robin Ward 2014-01-21 16:18:20 -05:00
parent d867fb62e4
commit e2c361f353
3 changed files with 11 additions and 4 deletions

View File

@ -20,4 +20,4 @@ Discourse.Dialect.registerInline('"', function(str, match, prev) {
return [str.length, ['blockquote', inner]];
}
}
});
});

View File

@ -25,12 +25,16 @@ var blockTags = ['address', 'article', 'aside', 'audio', 'blockquote', 'canvas',
};
Discourse.Dialect.registerBlock('html', function(block, next) {
var split;
// Fix manual blockquote paragraphing even though it's not strictly correct
var split = splitAtLast('blockquote', block, next, true);
if (split) { return split; }
if (block.search(/[^\s]+<blockquote/) === 0) {
console.log(/[^\s]+<blockquote/.exec(block));
split = splitAtLast('blockquote', block, next, true);
if (split) { return this.processInline(split[0]); }
}
var m = /^<([^>]+)\>/m.exec(block);
var m = /^<([^>]+)\>/.exec(block);
if (m && m[1]) {
var tag = m[1].split(/\s/);
if (tag && tag[0] && blockTags.indexOf(tag[0]) !== -1) {

View File

@ -321,6 +321,9 @@ test("Code Blocks", function() {
"<p><pre><code class=\"lang-auto\">[quote=&quot;sam, post:1, topic:9441, full:true&quot;]This is &#x60;&lt;not&gt;&#x60; a bug.[/quote]</code></pre></p>",
"it allows code with backticks in it");
cooked(" hello\n<blockquote>test</blockquote>",
"<pre><code>hello</code></pre>\n\n<blockquote>test</blockquote>",
"it allows an indented code block to by followed by a `<blockquote>`");
});
test("sanitize", function() {