Merge branch 'hr_list_break'
This commit is contained in:
commit
f1ca351a22
@ -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;
|
||||
};
|
||||
|
10
test/new/hr_list_break.html
Normal file
10
test/new/hr_list_break.html
Normal file
@ -0,0 +1,10 @@
|
||||
<ul>
|
||||
<li>hello
|
||||
world</li>
|
||||
<li>how
|
||||
are</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>you today?</p>
|
6
test/new/hr_list_break.text
Normal file
6
test/new/hr_list_break.text
Normal file
@ -0,0 +1,6 @@
|
||||
* hello
|
||||
world
|
||||
* how
|
||||
are
|
||||
* * *
|
||||
you today?
|
10
test/tests/hr_list_break.html
Normal file
10
test/tests/hr_list_break.html
Normal file
@ -0,0 +1,10 @@
|
||||
<ul>
|
||||
<li>hello
|
||||
world</li>
|
||||
<li>how
|
||||
are</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
<p>you today?</p>
|
6
test/tests/hr_list_break.text
Normal file
6
test/tests/hr_list_break.text
Normal file
@ -0,0 +1,6 @@
|
||||
* hello
|
||||
world
|
||||
* how
|
||||
are
|
||||
* * *
|
||||
you today?
|
Loading…
x
Reference in New Issue
Block a user