pass toplevel state to blockquotes, get rid of extra paragraph rules

This commit is contained in:
Christopher Jeffrey 2012-01-03 15:27:55 -06:00
parent 73113644cb
commit 332072ffed

View File

@ -47,16 +47,6 @@ block.paragraph = (function() {
return new
RegExp('^([^\\n]+\\n?(?!' + body + '))+\\n*');
return new
RegExp('^([^\\n]+\\n(?!'
+ body
+ '))+\\n|^([^\\0](?!\\n(?:'
+ body
+ ')))*$');
return new
RegExp('^([^\\n]+\\n(?!' + body + '))+\\n*|^[^\\0]*$');
})();
//block.paragraph = /^([^\n]+\n)+\n+|^[^\0]+$/;
@ -172,7 +162,10 @@ block.token = function(str, tokens, top) {
type: 'blockquote_start'
});
cap = cap[0].replace(/^ *>/gm, '');
block.token(cap, tokens);
// pass `top` to keep the current
// "toplevel" state. this is exactly
// how markdown.pl works.
block.token(cap, tokens, top);
tokens.push({
type: 'blockquote_end'
});
@ -237,7 +230,8 @@ block.token = function(str, tokens, top) {
continue;
}
// top-level text
// optimization for top-level paragraphs.
// ignores list-item-looking lines.
if (top && (cap = block.paragraph.exec(str))) {
str = str.substring(cap[0].length);
tokens.push({