consistent regexes

This commit is contained in:
Christopher Jeffrey 2011-08-22 00:31:13 -05:00
parent 7efff84224
commit 142bca520a

View File

@ -124,7 +124,7 @@ block.token = function(str, tokens) {
type: 'list_start', type: 'list_start',
ordered: isFinite(cap[2]) ordered: isFinite(cap[2])
}); });
loose = /\n *\n *(?:\*|\+|-|\d+\.)/.test(cap[0]); loose = /\n *\n *(?:[*+-]|\d+\.)/.test(cap[0]);
// get each top-level item // get each top-level item
cap = cap[0].match( cap = cap[0].match(
/^( *)([*+-]|\d+\.)[^\n]*(?:\n(?!\1(?:\2|\d+\.))[^\n]*)*/gm /^( *)([*+-]|\d+\.)[^\n]*(?:\n(?!\1(?:\2|\d+\.))[^\n]*)*/gm
@ -132,7 +132,7 @@ block.token = function(str, tokens) {
each(cap, function(item) { each(cap, function(item) {
// remove the list items sigil // remove the list items sigil
// so its seen as the next token // so its seen as the next token
item = item.replace(/^ *(\*|\+|-|\d+\.) */, ''); item = item.replace(/^ *([*+-]|\d+\.) */, '');
// outdent whatever the // outdent whatever the
// list item contains, hacky // list item contains, hacky
var space = /\n( +)/.exec(item); var space = /\n( +)/.exec(item);