* Fix #946

Issue #946 identified a case in which `array.js` ate the final row of a well-written `aligned` environment.

This PR modifies code from PR #479 to fix this problem and to also continue to eat a trailing `\\` submitted to any environment.

* Fix bug and add tests

* Add final newline to test.

Doh!
This commit is contained in:
Ron Kok
2017-11-11 16:12:13 -08:00
committed by Kevin Barabash
parent 991bfd5669
commit 3e344535ff
2 changed files with 12 additions and 3 deletions

View File

@@ -62,10 +62,10 @@ function parseArray(
} 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;
const lastRow = body[body.length - 1];
if (body.length > 1
&& lastRow.value.length === 1
&& lastRow.value[0].value.length === 0) {
&& lastRow.length === 1
&& lastRow[0].value.value[0].value.length === 0) {
body.pop();
}
break;