Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ts/core/MathDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import { MmlFactory } from '../core/MmlTree/MmlFactory.js';
import { DOMAdaptor } from '../core/DOMAdaptor.js';
import { BitField, BitFieldClass } from '../util/BitField.js';
import { PrioritizedList } from '../util/PrioritizedList.js';
import { handleRetriesFor } from '../util/Retries.js';
import { localize } from './__locales__/Component.js';
import { Locale } from '../util/Locale.js';
import { mathjax } from '../mathjax.js';
Expand Down Expand Up @@ -883,7 +882,7 @@ export abstract class AbstractMathDocument<N, T, D> implements MathDocument<
*/
public renderPromise() {
return this.whenReady(() =>
handleRetriesFor(async () => {
mathjax.handleRetriesFor(async () => {
this.render();
await this.actionPromises();
this.clearPromises();
Expand All @@ -906,7 +905,7 @@ export abstract class AbstractMathDocument<N, T, D> implements MathDocument<
*/
public rerenderPromise(start: number = STATE.RERENDER) {
return this.whenReady(() =>
handleRetriesFor(async () => {
mathjax.handleRetriesFor(async () => {
this.rerender(start);
await this.actionPromises();
this.clearPromises();
Expand Down Expand Up @@ -962,7 +961,7 @@ export abstract class AbstractMathDocument<N, T, D> implements MathDocument<
*/
public convertPromise(math: string, options: OptionList = {}) {
return this.whenReady(() =>
handleRetriesFor(async () => {
mathjax.handleRetriesFor(async () => {
const node = this.convert(math, options);
await this.actionPromises();
this.clearPromises();
Expand Down
4 changes: 2 additions & 2 deletions ts/input/tex/textmacros/TextMacrosMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
* @author dpvc@mathjax.org (Davide P. Cervone)
*/

import { mathjax } from '../../../mathjax.js';
import { HandlerType } from '../HandlerTypes.js';
import TexParser from '../TexParser.js';
import { retryAfter } from '../../../util/Retries.js';
import { TextParser } from './TextParser.js';
import BaseMethods from '../base/BaseMethods.js';

Expand Down Expand Up @@ -290,7 +290,7 @@ export const TextMacrosMethods = {
if (!macro || (autoload && macro._func === autoload.Autoload)) {
texParser.parse(HandlerType.MACRO, [texParser, name]);
if (!macro) return;
retryAfter(Promise.resolve());
mathjax.retryAfter(Promise.resolve());
}
texParser.parse(HandlerType.MACRO, [parser, name]);
},
Expand Down
5 changes: 2 additions & 3 deletions ts/output/common/FontData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { mathjax } from '../../mathjax.js';
import { OptionList, defaultOptions, userOptions } from '../../util/Options.js';
import { StyleJson } from '../../util/StyleJson.js';
import { asyncLoad } from '../../util/AsyncLoad.js';
import { retryAfter } from '../../util/Retries.js';
import { Locale } from '../../util/Locale.js';
import { COMPONENT, localize } from '../../core/__locales__/Component.js';
import { DIRECTION } from './Direction.js';
Expand Down Expand Up @@ -1343,7 +1342,7 @@ export class FontData<
this.loadDynamicFileSync(delim);
return this.getDelimiter(n);
}
retryAfter(this.loadDynamicFile(delim));
mathjax.retryAfter(this.loadDynamicFile(delim));
return null;
}
return delim as DelimiterData;
Expand Down Expand Up @@ -1395,7 +1394,7 @@ export class FontData<
this.loadDynamicFileSync(char);
return this.getChar(name, n);
}
retryAfter(this.loadDynamicFile(char));
mathjax.retryAfter(this.loadDynamicFile(char));
return null;
}
return char as CharDataArray<C>;
Expand Down
11 changes: 4 additions & 7 deletions ts/ui/lazy/LazyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { HTMLDocument } from '../../handlers/html/HTMLDocument.js';
import { HTMLHandler } from '../../handlers/html/HTMLHandler.js';
// import { EnrichedMathItem } from '../../a11y/semantic-enrich.js';
import { SpeechMathItem } from '../../a11y/speech.js';
import { handleRetriesFor } from '../../util/Retries.js';
import { OptionList } from '../../util/Options.js';
import { StyleJson } from '../../util/StyleJson.js';

Expand Down Expand Up @@ -568,7 +567,7 @@ export function LazyMathDocumentMixin<
// Typeset the math and put back the font cache when done.
//
this.reset();
return handleRetriesFor(() => this.render()).then(() => {
return this.renderPromise().then(() => {
if (fontCache) this.outputJax.options.fontCache = fontCache;
});
}
Expand Down Expand Up @@ -622,16 +621,14 @@ export function LazyMathDocumentMixin<
protected lazyHandleSet() {
const set = this.lazySet;
this.lazySet = new Set();
this.lazyPromise = this.lazyPromise.then(() => {
this.lazyPromise = this.lazyPromise.then(async () => {
let state = this.compileEarlierItems(set)
? STATE.COMPILED
: STATE.TYPESET;
state = this.resetStates(set, state);
this.state(state - 1, null); // reset processed bits to allow reprocessing
return handleRetriesFor(() => {
this.render();
this.lazyIdle = false;
});
await this.renderPromise();
this.lazyIdle = false;
});
}

Expand Down