Merge branch 'hr_list_break'

This commit is contained in:
Christopher Jeffrey 2012-04-24 13:56:05 -05:00
commit f1ca351a22
5 changed files with 45 additions and 7 deletions

View File

@ -17,15 +17,22 @@ var block = {
heading: /^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,
lheading: /^([^\n]+)\n *(=|-){3,} *\n*/,
blockquote: /^( *>[^\n]+(\n[^\n]+)*\n*)+/,
list: /^( *)([*+-]|\d+\.) [^\0]+?(?:\n{2,}(?! )(?!\1bullet)\n*|\s*$)/,
list: /^( *)(bull) [^\0]+?(?:rule|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,
def: /^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
paragraph: /^([^\n]+\n?(?!body))+\n*/,
text: /^[^\n]+/
};
block.bullet = /(?:[*+-]|\d+\.)/;
block.item = /^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;
block.item = replace(block.item, 'gm')
(/bull/g, block.bullet)
();
block.list = replace(block.list)
('bullet', /(?:[*+-](?!(?: *[-*]){2,})|\d+\.) /)
(/bull/g, block.bullet)
('rule', /\n+(?=(?: *[-*_]){3,})/)
();
block.html = replace(block.html)
@ -193,9 +200,7 @@ block.token = function(src, tokens, top) {
});
// Get each top-level item.
cap = cap[0].match(
/^( *)([*+-]|\d+\.) [^\n]*(?:\n(?!\1(?:[*+-]|\d+\.) )[^\n]*)*/gm
);
cap = cap[0].match(block.item);
next = false;
l = cap.length;
@ -688,10 +693,11 @@ function tag() {
return tag;
}
function replace(regex) {
function replace(regex, opt) {
regex = regex.source;
opt = opt || '';
return function self(name, val) {
if (!name) return new RegExp(regex);
if (!name) return new RegExp(regex, opt);
regex = regex.replace(name, val.source || val);
return self;
};

View File

@ -0,0 +1,10 @@
<ul>
<li>hello
world</li>
<li>how
are</li>
</ul>
<hr>
<p>you today?</p>

View File

@ -0,0 +1,6 @@
* hello
world
* how
are
* * *
you today?

View File

@ -0,0 +1,10 @@
<ul>
<li>hello
world</li>
<li>how
are</li>
</ul>
<hr>
<p>you today?</p>

View File

@ -0,0 +1,6 @@
* hello
world
* how
are
* * *
you today?