Skip to content

Commit 4274332

Browse files
committed
Introduces separate reset methods for tags.
1 parent 12e6f10 commit 4274332

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

mathjax3-ts/input/tex/ParseOptions.ts

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

156156

mathjax3-ts/input/tex/Tags.ts

Lines changed: 19 additions & 9 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,14 +410,19 @@ export class AbstractTags implements Tags {
405410
/**
406411
* @override
407412
*/
408-
public reset(n: number = 0, keepLabels: boolean = true) {
409-
this.offset = n;
413+
public resetTag() {
410414
this.history = [];
411415
this.clearTag();
412-
if (!keepLabels) {
413-
this.labels = {};
414-
this.ids = {};
415-
}
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 = {};
416426
}
417427

418428
/**

0 commit comments

Comments
 (0)