Fix #337 - Array/Matrix trim trailing empty line (#479)

This commit is contained in:
Christopher
2017-09-16 19:44:26 -05:00
committed by Kevin Barabash
parent db1cccdeab
commit 6e75ebdc2d
5 changed files with 13 additions and 0 deletions

View File

@@ -96,6 +96,14 @@ function parseArray(
if (next === "&") {
parser.consume();
} else if (next === "\\end") {
// Arrays terminate newlines with `\crcr` which consumes a `\cr` if
// the last line is empty.
const lastRow = body[body.length - 1][0].value;
if (body.length > 1
&& lastRow.value.length === 1
&& lastRow.value[0].value.length === 0) {
body.pop();
}
break;
} else if (next === "\\\\" || next === "\\cr") {
const cr = parser.parseFunction();