Skip to content

Commit 6cf11ea

Browse files
committed
Merge branch 'develop'
2 parents 9f588aa + 5912db4 commit 6cf11ea

File tree

8 files changed

+79
-29
lines changed

8 files changed

+79
-29
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_js:
33
- 17
44
sudo: false
55
script:
6+
- components/bin/version
67
- npm install
78
- npm run compile
89
- npm run make-components

components/bin/version

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#! /usr/bin/env node
2+
3+
/*************************************************************
4+
*
5+
* Copyright (c) 2022 The MathJax Consortium
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
/**
21+
* @fileoverview Creates the version.ts file from the package version number
22+
*
23+
* @author [email protected] (Davide Cervone)
24+
*/
25+
26+
27+
const fs = require('fs');
28+
const path = require('path');
29+
30+
const package = path.resolve(__dirname, '..', '..', 'package.json');
31+
const version = require(package).version;
32+
33+
const lines = `/*************************************************************
34+
*
35+
* Copyright (c) 2022 The MathJax Consortium
36+
*
37+
* Licensed under the Apache License, Version 2.0 (the "License");
38+
* you may not use this file except in compliance with the License.
39+
* You may obtain a copy of the License at
40+
*
41+
* http://www.apache.org/licenses/LICENSE-2.0
42+
*
43+
* Unless required by applicable law or agreed to in writing, software
44+
* distributed under the License is distributed on an "AS IS" BASIS,
45+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46+
* See the License for the specific language governing permissions and
47+
* limitations under the License.
48+
*/
49+
50+
/**
51+
* @fileoverview The version of MathJax (used to tell what version a component
52+
* was compiled against).
53+
*
54+
* @author [email protected] (Davide Cervone)
55+
*/
56+
57+
export const VERSION = '${version}';
58+
`;
59+
60+
fs.writeFileSync(path.resolve(__dirname, '..', '..', 'ts', 'components', 'version.ts'), lines);

components/webpack.common.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ function quoteRE(string) {
4646
const PLUGINS = function (js, dir) {
4747
const mjdir = path.resolve(__dirname, '..', 'js');
4848
const jsdir = path.resolve(dir, js);
49-
const package = path.resolve(__dirname, '..', 'package.json');
5049

5150
//
5251
// Record the js directory for the pack command
5352
//
5453
return [new webpack.DefinePlugin({
55-
__JSDIR__: jsdir,
56-
PACKAGE_VERSION: `'${require(package).version}'`
54+
__JSDIR__: jsdir
5755
})];
5856
};
5957

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mathjax-full",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
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",

ts/components/startup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export interface MathJaxObject extends MJObject {
9999
extendHandler(extend: HandlerExtension): void;
100100
toMML(node: MmlNode): string;
101101
defaultReady(): void;
102-
defaultPageReady(): void,
102+
defaultPageReady(): Promise<void>;
103103
getComponents(): void;
104104
makeMethods(): void;
105105
makeTypesetMethods(): void;

ts/components/version.ts

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*************************************************************
22
*
3-
* Copyright (c) 2018-2022 The MathJax Consortium
3+
* Copyright (c) 2022 The MathJax Consortium
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -22,23 +22,4 @@
2222
* @author [email protected] (Davide Cervone)
2323
*/
2424

25-
declare const PACKAGE_VERSION: string; // provided by webpack via DefinePlugin
26-
27-
export const VERSION = (
28-
typeof PACKAGE_VERSION === 'undefined' ?
29-
//
30-
// This will not be included in the webpack version, so only runs in node
31-
//
32-
(function () {
33-
//
34-
// Look up the version from the package.json file
35-
//
36-
/* tslint:disable-next-line:no-eval */
37-
const load = eval('require');
38-
/* tslint:disable-next-line:no-eval */
39-
const dirname = eval('__dirname');
40-
const path = load('path');
41-
return load(path.resolve(dirname, '..', '..', 'package.json')).version;
42-
})() :
43-
PACKAGE_VERSION
44-
);
25+
export const VERSION = '3.2.2';

ts/input/mathml/mml3/mml3.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ export class Mml3<N, T, D> {
7373
const parsed = document.adaptor.parse(Mml3.XSLT, 'text/xml') as any as Node;
7474
processor.importStylesheet(parsed);
7575
this.transform = (node: N) => {
76-
const div = document.adaptor.node('div', {}, [document.adaptor.clone(node)]);
76+
const adaptor = document.adaptor;
77+
const div = adaptor.node('div', {}, [adaptor.clone(node)]);
7778
const mml = processor.transformToDocument(div as any as Node) as any as N;
78-
return document.adaptor.firstChild(mml) as N;
79+
return adaptor.tags(mml, 'math')[0];
7980
};
8081
}
8182
}

ts/ui/lazy/LazyHandler.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ export function LazyMathItemMixin<N, T, D, B extends Constructor<HTMLMathItem<N,
215215
}
216216
}
217217

218+
/**
219+
* Only update the state if restore is true or false (null is used for setting lazy states)
220+
* @override
221+
*/
222+
public state(state: number = null, restore: boolean = false) {
223+
if (restore !== null) super.state(state, restore);
224+
return super.state();
225+
}
226+
218227
/**
219228
* Initially, just insert a marker for where the math will go, and
220229
* track it in the lazy list. Then, when it comes into view,
@@ -616,7 +625,7 @@ B extends MathDocumentConstructor<HTMLDocument<N, T, D>>>(
616625
let compile = false;
617626
for (const item of this.math) {
618627
const earlier = item as LazyMathItem<N, T, D>;
619-
if (earlier === math || !earlier?.lazyCompile) {
628+
if (earlier === math || !earlier?.lazyCompile || !earlier.lazyTex) {
620629
break;
621630
}
622631
earlier.lazyCompile = false;

0 commit comments

Comments
 (0)