Correct (type-wise) raisebox's usage of sizing's buildHtml. (#1361)

* Correct (type-wise) raisebox's usage of sizing's buildHtml.

* Move HTML and MathML groupTypes into defineFunction.

Currently, functions defined in functions/* import all exports from buildHtml
and buildMathML, but they should never use `groupTypes` directly as it loses
type-safety. They should instead use more type-safe `htmlBuilder`s and
`mathmlBuilder`s exported directly from other definitions `functions/*` to allow
flow to catch errors.

* Rename groupTypes to groupBuilders.
This commit is contained in:
Ashish Myles
2018-05-27 03:24:30 -04:00
committed by ylemkimon
parent d9fe716d0e
commit 9cde0336d3
6 changed files with 50 additions and 44 deletions

View File

@@ -1,6 +1,5 @@
// @flow
import {groupTypes as htmlGroupTypes} from "./buildHTML";
import {groupTypes as mathmlGroupTypes} from "./buildMathML";
import {_htmlGroupBuilders, _mathmlGroupBuilders} from "./defineFunction";
import Options from "./Options";
import ParseNode from "./ParseNode";
@@ -114,9 +113,9 @@ export default function defineEnvironment<NODETYPE: NodeType>({
_environments[names[i]] = data;
}
if (htmlBuilder) {
htmlGroupTypes[type] = htmlBuilder;
_htmlGroupBuilders[type] = htmlBuilder;
}
if (mathmlBuilder) {
mathmlGroupTypes[type] = mathmlBuilder;
_mathmlGroupBuilders[type] = mathmlBuilder;
}
}