feat: add munderover tag use case
This commit is contained in:
parent
3323c7a13b
commit
1e775e47e4
@ -8,7 +8,6 @@ import {
|
||||
MFenced,
|
||||
MFrac,
|
||||
MRoot,
|
||||
GenericContentWrapperTag,
|
||||
MAction,
|
||||
MEnclose,
|
||||
MError,
|
||||
@ -17,6 +16,8 @@ import {
|
||||
MSub,
|
||||
MSubsup,
|
||||
MText,
|
||||
MUnderover,
|
||||
GenericContentWrapperTag,
|
||||
GenericUnderOverTag,
|
||||
} from './mathml-tags';
|
||||
|
||||
@ -67,6 +68,8 @@ export class Dispatcher {
|
||||
return new MSubsup(this._value, this._attributes, this._children);
|
||||
case 'mtext':
|
||||
return new MText(this._value, this._attributes, this._children);
|
||||
case 'munderover':
|
||||
return new MUnderover(this._value, this._attributes, this._children);
|
||||
case 'mover':
|
||||
case 'munder':
|
||||
return new GenericUnderOverTag(this._name, this._value, this._attributes, this._children);
|
||||
|
18
src/converters/mathml-interfaces-to-latex/mathml-tag-to-latex/mathml-tags/MUnderover.ts
Normal file
18
src/converters/mathml-interfaces-to-latex/mathml-tag-to-latex/mathml-tags/MUnderover.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { MathMLTag } from './MathMLTag';
|
||||
import { InvalidNumberOfChild } from '../../../../errors';
|
||||
|
||||
export class MUnderover extends MathMLTag {
|
||||
constructor(value: string, attributes: Record<string, string>, children: MathMLTag[]) {
|
||||
super('munderover', value, attributes, children);
|
||||
}
|
||||
|
||||
convert(): string {
|
||||
if (this._children.length !== 3) throw new InvalidNumberOfChild(this._name, 3, this._children.length);
|
||||
|
||||
const base = this._children[0].convert();
|
||||
const underContent = this._children[1].convert();
|
||||
const overContent = this._children[2].convert();
|
||||
|
||||
return `${base}_{${underContent}}^{${overContent}}`;
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ export { MSqrt } from './MSqrt';
|
||||
export { MFenced } from './MFenced';
|
||||
export { MFrac } from './MFrac';
|
||||
export { MRoot } from './MRoot';
|
||||
export { GenericContentWrapperTag } from './GenericContentWrapperTag';
|
||||
export { MAction } from './MAction';
|
||||
export { MEnclose } from './MEnclose';
|
||||
export { MError } from './MError';
|
||||
@ -16,4 +15,6 @@ export { MSup } from './MSup';
|
||||
export { MSub } from './MSub';
|
||||
export { MSubsup } from './MSubsup';
|
||||
export { MText } from './MText';
|
||||
export { MUnderover } from './MUnderover';
|
||||
export { GenericContentWrapperTag } from './GenericContentWrapperTag';
|
||||
export { GenericUnderOverTag } from './GenericUnderOverTag';
|
||||
|
Loading…
Reference in New Issue
Block a user