mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Quotes inside a list
This commit is contained in:
parent
341f8c8877
commit
63be950e5f
4 changed files with 25 additions and 16 deletions
|
@ -25,18 +25,3 @@ replaceMarkdown('*', 'em');
|
|||
replaceMarkdown('_', 'em');
|
||||
|
||||
|
||||
// There's a weird issue with the markdown parser where it won't process simple blockquotes
|
||||
// when they are prefixed with spaces. This fixes it.
|
||||
Discourse.Dialect.on("register", function(event) {
|
||||
var dialect = event.dialect,
|
||||
MD = event.MD;
|
||||
|
||||
dialect.block["fix_simple_quotes"] = function(block, next) {
|
||||
var m = /^ +(\>[\s\S]*)/.exec(block);
|
||||
if (m && m[1] && m[1].length) {
|
||||
next.unshift(MD.mk_block(m[1]));
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
// There's a weird issue with the markdown parser where it won't process simple blockquotes
|
||||
// when they are prefixed with spaces. This fixes it.
|
||||
Discourse.Dialect.on("register", function(event) {
|
||||
var dialect = event.dialect,
|
||||
MD = event.MD;
|
||||
|
||||
dialect.block["fix_simple_quotes"] = function(block, next) {
|
||||
var m = /(^|\n) +(\>[\s\S]*)/.exec(block);
|
||||
if (m && m[2] && m[2].length) {
|
||||
var blockContents = block.replace(/(^|\n) +\>/, "$1>");
|
||||
next.unshift(blockContents);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
});
|
|
@ -691,7 +691,8 @@ Markdown.dialects.Gruber = {
|
|||
|
||||
var next_block = next[0] && next[0].valueOf() || "";
|
||||
|
||||
if ( next_block.match(is_list_re) || next_block.match( /^ / ) ) {
|
||||
|
||||
if ( next_block.match(is_list_re) || (next_block.match(/^ /) && (!next_block.match(/^ *\>/))) ) {
|
||||
block = next.shift();
|
||||
|
||||
// Check for an HR following a list: features/lists/hr_abutting
|
||||
|
@ -711,6 +712,7 @@ Markdown.dialects.Gruber = {
|
|||
break;
|
||||
} // loose_search
|
||||
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(),
|
||||
|
|
|
@ -119,6 +119,12 @@ test("simple quotes", function() {
|
|||
cooked("> level 1\n> > level 2",
|
||||
"<blockquote><p>level 1</p><blockquote><p>level 2</p></blockquote></blockquote>",
|
||||
"it allows nesting of blockquotes with spaces");
|
||||
|
||||
cooked("- hello\n\n > world\n > eviltrout",
|
||||
"<ul><li>hello</li></ul>\n\n<blockquote><p>world<br>eviltrout</p></blockquote>",
|
||||
"it allows quotes within a list.");
|
||||
cooked(" > indent 1\n > indent 2", "<blockquote><p>indent 1<br>indent 2</p></blockquote>", "allow multiple spaces to indent");
|
||||
|
||||
});
|
||||
|
||||
test("Quotes", function() {
|
||||
|
|
Loading…
Reference in a new issue