temml 0.10.20 → 0.10.21

Sign up to get free protection for your applications and to get access to all the features.
package/dist/temml.mjs CHANGED
@@ -3245,7 +3245,7 @@ defineFunction({
3245
3245
  allowedInText: true,
3246
3246
  argTypes: ["raw", "raw"]
3247
3247
  },
3248
- handler({ parser, token }, args, optArgs) {
3248
+ handler({ parser, breakOnTokenText, token }, args, optArgs) {
3249
3249
  const model = optArgs[0] && assertNodeType(optArgs[0], "raw").string;
3250
3250
  let color = "";
3251
3251
  if (model) {
@@ -3255,15 +3255,8 @@ defineFunction({
3255
3255
  color = validateColor(assertNodeType(args[0], "raw").string, parser.gullet.macros, token);
3256
3256
  }
3257
3257
 
3258
- // Set macro \current@color in current namespace to store the current
3259
- // color, mimicking the behavior of color.sty.
3260
- // This is currently used just to correctly color a \right
3261
- // that follows a \color command.
3262
- parser.gullet.macros.set("\\current@color", color);
3263
-
3264
3258
  // Parse out the implicit body that should be colored.
3265
- // Since \color nodes should not be nested, break on \color.
3266
- const body = parser.parseExpression(true, "\\color");
3259
+ const body = parser.parseExpression(true, breakOnTokenText);
3267
3260
 
3268
3261
  return {
3269
3262
  type: "color",
@@ -3803,18 +3796,10 @@ defineFunction({
3803
3796
  argTypes: ["primitive"]
3804
3797
  },
3805
3798
  handler: (context, args) => {
3806
- // \left case below triggers parsing of \right in
3807
- // `const right = parser.parseFunction();`
3808
- // uses this return value.
3809
- const color = context.parser.gullet.macros.get("\\current@color");
3810
- if (color && typeof color !== "string") {
3811
- throw new ParseError("\\current@color set to non-string in \\right");
3812
- }
3813
3799
  return {
3814
3800
  type: "leftright-right",
3815
3801
  mode: context.parser.mode,
3816
- delim: checkDelimiter(args[0], context).text,
3817
- color // undefined if not set via \color
3802
+ delim: checkDelimiter(args[0], context).text
3818
3803
  };
3819
3804
  }
3820
3805
  });
@@ -3843,8 +3828,7 @@ defineFunction({
3843
3828
  mode: parser.mode,
3844
3829
  body,
3845
3830
  left: delim.text,
3846
- right: right.delim,
3847
- rightColor: right.color
3831
+ right: right.delim
3848
3832
  };
3849
3833
  },
3850
3834
  mathmlBuilder: (group, style) => {
@@ -3867,7 +3851,6 @@ defineFunction({
3867
3851
  if (group.right === "\u2216" || group.right.indexOf("arrow") > -1) {
3868
3852
  rightNode.setAttribute("stretchy", "true");
3869
3853
  }
3870
- if (group.rightColor) { rightNode.style.color = group.rightColor; }
3871
3854
  inner.push(rightNode);
3872
3855
 
3873
3856
  return makeRow(inner);
@@ -13159,7 +13142,7 @@ class Style {
13159
13142
  * https://mit-license.org/
13160
13143
  */
13161
13144
 
13162
- const version = "0.10.20";
13145
+ const version = "0.10.21";
13163
13146
 
13164
13147
  function postProcess(block) {
13165
13148
  const labelMap = {};
@@ -14,7 +14,7 @@
14
14
  * https://mit-license.org/
15
15
  */
16
16
 
17
- const version = "0.10.20";
17
+ const version = "0.10.21";
18
18
 
19
19
  function postProcess(block) {
20
20
  const labelMap = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "temml",
3
- "version": "0.10.20",
3
+ "version": "0.10.21",
4
4
  "description": "TeX to MathML conversion in JavaScript.",
5
5
  "main": "dist/temml.js",
6
6
  "engines": {
@@ -201,7 +201,7 @@ defineFunction({
201
201
  allowedInText: true,
202
202
  argTypes: ["raw", "raw"]
203
203
  },
204
- handler({ parser, token }, args, optArgs) {
204
+ handler({ parser, breakOnTokenText, token }, args, optArgs) {
205
205
  const model = optArgs[0] && assertNodeType(optArgs[0], "raw").string
206
206
  let color = ""
207
207
  if (model) {
@@ -211,15 +211,8 @@ defineFunction({
211
211
  color = validateColor(assertNodeType(args[0], "raw").string, parser.gullet.macros, token)
212
212
  }
213
213
 
214
- // Set macro \current@color in current namespace to store the current
215
- // color, mimicking the behavior of color.sty.
216
- // This is currently used just to correctly color a \right
217
- // that follows a \color command.
218
- parser.gullet.macros.set("\\current@color", color)
219
-
220
214
  // Parse out the implicit body that should be colored.
221
- // Since \color nodes should not be nested, break on \color.
222
- const body = parser.parseExpression(true, "\\color")
215
+ const body = parser.parseExpression(true, breakOnTokenText)
223
216
 
224
217
  return {
225
218
  type: "color",
@@ -211,18 +211,10 @@ defineFunction({
211
211
  argTypes: ["primitive"]
212
212
  },
213
213
  handler: (context, args) => {
214
- // \left case below triggers parsing of \right in
215
- // `const right = parser.parseFunction();`
216
- // uses this return value.
217
- const color = context.parser.gullet.macros.get("\\current@color");
218
- if (color && typeof color !== "string") {
219
- throw new ParseError("\\current@color set to non-string in \\right");
220
- }
221
214
  return {
222
215
  type: "leftright-right",
223
216
  mode: context.parser.mode,
224
- delim: checkDelimiter(args[0], context).text,
225
- color // undefined if not set via \color
217
+ delim: checkDelimiter(args[0], context).text
226
218
  };
227
219
  }
228
220
  });
@@ -251,8 +243,7 @@ defineFunction({
251
243
  mode: parser.mode,
252
244
  body,
253
245
  left: delim.text,
254
- right: right.delim,
255
- rightColor: right.color
246
+ right: right.delim
256
247
  };
257
248
  },
258
249
  mathmlBuilder: (group, style) => {
@@ -275,7 +266,6 @@ defineFunction({
275
266
  if (group.right === "\u2216" || group.right.indexOf("arrow") > -1) {
276
267
  rightNode.setAttribute("stretchy", "true")
277
268
  }
278
- if (group.rightColor) { rightNode.style.color = group.rightColor }
279
269
  inner.push(rightNode)
280
270
 
281
271
  return mml.makeRow(inner);
@@ -8,7 +8,7 @@
8
8
  * https://mit-license.org/
9
9
  */
10
10
 
11
- export const version = "0.10.20";
11
+ export const version = "0.10.21";
12
12
 
13
13
  export function postProcess(block) {
14
14
  const labelMap = {}