|
@ -29,7 +29,6 @@ function State(src, parser, tokens, options, env) { |
|
|
this.bMarks = []; // line begin offsets for fast jumps
|
|
|
this.bMarks = []; // line begin offsets for fast jumps
|
|
|
this.eMarks = []; // line end offsets for fast jumps
|
|
|
this.eMarks = []; // line end offsets for fast jumps
|
|
|
this.tShift = []; // indent for each line
|
|
|
this.tShift = []; // indent for each line
|
|
|
this.bqMarks = []; // blockquote nesting level for each line (number of '>')
|
|
|
|
|
|
|
|
|
|
|
|
// block parser variables
|
|
|
// block parser variables
|
|
|
this.blkIndent = 0; // required block content indent
|
|
|
this.blkIndent = 0; // required block content indent
|
|
@ -38,7 +37,6 @@ function State(src, parser, tokens, options, env) { |
|
|
this.lineMax = 0; // lines count
|
|
|
this.lineMax = 0; // lines count
|
|
|
this.tight = false; // loose/tight mode for lists
|
|
|
this.tight = false; // loose/tight mode for lists
|
|
|
this.listMode = false; // if true, block parser stops on two newlines
|
|
|
this.listMode = false; // if true, block parser stops on two newlines
|
|
|
this.bqLevel = 0; // blockquote nesting level for currently tokenized block
|
|
|
|
|
|
|
|
|
|
|
|
this.level = 0; |
|
|
this.level = 0; |
|
|
|
|
|
|
|
@ -89,10 +87,6 @@ function State(src, parser, tokens, options, env) { |
|
|
this.tShift.push(0); |
|
|
this.tShift.push(0); |
|
|
|
|
|
|
|
|
this.lineMax = this.bMarks.length - 1; // don't count last fake line
|
|
|
this.lineMax = this.bMarks.length - 1; // don't count last fake line
|
|
|
|
|
|
|
|
|
for (start = this.bMarks.length; start > 0; start--) { |
|
|
|
|
|
this.bqMarks.push(0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
State.prototype.isEmpty = function isEmpty(line) { |
|
|
State.prototype.isEmpty = function isEmpty(line) { |
|
@ -136,7 +130,7 @@ State.prototype.skipCharsBack = function skipCharsBack(pos, code, min) { |
|
|
|
|
|
|
|
|
// cut lines range from source.
|
|
|
// cut lines range from source.
|
|
|
State.prototype.getLines = function getLines(begin, end, indent, keepLastLF) { |
|
|
State.prototype.getLines = function getLines(begin, end, indent, keepLastLF) { |
|
|
var i, first, last, queue, |
|
|
var i, first, last, queue, shift, |
|
|
line = begin; |
|
|
line = begin; |
|
|
|
|
|
|
|
|
if (begin >= end) { |
|
|
if (begin >= end) { |
|
@ -153,7 +147,11 @@ State.prototype.getLines = function getLines(begin, end, indent, keepLastLF) { |
|
|
queue = new Array(end - begin); |
|
|
queue = new Array(end - begin); |
|
|
|
|
|
|
|
|
for (i = 0; line < end; line++, i++) { |
|
|
for (i = 0; line < end; line++, i++) { |
|
|
first = this.bMarks[line] + Math.min(this.tShift[line], indent); |
|
|
shift = this.tShift[line]; |
|
|
|
|
|
if (shift > indent) { shift = indent; } |
|
|
|
|
|
if (shift < 0) { shift = 0; } |
|
|
|
|
|
|
|
|
|
|
|
first = this.bMarks[line] + shift; |
|
|
|
|
|
|
|
|
if (line + 1 < end || keepLastLF) { |
|
|
if (line + 1 < end || keepLastLF) { |
|
|
// No need for bounds check because we have fake entry on tail.
|
|
|
// No need for bounds check because we have fake entry on tail.
|
|
|