Browse Source

Cleanup

pull/14/head
Vitaly Puzrin 10 years ago
parent
commit
b9d3828a5d
  1. 1
      lib/parser_block.js
  2. 1
      lib/parser_ref.js
  3. 11
      lib/renderer.js
  4. 4
      lib/rules_block/fences.js

1
lib/parser_block.js

@ -124,7 +124,6 @@ ParserBlock.prototype.parse = function (src, options, env) {
src = src.replace(/\u2424/g, '\n');
}
// TODO: benchmark it
// Replace tabs with proper number of spaces (1..4)
if (src.indexOf('\t') >= 0) {
src = src.replace(/[\n\t]/g, function (match, offset) {

1
lib/parser_ref.js

@ -17,7 +17,6 @@ module.exports = function parse_reference(str, parser, options, env) {
if (str.charCodeAt(0) !== 0x5B/* [ */) { return -1; }
// TODO: benchmark this
if (str.indexOf(']:') === -1) { return -1; }
state = new StateInline(str, parser, options, env);

11
lib/renderer.js

@ -229,7 +229,7 @@ function Renderer() {
Renderer.prototype.render = function (tokens, options) {
var i, len, name, next,
var i, len, name,
result = '',
rules = this.rules,
tightStack = [];
@ -264,13 +264,8 @@ Renderer.prototype.render = function (tokens, options) {
}
if (name === 'paragraph_close' && tight) {
// Quick hack - texts should have LF if followed by blocks
if (i + 1 < tokens.length) {
next = tokens[i + 1].type;
if (next === 'bullet_list_open' ||
next === 'ordered_list_open' ||
next === 'blockquote_open') {
result += '\n';
}
if (tokens[i + 1].type !== 'list_item_close') {
result += '\n';
}
continue;

4
lib/rules_block/fences.js

@ -45,10 +45,6 @@ module.exports = function fences(state, startLine, endLine, silent) {
if (nextLine >= endLine) {
// unclosed block should be autoclosed by end of document.
// also block seems to be autoclosed by end of parent
/*if (state.blkLevel === 0) {
break;
}
return false;*/
break;
}

Loading…
Cancel
Save