experiment

This commit is contained in:
Christopher Jeffrey 2011-08-20 06:12:28 -05:00
parent 871e554269
commit 7a774e36e6

View File

@ -16,7 +16,8 @@ var block = {
lheading: /^([^\n]+)\n *(=|-){3,}/,
hr: /^( ?[\-*_]){3,}/,
blockquote: /^ *>[^\n]*(?:\n *>[^\n]*)*/,
list: /^(?:( *)(\*|\+|-|\d+\.)[^\n]+(?:\n(?:\1 )+[^\n]+)*(?:\n+|$)){2,}/g,
// list: /^(?:( *)(\*|\+|-|\d+\.)[^\n]+(?:\n(?:\1 )+[^\n]+)*(?:\n+|$)){2,}/g,
list: /^(?:( *)(\*|\+|-|\d+\.)[^\n]+(?:\n\1+[^\n]+)*(?:\n{1,2}|$)){2,}/g,
html: /^<([^\/\s>]+)[^\n>]*>[^\n]*(?:\n[^\n]+)*\n?<\/\1>/,
text: /^[^\n]+/
};
@ -126,9 +127,15 @@ block.token = function(str, tokens) {
});
// get each top-level
// item in the list
console.log('first');
console.log(cap[0]);
console.log('end');
cap = cap[0].match(
/^( *)(\*|\+|-|\d+\.)[^\n]+(?:\n(?:\1 )+[^\n]+)*/gm
// /^( *)(\*|\+|-|\d+\.)[^\n]+(?:\n(?:\1 )+[^\n]+)*/gm
// /^( *)(\*|\+|-|\d+\.)[^\n]+(?:\n\1+[^*+\-\d][^\n]*)*/gm
/^( *)(\*|\+|-|\d+\.)[^\n]+(?:\n\1+(?!\*|\+|-|\d\.)[^\n]*)*/gm
);
console.log(cap);
each(cap, function(item) {
// remove the list items sigil
// so its seen as the next token