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
This commit is contained in:
Emily Eisenberg 2014-03-28 23:43:08 -04:00
parent 4154c370ec
commit b5ef06b52d
3 changed files with 6 additions and 5 deletions

View File

@ -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];
}

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB