trivial nonsense

This commit is contained in:
Christopher Jeffrey 2011-10-22 06:18:15 -05:00
parent 922a556ef0
commit d626616de4

View File

@ -368,60 +368,95 @@ var next = function() {
var tok = function() { var tok = function() {
switch (token.type) { switch (token.type) {
case 'space': case 'space': {
return ''; return '';
case 'hr': }
case 'hr': {
return '<hr>'; return '<hr>';
case 'heading': }
return '<h' + token.depth + '>'
case 'heading': {
return '<h'
+ token.depth
+ '>'
+ inline.lexer(token.text) + inline.lexer(token.text)
+ '</h' + token.depth + '>'; + '</h'
case 'block': + token.depth
+ '>';
}
case 'block': {
return '<pre><code>' return '<pre><code>'
+ escape(token.text) + escape(token.text)
+ '</code></pre>'; + '</code></pre>';
case 'blockquote_start': }
case 'blockquote_start': {
var body = []; var body = [];
while (next().type !== 'blockquote_end') { while (next().type !== 'blockquote_end') {
body.push(tok()); body.push(tok());
} }
return '<blockquote>' return '<blockquote>'
+ body.join('') + body.join('')
+ '</blockquote>'; + '</blockquote>';
case 'list_start': }
case 'list_start': {
var type = token.ordered ? 'ol' : 'ul' var type = token.ordered ? 'ol' : 'ul'
, body = []; , body = [];
while (next().type !== 'list_end') { while (next().type !== 'list_end') {
body.push(tok()); body.push(tok());
} }
return '<' + type + '>'
return '<'
+ type
+ '>'
+ body.join('') + body.join('')
+ '</' + type + '>'; + '</'
case 'list_item_start': + type
+ '>';
}
case 'list_item_start': {
var body = []; var body = [];
while (next().type !== 'list_item_end') { while (next().type !== 'list_item_end') {
body.push(token.type === 'text' body.push(token.type === 'text'
? text() ? text()
: tok()); : tok());
} }
return '<li>' return '<li>'
+ body.join(' ') + body.join(' ')
+ '</li>'; + '</li>';
case 'loose_item_start': }
case 'loose_item_start': {
var body = []; var body = [];
while (next().type !== 'list_item_end') { while (next().type !== 'list_item_end') {
body.push(tok()); body.push(tok());
} }
return '<li>' return '<li>'
+ body.join(' ') + body.join(' ')
+ '</li>'; + '</li>';
case 'html': }
case 'html': {
return inline.lexer(token.text); return inline.lexer(token.text);
case 'text': }
case 'text': {
return '<p>' return '<p>'
+ text() + text()
+ '</p>'; + '</p>';
} }
}
}; };
var text = function() { var text = function() {