feat(function): add allowedInArgument instead of greediness property (#2134)

* Remove `greediness` property

Use boolean `grouped` property instead, which is more consistent with 
LaTeX.

BREAKING CHANGE: \cfrac, \color, \textcolor, \colorbox, \fcolorbox are 
no longer grouped.

* Rename grouped to allowedInArgument

* Reenable tests

* Update documentation

* Fix typo

Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
This commit is contained in:
ylemkimon
2020-09-07 13:38:17 +09:00
committed by GitHub
parent 37990cc5b3
commit 5a90558116
10 changed files with 53 additions and 61 deletions

View File

@@ -849,13 +849,6 @@ describe("A color parser", function() {
expect(newColorExpression).toParse();
});
it("should have correct greediness", function() {
expect`\textcolor{red}a`.toParse();
expect`\textcolor{red}{\text{a}}`.toParse();
expect`\textcolor{red}\text{a}`.not.toParse();
expect`\textcolor{red}\frac12`.not.toParse();
});
it("should use one-argument \\color by default", function() {
expect(oldColorExpression).toParseLike`\textcolor{#fA6}{xy}`;
});
@@ -1619,7 +1612,7 @@ describe("A font parser", function() {
expect(bf.body.body[2].text).toEqual("c");
});
it("should have the correct greediness", function() {
it("should be allowed in the argument", function() {
expect`e^\mathbf{x}`.toParse();
});