Skip to content

Commit 0165aa1

Browse files
committed
Merge remote-tracking branch 'origin/tex_input_typescript' into beta.2
2 parents fa5a757 + ad323eb commit 0165aa1

File tree

4 files changed

+27
-13
lines changed

4 files changed

+27
-13
lines changed

mathjax3-ts/input/tex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class TeX<N, T, D> extends AbstractInputJax<N, T, D> {
124124
[TeX.OPTIONS, TagsFactory.OPTIONS, {'packages': packages}]);
125125
let [tex, find, rest] = separateOptions(options, FindTeX.OPTIONS, parseOptions.options);
126126
super(tex);
127-
userOptions(parseOptions.options, options);
127+
userOptions(parseOptions.options, rest);
128128
TeX.tags(parseOptions, configuration);
129129
this.parseOptions = parseOptions;
130130
this.configuration = configuration;

mathjax3-ts/input/tex/ParseOptions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export default class ParseOptions {
150150
this.root = null;
151151
this.nodeLists = {};
152152
this.error = false;
153+
this.tags.resetTag();
153154
}
154155

155156

mathjax3-ts/input/tex/Tags.ts

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,16 @@ export interface Tags {
162162
clearTag(): void;
163163

164164
/**
165-
* Resets the tag structure.
165+
* Resets the tag structure after an expression has been typeset.
166+
*/
167+
resetTag(): void;
168+
169+
/**
170+
* Fully resets the tag structure, in particular all the tagging and label
171+
* history.
166172
* @param {number} offset A new offset value to start counting ids from.
167-
* @param {boolean} keep If sets, keep all previous labels and ids at reset.
168173
*/
169-
reset(offset: number, keep: boolean): void;
174+
reset(offset?: number): void;
170175

171176
/**
172177
* Finalizes tag creation.
@@ -405,13 +410,19 @@ export class AbstractTags implements Tags {
405410
/**
406411
* @override
407412
*/
408-
public reset(n: number, keepLabels: boolean) {
409-
this.offset = (n || 0);
413+
public resetTag() {
410414
this.history = [];
411-
if (!keepLabels) {
412-
this.labels = {};
413-
this.ids = {};
414-
}
415+
this.clearTag();
416+
}
417+
418+
/**
419+
* @override
420+
*/
421+
public reset(offset: number = 0) {
422+
this.resetTag();
423+
this.offset = offset;
424+
this.labels = {};
425+
this.ids = {};
415426
}
416427

417428
/**
@@ -464,7 +475,8 @@ export class AbstractTags implements Tags {
464475
}
465476
let mml = new TexParser('\\text{' + this.currentTag.tagFormat + '}', {},
466477
this.configuration).mml();
467-
return this.configuration.nodeFactory.create('node', 'mtd', [mml], {id: this.currentTag.tagId});
478+
return this.configuration.nodeFactory.create('node', 'mtd', [mml],
479+
{id: this.currentTag.tagId});
468480
}
469481

470482
};

mathjax3-ts/input/tex/TexParser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export default class TexParser {
7676
*/
7777
constructor(private _string: string, env: EnvList,
7878
public configuration: ParseOptions) {
79-
const inner = env['isInner'] as boolean;
79+
const inner = env.hasOwnProperty('isInner');
80+
const isInner = env['isInner'] as boolean;
8081
delete env['isInner'];
8182
let ENV: EnvList;
8283
if (env) {
@@ -86,7 +87,7 @@ export default class TexParser {
8687
}
8788
}
8889
this.configuration.pushParser(this);
89-
this.stack = new Stack(this.itemFactory, ENV, inner);
90+
this.stack = new Stack(this.itemFactory, ENV, inner ? isInner : true);
9091
this.Parse();
9192
this.Push(this.itemFactory.create('stop'));
9293
}

0 commit comments

Comments
 (0)