| 9145 | */ |
| 9146 | const _environments = {}; |
| 9147 | function defineEnvironment(_ref) { |
| 9148 | let type = _ref.type, |
| 9149 | names = _ref.names, |
| 9150 | props = _ref.props, |
| 9151 | handler = _ref.handler, |
| 9152 | htmlBuilder = _ref.htmlBuilder, |
| 9153 | mathmlBuilder = _ref.mathmlBuilder; |
| 9154 | // Set default values of environments. |
| 9155 | const data = { |
| 9156 | type, |
| 9157 | numArgs: props.numArgs || 0, |
| 9158 | greediness: 1, |
| 9159 | allowedInText: false, |
| 9160 | numOptionalArgs: 0, |
| 9161 | handler |
| 9162 | }; |
| 9163 | |
| 9164 | for (let i = 0; i < names.length; ++i) { |
| 9165 | // TODO: The value type of _environments should be a type union of all |
| 9166 | // possible `EnvSpec<>` possibilities instead of `EnvSpec<*>`, which is |
| 9167 | // an existential type. |
| 9168 | // $FlowFixMe |
| 9169 | _environments[names[i]] = data; |
| 9170 | } |
| 9171 | |
| 9172 | if (htmlBuilder) { |
| 9173 | _htmlGroupBuilders[type] = htmlBuilder; |
| 9174 | } |
| 9175 | |
| 9176 | if (mathmlBuilder) { |
| 9177 | _mathmlGroupBuilders[type] = mathmlBuilder; |
| 9178 | } |
| 9179 | } |
| 9180 | |
| 9181 | function getHLines(parser) { |
| 9182 | // Return an array. The array length = number of hlines. |