Skip to content

Commit 0e98ab6

Browse files
committed
Merge branch 'develop' into master for v3.1.1
2 parents 3221300 + cc9e40c commit 0e98ab6

File tree

20 files changed

+74
-37
lines changed

20 files changed

+74
-37
lines changed

components/src/input/asciimath/asciimath.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import './lib/asciimath.js';
33
import {AsciiMath} from '../../../../js/input/asciimath.js';
44

55
if (MathJax.startup) {
6-
MathJax.Hub.Config({AsciiMath: MathJax.config.asciimath || {}});
76
MathJax.startup.registerConstructor('asciimath', AsciiMath);
87
MathJax.startup.useInput('asciimath');
98
}

components/src/input/tex-full/tex-full.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import './lib/tex-full.js';
22

33
import {registerTeX} from '../tex/register.js';
4+
import {rename} from '../tex/extensions/rename.js';
45
import {Loader} from '../../../../js/components/loader.js';
56
import {AllPackages} from '../../../../js/input/tex/AllPackages.js';
67
import '../../../../js/input/tex/require/RequireConfiguration.js';
@@ -12,3 +13,7 @@ Loader.preLoad(
1213
);
1314

1415
registerTeX(['require',...AllPackages]);
16+
rename('amsCd', 'amscd', true);
17+
rename('colorV2', 'colorv2', false);
18+
rename('configMacros', 'configmacros', false);
19+
rename('tagFormat', 'tagformat', true);

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mathjax-full",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "Beautiful and accessible math in all browsers. MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all browsers and in server-side node applications. This package includes the source code as well as the packaged components.",
55
"license": "Apache-2.0",
66
"main": "components/src/node-main/node-main.js",
@@ -61,6 +61,6 @@
6161
"dependencies": {
6262
"esm": "^3.2.25",
6363
"mj-context-menu": "^0.6.1",
64-
"speech-rule-engine": "^3.1.0"
64+
"speech-rule-engine": "^3.1.1"
6565
}
6666
}

ts/components/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ if (typeof global.MathJax === 'undefined') {
127127
*/
128128
if (!(global.MathJax as MathJaxObject).version) {
129129
global.MathJax = {
130-
version: '3.0.5',
130+
version: '3.1.1',
131131
_: {},
132132
config: global.MathJax
133133
};

ts/core/MathDocument.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,9 @@ export abstract class AbstractMathDocument<N, T, D> implements MathDocument<N, T
687687
* @override
688688
*/
689689
public convert(math: string, options: OptionList = {}) {
690-
let {format, display, end, ex, em, containerWidth, lineWidth, scale} = userOptions({
690+
let {format, display, end, ex, em, containerWidth, lineWidth, scale, family} = userOptions({
691691
format: this.inputJax[0].name, display: true, end: STATE.LAST,
692-
em: 16, ex: 8, containerWidth: null, lineWidth: 1000000, scale: 1
692+
em: 16, ex: 8, containerWidth: null, lineWidth: 1000000, scale: 1, family: ''
693693
}, options);
694694
if (containerWidth === null) {
695695
containerWidth = 80 * ex;
@@ -698,6 +698,12 @@ export abstract class AbstractMathDocument<N, T, D> implements MathDocument<N, T
698698
const mitem = new this.options.MathItem(math, jax, display);
699699
mitem.start.node = this.adaptor.body(this.document);
700700
mitem.setMetrics(em, ex, containerWidth, lineWidth, scale);
701+
if (this.outputJax.options.mtextInheritFont) {
702+
mitem.outputData.mtextFamily = family;
703+
}
704+
if (this.outputJax.options.merrorInheritFont) {
705+
mitem.outputData.merrorFamily = family;
706+
}
701707
mitem.convert(this, end);
702708
return (mitem.typesetRoot || mitem.root);
703709
}

ts/input/asciimath.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class AsciiMath<N, T, D> extends AbstractInputJax<N, T, D> {
6161
* @override
6262
*/
6363
constructor(options: OptionList) {
64-
let [am, find] = separateOptions(options, FindAsciiMath.OPTIONS);
64+
let [ , find, am] = separateOptions(options, FindAsciiMath.OPTIONS, AsciiMath.OPTIONS);
6565
super(am);
6666
this.findAsciiMath = this.options['FindAsciiMath'] || new FindAsciiMath(find);
6767
}

ts/input/asciimath/mathjax2/input/AsciiMath.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
MathJax = Object.assign(global.MathJax || {}, require("../legacy/MathJax.js").MathJax);
22

3+
//
4+
// Load component-based configuration, if any
5+
//
6+
if (MathJax.config && MathJax.config.asciimath) {
7+
MathJax.Hub.Config({AsciiMath: MathJax.config.asciimath});
8+
}
9+
310
MathJax.Ajax.Preloading(
411
"[MathJax]/jax/input/AsciiMath/config.js",
512
"[MathJax]/jax/input/AsciiMath/jax.js",
@@ -18,12 +25,12 @@ var factory = new MmlFactory();
1825
exports.LegacyAsciiMath = {
1926
Compile: function (am,display) {
2027
var script = {
21-
type:"math/asciimath",
28+
type: "math/asciimath",
2229
innerText: am,
2330
MathJax: {}
2431
};
2532
var node = MathJax.InputJax.AsciiMath.Translate(script).root.toMmlNode(factory);
26-
node.setInheritedAttributes();
33+
node.setInheritedAttributes({}, display, 0, false);
2734
return node;
2835
},
2936
Translate: function (am,display) {

ts/input/asciimath/mathjax2/legacy/jax/element/MmlNode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
if (copy[names[i]] === 1 && !defaults.hasOwnProperty(names[i])) continue;
5959
value = (this.attr||{})[names[i]];
6060
if (value == null) value = this[names[i]];
61+
if (value === 'true' || value === 'false') value = (value === 'true');
6162
if (value != null) node.attributes.set(names[i],value);
6263
}
6364
},

ts/input/tex/ParseUtil.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,16 @@ namespace ParseUtil {
236236
* @param {TexParser} parser The calling parser.
237237
* @param {string} text The text in the math expression to parse.
238238
* @param {number|string=} level The scriptlevel.
239+
* @param {string} font The mathvariant to use
239240
* @return {MmlNode[]} The nodes corresponding to the internal math expression.
240241
*/
241242
export function internalMath(parser: TexParser, text: string,
242-
level?: number | string): MmlNode[] {
243+
level?: number | string, font?: string): MmlNode[] {
243244
if (parser.configuration.options.internalMath) {
244-
return parser.configuration.options.internalMath(parser, text, level);
245+
return parser.configuration.options.internalMath(parser, text, level, font);
245246
}
246-
let def = (parser.stack.env['font'] ? {mathvariant: parser.stack.env['font']} : {});
247+
let mathvariant = font || parser.stack.env.font;
248+
let def = (mathvariant ? {mathvariant} : {});
247249
let mml: MmlNode[] = [], i = 0, k = 0, c, node, match = '', braces = 0;
248250
if (text.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)) {
249251
while (i < text.length) {

0 commit comments

Comments
 (0)