Skip to content

Commit 41a2094

Browse files
committed
Merge branch 'hotfix-beta.4' into beta.4
2 parents de6e42f + 4947914 commit 41a2094

File tree

8 files changed

+47
-17
lines changed

8 files changed

+47
-17
lines changed

components/src/input/tex-base/build.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{
22
"component": "input/tex-base",
3-
"targets": ["input/tex.ts", "input/tex"],
3+
"targets": [
4+
"input/tex.ts",
5+
"input/tex",
6+
"input/tex/base",
7+
"util/entities/n.ts",
8+
"util/entities/p.ts",
9+
"util/entities/r.ts"
10+
],
411
"exclude": ["input/tex/AllPackages.ts"],
512
"excludeSubdirs": "true"
613
}

components/src/input/tex-full/build.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"component": "input/tex-full",
3-
"targets": ["input/tex.ts", "input/tex"],
3+
"targets": [
4+
"input/tex.ts",
5+
"input/tex",
6+
"util/entities/n.ts",
7+
"util/entities/p.ts",
8+
"util/entities/r.ts"
9+
],
410
"exclude": [
511
"input/tex/tag_format",
612
"input/tex/mhchem/mhchem_parser.d.ts"

components/src/input/tex/build.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"input/tex/noundefined",
1010
"input/tex/require",
1111
"input/tex/autoload",
12-
"input/tex/config_macros"
12+
"input/tex/config_macros",
13+
"util/entities/n.ts",
14+
"util/entities/p.ts",
15+
"util/entities/r.ts"
1316
],
1417
"exclude": ["input/tex/AllPackages.ts"],
1518
"excludeSubdirs": "true"

components/src/input/tex/extensions/all-packages/all-packages.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import './lib/all-packages.js';
22

33
import {AllPackages} from '../../../../../../mathjax3/input/tex/AllPackages.js';
4+
import '../../../../../../mathjax3/input/tex/autoload/AutoloadConfiguration.js';
45
import '../../../../../../mathjax3/input/tex/require/RequireConfiguration.js';
56
import {insert} from '../../../../../../mathjax3/util/Options.js';
67

8+
if (MathJax.loader) {
9+
MathJax.loader.preLoad('[tex]/autoload', '[tex]/require');
10+
}
711
if (MathJax.startup) {
812
if (!MathJax.config.tex) {
913
MathJax.config.tex = {};
1014
}
1115
let packages = MathJax.config.tex.packages;
12-
MathJax.config.tex.packages = ['require',...AllPackages];
16+
MathJax.config.tex.packages = ['autoload', 'require', ...AllPackages];
1317
if (packages) {
1418
insert(MathJax.config.tex, {packages});
1519
}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"component": "input/tex/extensions/all-packages",
3-
"targets": ["input/tex/AllPackages.ts"]
3+
"targets": [
4+
"input/tex/AllPackages.ts",
5+
"input/tex/autoload",
6+
"input/tex/require"
7+
]
48
}
59

mathjax3-ts/components/startup.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,11 @@ export namespace Startup {
258258
export function defaultReady() {
259259
getComponents();
260260
makeMethods();
261-
if (CONFIG.typeset && MathJax.TypesetPromise) {
262-
promise = pagePromise.then(() => MathJax.TypesetPromise());
261+
if (CONFIG.pageReady) {
262+
pagePromise = pagePromise.then(CONFIG.pageReady);
263263
}
264+
promise = (CONFIG.typeset && MathJax.TypesetPromise ?
265+
pagePromise.then(MathJax.TypesetPromise) : pagePromise);
264266
};
265267

266268
/**

mathjax3-ts/input/tex/Configuration.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,14 @@ export class Configuration {
207207
register(config: Configuration, jax: TeX<any, any, any>, options: OptionList = {}) {
208208
this.append(config);
209209
config.init(this);
210-
jax.parseOptions.handlers = new SubHandlers(this);
211-
jax.parseOptions.nodeFactory.setCreators(config.nodes);
212-
defaultOptions(jax.parseOptions.options, config.options);
213-
userOptions(jax.parseOptions.options, options);
210+
const parser = jax.parseOptions;
211+
parser.handlers = new SubHandlers(this);
212+
parser.nodeFactory.setCreators(config.nodes);
213+
for (const kind of Object.keys(config.items)) {
214+
parser.itemFactory.setNodeClass(kind, config.items[kind]);
215+
}
216+
defaultOptions(parser.options, config.options);
217+
userOptions(parser.options, options);
214218
config.config(this, jax);
215219
for (const pre of config.preprocessors) {
216220
Array.isArray(pre) ? jax.preFilters.add(pre[0], pre[1]) : jax.preFilters.add(pre);

mathjax3-ts/input/tex/require/RequireConfiguration.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ const MJCONFIG = (global.MathJax ? global.MathJax.config || {} : {});
5151
* @param {string} name The name of the extension being added (e.g., '[tex]/amsCd')
5252
*/
5353
function RegisterExtension(jax: TeX<any, any, any>, name: string) {
54-
const required = jax.parseOptions.options.require.required;
55-
if (required.indexOf(name) < 0) {
56-
const extension = name.substr(6);
57-
required.push(name);
54+
const require = jax.parseOptions.options.require;
55+
const extension = name.substr(require.prefix.length);
56+
if (require.required.indexOf(extension) < 0) {
57+
require.required.push(extension);
5858
//
5959
// Register any dependencies that were loaded to handle this one
6060
//
@@ -122,8 +122,8 @@ export function RequireLoad(parser: TexParser, name: string) {
122122
*/
123123
function config(config: Configuration, jax: TeX<any, any, any>) {
124124
const options = jax.parseOptions.options.require;
125-
options.jax = jax; // \require needs access to this
126-
options.required = []; // stores the names of the packages that have been added
125+
options.jax = jax; // \require needs access to this
126+
options.required = [...jax.options.packages]; // stores the names of the packages that have been added
127127
const prefix = options.prefix;
128128
if (prefix.match(/[^_a-zA-Z0-9]/)) {
129129
throw Error('Illegal characters used in \\require prefix');

0 commit comments

Comments
 (0)