semantic_node.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { SemanticMeaning, SemanticFont, SemanticRole, SemanticType } from './semantic_meaning.js';
  2. declare const enum Attribute {
  3. EMBELLISHED = "embellished",
  4. FENCEPOINTER = "fencepointer",
  5. FONT = "font",
  6. ID = "id",
  7. ANNOTATION = "annotation",
  8. ROLE = "role",
  9. TYPE = "type",
  10. CHILDREN = "children",
  11. CONTENT = "content",
  12. TEXT = "$t"
  13. }
  14. export declare class SemanticNode {
  15. id: number;
  16. mathml: Element[];
  17. parent: SemanticNode;
  18. type: SemanticType;
  19. role: SemanticRole;
  20. font: SemanticFont;
  21. embellished: SemanticType;
  22. fencePointer: string;
  23. childNodes: SemanticNode[];
  24. textContent: string;
  25. mathmlTree: Element;
  26. contentNodes: SemanticNode[];
  27. annotation: {
  28. [key: string]: string[];
  29. };
  30. attributes: {
  31. [key: string]: string;
  32. };
  33. nobreaking: boolean;
  34. static fromXml(xml: Element): SemanticNode;
  35. private static setAttribute;
  36. private static processChildren;
  37. constructor(id: number);
  38. querySelectorAll(pred: (p1: SemanticNode) => boolean): SemanticNode[];
  39. xml(xml: Document, brief?: boolean): Element;
  40. toString(brief?: boolean): string;
  41. allAttributes(): [Attribute, string][];
  42. private annotationXml;
  43. attributesXml(): string;
  44. toJson(): any;
  45. updateContent(content: string, text?: boolean): void;
  46. addMathmlNodes(mmlNodes: Element[]): void;
  47. appendChild(child: SemanticNode): void;
  48. replaceChild(oldNode: SemanticNode, newNode: SemanticNode): void;
  49. appendContentNode(node: SemanticNode): void;
  50. removeContentNode(node: SemanticNode): void;
  51. equals(node: SemanticNode): boolean;
  52. displayTree(): void;
  53. addAnnotation(domain: string, annotation: string): void;
  54. getAnnotation(domain: string): string[];
  55. hasAnnotation(domain: string, annotation: string): boolean;
  56. parseAnnotation(stateStr: string): void;
  57. meaning(): SemanticMeaning;
  58. private xmlAttributes;
  59. private addExternalAttributes;
  60. private static escapeValue;
  61. parseAttributes(stateStr: string): void;
  62. private removeMathmlNodes;
  63. private displayTree_;
  64. private mathmlTreeString;
  65. private addAnnotation_;
  66. }
  67. export {};