case_line.js 1.0 KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.CaseLine = void 0;
  4. const semantic_meaning_js_1 = require("../semantic_tree/semantic_meaning.js");
  5. const abstract_enrich_case_js_1 = require("./abstract_enrich_case.js");
  6. const EnrichMathml = require("./enrich_mathml.js");
  7. const enrich_attr_js_1 = require("./enrich_attr.js");
  8. class CaseLine extends abstract_enrich_case_js_1.AbstractEnrichCase {
  9. static test(semantic) {
  10. return !!semantic.mathmlTree && semantic.type === semantic_meaning_js_1.SemanticType.LINE;
  11. }
  12. constructor(semantic) {
  13. super(semantic);
  14. this.mml = semantic.mathmlTree;
  15. }
  16. getMathml() {
  17. if (this.semantic.contentNodes.length) {
  18. EnrichMathml.walkTree(this.semantic.contentNodes[0]);
  19. }
  20. if (this.semantic.childNodes.length) {
  21. EnrichMathml.walkTree(this.semantic.childNodes[0]);
  22. }
  23. (0, enrich_attr_js_1.setAttributes)(this.mml, this.semantic);
  24. return this.mml;
  25. }
  26. }
  27. exports.CaseLine = CaseLine;