Parse single superscripts and subscripts

Summary:
Add the ability to parse lone `^x` and `_y`, etc. This basically just
involves more checking of cases in the increasingly ugly `parseAtom` function.
Also, now we manually check for the cases of double superscripts and
subscripts.

Test Plan: Make sure the tests pass. Make sure things like `^x` and `_y` parse.

Reviewers: emily

Reviewed By: emily

Differential Revision: http://phabricator.khanacademy.org/D3095
This commit is contained in:
Ben Alpert
2013-07-16 22:00:54 -07:00
parent bcd6e8687f
commit c08fadfaa9
3 changed files with 84 additions and 35 deletions

View File

@@ -27,6 +27,10 @@ var makeSpan = function(className, children) {
};
var buildGroup = function(style, color, group, prev) {
if (!group) {
return makeSpan();
}
if (group.type === "mathord") {
return makeSpan("mord" + color, [mathit(group.value)]);
} else if (group.type === "textord") {