mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
* 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:
@@ -1251,6 +1251,11 @@ describe("A begin/end parser", function() {
|
||||
it("should allow \\cr as a line terminator", function() {
|
||||
expect("\\begin{matrix}a&b\\cr c&d\\end{matrix}").toParse();
|
||||
});
|
||||
|
||||
it("should eat a final newline", function() {
|
||||
const m3 = getParsed("\\begin{matrix}a&b\\\\ c&d \\\\ \\end{matrix}")[0];
|
||||
expect(m3.value.body.length).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("A sqrt parser", function() {
|
||||
@@ -2409,6 +2414,10 @@ describe("An aligned environment", function() {
|
||||
.toNotParse();
|
||||
});
|
||||
|
||||
it("should not eat the last row when its first cell is empty", function() {
|
||||
const ae = getParsed("\\begin{aligned}&E_1 & (1)\\\\&E_2 & (2)\\\\E_3 & (3)\\end{aligned}")[0];
|
||||
expect(ae.value.body.length).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe("A parser that does not throw on unsupported commands", function() {
|
||||
|
Reference in New Issue
Block a user