|
@ -12,18 +12,23 @@ function lineMatch(state, line, reg) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = function table(state, startLine, endLine, silent) { |
|
|
module.exports = function table(state, startLine, endLine, silent) { |
|
|
var ch, firstLineMatch, secondLineMatch, i, nextLine, m, rows, |
|
|
var ch, firstLineMatch, secondLineMatch, pos, i, nextLine, m, rows, |
|
|
aligns, t; |
|
|
aligns, t; |
|
|
|
|
|
|
|
|
// should have at least three lines
|
|
|
// should have at least three lines
|
|
|
if (startLine + 2 > endLine) { return false; } |
|
|
if (startLine + 2 > endLine) { return false; } |
|
|
|
|
|
|
|
|
if (state.tShift[startLine + 1] < state.blkIndent) { return false; } |
|
|
nextLine = startLine + 1; |
|
|
if (state.bqMarks[startLine + 1] < state.bqLevel) { return false; } |
|
|
|
|
|
|
|
|
if (state.tShift[nextLine] < state.blkIndent) { return false; } |
|
|
|
|
|
if (state.bqMarks[nextLine] < state.bqLevel) { return false; } |
|
|
|
|
|
|
|
|
// first character of the second line should be '|' or '-'
|
|
|
// first character of the second line should be '|' or '-'
|
|
|
ch = state.src.charCodeAt(state.bMarks[startLine + 1] |
|
|
|
|
|
+ state.tShift[startLine + 1]); |
|
|
pos = state.bMarks[nextLine] + state.tShift[nextLine]; |
|
|
|
|
|
if (pos >= state.eMarks[nextLine]) { return false; } |
|
|
|
|
|
|
|
|
|
|
|
ch = state.src.charCodeAt(pos); |
|
|
if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; } |
|
|
if (ch !== 0x7C/* | */ && ch !== 0x2D/* - */ && ch !== 0x3A/* : */) { return false; } |
|
|
|
|
|
|
|
|
secondLineMatch = lineMatch(state, startLine + 1, |
|
|
secondLineMatch = lineMatch(state, startLine + 1, |
|
|