commit b5ef06b52d626074d1fd5f4414a952de3b8b3a2c
parent 4154c370ec1ac120480dde532dedfbed4b734fd8
Author: Emily Eisenberg <emily@khanacademy.org>
Date: Fri, 28 Mar 2014 23:43:08 -0400
Fix our getTypeOfGroup function
Add in the missing `'sizing'` entry, put the `'text'` entry in the correct
place, and replace `groupToType.ord` (a null value) with `groupToType.mathord`
(something real).
Test Plan:
- See that `^3+` now puts the correct space before the `+`
- See the new huxley test works, and nothing else has changed
Auditors: alpert
Diffstat:
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/buildTree.js b/buildTree.js
@@ -47,7 +47,7 @@ var groupToType = {
textord: "mord",
bin: "mbin",
rel: "mrel",
- amsrel: "mrel",
+ text: "mord",
open: "mopen",
close: "mclose",
frac: "minner",
@@ -55,20 +55,21 @@ var groupToType = {
punct: "mpunct",
ordgroup: "mord",
namedfn: "mop",
- katex: "mord",
- text: "mord",
+ katex: "mord"
};
var getTypeOfGroup = function(group) {
if (group == null) {
// Like when typesetting $^3$
- return groupToType.ord;
+ return groupToType.mathord;
} else if (group.type === "supsub") {
return getTypeOfGroup(group.value.base);
} else if (group.type === "llap" || group.type === "rlap") {
return getTypeOfGroup(group.value);
} else if (group.type === "color") {
return getTypeOfGroup(group.value.value);
+ } else if (group.type === "sizing") {
+ return getTypeOfGroup(group.value.value);
} else {
return groupToType[group.type];
}
diff --git a/test/huxley/Huxleyfile b/test/huxley/Huxleyfile
@@ -20,7 +20,7 @@ url=http://localhost:7936/test/huxley/test.html?m=\alpha\beta\gamma\omega
url=http://localhost:7936/test/huxley/test.html?m=a+b-c\cdot d/e
[Spacing]
-url=http://localhost:7936/test/huxley/test.html?m=[-1][1-1]1%%3D1(%%3D1)\lvert a\rvert~b
+url=http://localhost:7936/test/huxley/test.html?m=^3+[-1][1-1]1%%3D1(%%3D1)\lvert a\rvert~b
[Functions]
url=http://localhost:7936/test/huxley/test.html?m=\sin\cos\tan\ln\log
diff --git a/test/huxley/Spacing.huxley/screenshot0.png b/test/huxley/Spacing.huxley/screenshot0.png
Binary files differ.