text block function
This commit is contained in:
parent
9527426b65
commit
70da22d078
@ -380,52 +380,64 @@ var tok = function() {
|
||||
+ '</code></pre>';
|
||||
case 'blockquote_start':
|
||||
var body = [];
|
||||
|
||||
while (next().type !== 'blockquote_end') {
|
||||
body.push(tok());
|
||||
}
|
||||
|
||||
return '<blockquote>'
|
||||
+ body.join('')
|
||||
+ '</blockquote>';
|
||||
case 'list_start':
|
||||
var body = []
|
||||
, type = token.ordered ? 'ol' : 'ul';
|
||||
var type = token.ordered ? 'ol' : 'ul'
|
||||
, body = [];
|
||||
|
||||
while (next().type !== 'list_end') {
|
||||
body.push(tok());
|
||||
}
|
||||
|
||||
return '<' + type + '>'
|
||||
+ body.join('')
|
||||
+ '</' + type + '>';
|
||||
case 'list_item_start':
|
||||
var body = [];
|
||||
|
||||
while (next().type !== 'list_item_end') {
|
||||
body.push(token.type === 'text'
|
||||
? inline.lexer(token.text)
|
||||
? text()
|
||||
: tok());
|
||||
}
|
||||
|
||||
return '<li>'
|
||||
+ body.join(' ')
|
||||
+ '</li>';
|
||||
case 'loose_item_start':
|
||||
var body = [];
|
||||
|
||||
while (next().type !== 'list_item_end') {
|
||||
body.push(tok());
|
||||
}
|
||||
|
||||
return '<li>'
|
||||
+ body.join(' ')
|
||||
+ '</li>';
|
||||
case 'html':
|
||||
return inline.lexer(token.text);
|
||||
case 'text':
|
||||
return '<p>' + text() + '</p>';
|
||||
}
|
||||
};
|
||||
|
||||
var text = function() {
|
||||
var body = [ token.text ]
|
||||
, top;
|
||||
|
||||
while ((top = tokens[tokens.length-1])
|
||||
&& top.type === 'text') {
|
||||
body.push(next().text);
|
||||
}
|
||||
return '<p>'
|
||||
+ inline.lexer(body.join('\n'))
|
||||
+ '</p>';
|
||||
}
|
||||
|
||||
return inline.lexer(body.join('\n'));
|
||||
};
|
||||
|
||||
var parse = function(src) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user