UNPKG

@qtikit/mathml-to-latex

Version:

A JavaScript tool to convert mathml string to LaTeX string

25 lines (24 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MAction = void 0; var mathml_element_to_latex_converter_1 = require("../../../helpers/mathml-element-to-latex-converter"); var MAction = /** @class */ (function () { function MAction(mathElement) { this._mathmlElement = mathElement; } MAction.prototype.convert = function () { var children = this._mathmlElement.children; if (this._isToggle()) return children .map(function (child) { return (0, mathml_element_to_latex_converter_1.mathMLElementToLaTeXConverter)(child); }) .map(function (converter) { return converter.convert(); }) .join(' \\Longrightarrow '); return (0, mathml_element_to_latex_converter_1.mathMLElementToLaTeXConverter)(children[0]).convert(); }; MAction.prototype._isToggle = function () { var actiontype = this._mathmlElement.attributes.actiontype; return actiontype === 'toggle' || !actiontype; }; return MAction; }()); exports.MAction = MAction;