Skip to content

Commit

Permalink
Revert "rough implementation of task lists. see markedjs#107 markedjs…
Browse files Browse the repository at this point in the history
…#111."

This reverts commit 26cef98.
  • Loading branch information
chjj committed Mar 10, 2014
1 parent 586b7c9 commit 9a8c2c8
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions lib/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ var block = {
list: /^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html: /^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,
task: noop,
table: noop,
paragraph: /^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,
text: /^[^\n]+/
Expand Down Expand Up @@ -76,7 +75,6 @@ block.normal = merge({}, block);
*/

block.gfm = merge({}, block.normal, {
task: /^(\s*\[[x ]\][^\n]+\n)+\n*/,
fences: /^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,
paragraph: /^/
});
Expand Down Expand Up @@ -377,33 +375,6 @@ Lexer.prototype.token = function(src, top, bq) {
continue;
}

// task (gfm)
if (top && (cap = this.rules.task.exec(src)) {
src = src.substring(cap[0].length);

this.tokens.push({
type: 'task_list_start'
});

cap[0] = cap[0].replace(/^\s+|\s+$/g, '');
cap = cap[0].split(/\n+/);

i = 0;
l = cap.length;

for (; i < l; i++) {
this.tokens.push({
type: 'task_item',
checked: /^\s*\[x\]/.test(cap[i]),
text: cap[i].replace(/^\s*\[[x ]\]\s*/, '')
});
}

this.tokens.push({
type: 'task_list_end'
});
}

// table (gfm)
if (top && (cap = this.rules.table.exec(src))) {
src = src.substring(cap[0].length);
Expand Down Expand Up @@ -1009,25 +980,6 @@ Parser.prototype.tok = function() {
this.token.lang,
this.token.escaped);
}
case 'task_list_start': {
var body = ''
, i = 1;

while (this.next().type !== 'task_list_end') {
body += '<li class="task-list-item"><label>'
+ '<input type="checkbox"'
+ ' class="task-list-item-checkbox"
+ ' data-item-index="' + (i++) + '"'
+ ' data-item-complete="' + (this.token.checked ? 1 : 0) + '"'
+ ' ' + (this.token.disabled ? 'disabled=""' + '') + '>'
+ ' ' + this.inline.output(this.token.text)
+ '</label></li>';
}

return '<ul class="task-list">'
+ body
+ '</ul>';
}
case 'table': {
var header = ''
, body = ''
Expand Down

0 comments on commit 9a8c2c8

Please sign in to comment.