temml 0.11.6 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  | Library | Minified JavaScript + CSS |
4
4
  |:--------------|:-------------------------:|
5
- | Temml | 169 KB |
5
+ | Temml | 168 KB |
6
6
  | MathJax 2.7.5 | 338 KB |
7
7
  | KaTeX | 280 KB |
8
8
  | TeXZilla | 168 KB |
package/dist/temml.cjs CHANGED
@@ -8994,88 +8994,6 @@ defineFunction({
8994
8994
  mathmlBuilder: mathmlBuilder$4
8995
8995
  });
8996
8996
 
8997
- defineFunction({
8998
- type: "href",
8999
- names: ["\\href"],
9000
- props: {
9001
- numArgs: 2,
9002
- argTypes: ["url", "original"],
9003
- allowedInText: true
9004
- },
9005
- handler: ({ parser, token }, args) => {
9006
- const body = args[1];
9007
- const href = assertNodeType(args[0], "url").url;
9008
-
9009
- if (
9010
- !parser.settings.isTrusted({
9011
- command: "\\href",
9012
- url: href
9013
- })
9014
- ) {
9015
- throw new ParseError(`Function "\\href" is not trusted`, token)
9016
- }
9017
-
9018
- return {
9019
- type: "href",
9020
- mode: parser.mode,
9021
- href,
9022
- body: ordargument(body)
9023
- };
9024
- },
9025
- mathmlBuilder: (group, style) => {
9026
- const math = new MathNode("math", [buildExpressionRow(group.body, style)]);
9027
- const anchorNode = new AnchorNode(group.href, [], [math]);
9028
- return anchorNode
9029
- }
9030
- });
9031
-
9032
- defineFunction({
9033
- type: "href",
9034
- names: ["\\url"],
9035
- props: {
9036
- numArgs: 1,
9037
- argTypes: ["url"],
9038
- allowedInText: true
9039
- },
9040
- handler: ({ parser, token }, args) => {
9041
- const href = assertNodeType(args[0], "url").url;
9042
-
9043
- if (
9044
- !parser.settings.isTrusted({
9045
- command: "\\url",
9046
- url: href
9047
- })
9048
- ) {
9049
- throw new ParseError(`Function "\\url" is not trusted`, token)
9050
- }
9051
-
9052
- const chars = [];
9053
- for (let i = 0; i < href.length; i++) {
9054
- let c = href[i];
9055
- if (c === "~") {
9056
- c = "\\textasciitilde";
9057
- }
9058
- chars.push({
9059
- type: "textord",
9060
- mode: "text",
9061
- text: c
9062
- });
9063
- }
9064
- const body = {
9065
- type: "text",
9066
- mode: parser.mode,
9067
- font: "\\texttt",
9068
- body: chars
9069
- };
9070
- return {
9071
- type: "href",
9072
- mode: parser.mode,
9073
- href,
9074
- body: ordargument(body)
9075
- };
9076
- }
9077
- });
9078
-
9079
8997
  defineFunction({
9080
8998
  type: "html",
9081
8999
  names: ["\\class", "\\id", "\\style", "\\data"],
@@ -9333,17 +9251,24 @@ defineFunction({
9333
9251
  },
9334
9252
  mathmlBuilder(group, style) {
9335
9253
  const dimension = calculateSize(group.dimension, style);
9336
- const ch = dimension.unit === "em" ? spaceCharacter(dimension.number) : "";
9254
+ const ch = dimension.number > 0 && dimension.unit === "em"
9255
+ ? spaceCharacter(dimension.number)
9256
+ : "";
9337
9257
  if (group.mode === "text" && ch.length > 0) {
9338
9258
  const character = new mathMLTree.TextNode(ch);
9339
9259
  return new mathMLTree.MathNode("mtext", [character]);
9340
9260
  } else {
9341
- const node = new mathMLTree.MathNode("mspace");
9342
- node.setAttribute("width", dimension.number + dimension.unit);
9343
- if (dimension.number < 0) {
9261
+ if (dimension.number >= 0) {
9262
+ const node = new mathMLTree.MathNode("mspace");
9263
+ node.setAttribute("width", dimension.number + dimension.unit);
9264
+ return node
9265
+ } else {
9266
+ // Don't use <mspace> or <mpadded> because
9267
+ // WebKit recognizes negative left margin only on a <mrow> element
9268
+ const node = new mathMLTree.MathNode("mrow");
9344
9269
  node.style.marginLeft = dimension.number + dimension.unit;
9270
+ return node
9345
9271
  }
9346
- return node;
9347
9272
  }
9348
9273
  }
9349
9274
  });
@@ -13974,7 +13899,7 @@ class Style {
13974
13899
  * https://mit-license.org/
13975
13900
  */
13976
13901
 
13977
- const version = "0.11.06";
13902
+ const version = "0.11.07";
13978
13903
 
13979
13904
  function postProcess(block) {
13980
13905
  const labelMap = {};
package/dist/temml.js CHANGED
@@ -7081,88 +7081,6 @@ var temml = (function () {
7081
7081
  mathmlBuilder: mathmlBuilder$4
7082
7082
  });
7083
7083
 
7084
- defineFunction({
7085
- type: "href",
7086
- names: ["\\href"],
7087
- props: {
7088
- numArgs: 2,
7089
- argTypes: ["url", "original"],
7090
- allowedInText: true
7091
- },
7092
- handler: ({ parser, token }, args) => {
7093
- const body = args[1];
7094
- const href = assertNodeType(args[0], "url").url;
7095
-
7096
- if (
7097
- !parser.settings.isTrusted({
7098
- command: "\\href",
7099
- url: href
7100
- })
7101
- ) {
7102
- throw new ParseError(`Function "\\href" is not trusted`, token)
7103
- }
7104
-
7105
- return {
7106
- type: "href",
7107
- mode: parser.mode,
7108
- href,
7109
- body: ordargument(body)
7110
- };
7111
- },
7112
- mathmlBuilder: (group, style) => {
7113
- const math = new MathNode("math", [buildExpressionRow(group.body, style)]);
7114
- const anchorNode = new AnchorNode(group.href, [], [math]);
7115
- return anchorNode
7116
- }
7117
- });
7118
-
7119
- defineFunction({
7120
- type: "href",
7121
- names: ["\\url"],
7122
- props: {
7123
- numArgs: 1,
7124
- argTypes: ["url"],
7125
- allowedInText: true
7126
- },
7127
- handler: ({ parser, token }, args) => {
7128
- const href = assertNodeType(args[0], "url").url;
7129
-
7130
- if (
7131
- !parser.settings.isTrusted({
7132
- command: "\\url",
7133
- url: href
7134
- })
7135
- ) {
7136
- throw new ParseError(`Function "\\url" is not trusted`, token)
7137
- }
7138
-
7139
- const chars = [];
7140
- for (let i = 0; i < href.length; i++) {
7141
- let c = href[i];
7142
- if (c === "~") {
7143
- c = "\\textasciitilde";
7144
- }
7145
- chars.push({
7146
- type: "textord",
7147
- mode: "text",
7148
- text: c
7149
- });
7150
- }
7151
- const body = {
7152
- type: "text",
7153
- mode: parser.mode,
7154
- font: "\\texttt",
7155
- body: chars
7156
- };
7157
- return {
7158
- type: "href",
7159
- mode: parser.mode,
7160
- href,
7161
- body: ordargument(body)
7162
- };
7163
- }
7164
- });
7165
-
7166
7084
  defineFunction({
7167
7085
  type: "html",
7168
7086
  names: ["\\class", "\\id", "\\style", "\\data"],
@@ -7420,17 +7338,24 @@ var temml = (function () {
7420
7338
  },
7421
7339
  mathmlBuilder(group, style) {
7422
7340
  const dimension = calculateSize(group.dimension, style);
7423
- const ch = dimension.unit === "em" ? spaceCharacter(dimension.number) : "";
7341
+ const ch = dimension.number > 0 && dimension.unit === "em"
7342
+ ? spaceCharacter(dimension.number)
7343
+ : "";
7424
7344
  if (group.mode === "text" && ch.length > 0) {
7425
7345
  const character = new mathMLTree.TextNode(ch);
7426
7346
  return new mathMLTree.MathNode("mtext", [character]);
7427
7347
  } else {
7428
- const node = new mathMLTree.MathNode("mspace");
7429
- node.setAttribute("width", dimension.number + dimension.unit);
7430
- if (dimension.number < 0) {
7348
+ if (dimension.number >= 0) {
7349
+ const node = new mathMLTree.MathNode("mspace");
7350
+ node.setAttribute("width", dimension.number + dimension.unit);
7351
+ return node
7352
+ } else {
7353
+ // Don't use <mspace> or <mpadded> because
7354
+ // WebKit recognizes negative left margin only on a <mrow> element
7355
+ const node = new mathMLTree.MathNode("mrow");
7431
7356
  node.style.marginLeft = dimension.number + dimension.unit;
7357
+ return node
7432
7358
  }
7433
- return node;
7434
7359
  }
7435
7360
  }
7436
7361
  });
@@ -12061,7 +11986,7 @@ var temml = (function () {
12061
11986
  * https://mit-license.org/
12062
11987
  */
12063
11988
 
12064
- const version = "0.11.06";
11989
+ const version = "0.11.07";
12065
11990
 
12066
11991
  function postProcess(block) {
12067
11992
  const labelMap = {};