Skip to content

Commit 11c6c82

Browse files
committed
Move toEntry to be a method so that it can be override, if necessary
1 parent 4d1e195 commit 11c6c82

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

ts/core/MmlTree/SerializedMmlVisitor.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,17 @@ export class SerializedMmlVisitor extends MmlVisitor {
161161
.replace(/</g, '&lt;')
162162
.replace(/>/g, '&gt;')
163163
.replace(/"/g, '&quot;')
164-
.replace(/[\uD800-\uDBFF]./g, toEntity)
165-
.replace(/[\u0080-\uD7FF\uE000-\uFFFF]/g, toEntity);
164+
.replace(/[\uD800-\uDBFF]./g, this.toEntity)
165+
.replace(/[\u0080-\uD7FF\uE000-\uFFFF]/g, this.toEntity);
166+
}
167+
168+
/**
169+
* Access to the toEntity() function that can be overridden in subclasses.
170+
*
171+
* @param {string} c The character to encode.
172+
* @returns {string} The numeric entity for the character.
173+
*/
174+
protected toEntity(c: string): string {
175+
return toEntity(c);
166176
}
167177
}

0 commit comments

Comments
 (0)