Documentation and Refactoring (#3028)

* Documentation and Refactoring

* Documentation and Refactoring

* Fix lint issues

* Convert components to Builder style

---------

Co-authored-by: Dolan Miu <dmiu@bloomberg.net>
This commit is contained in:
Dolan
2025-04-14 16:43:15 +05:30
committed by GitHub
parent 8ba9a448d3
commit 4d1a351649
78 changed files with 1178 additions and 620 deletions

View File

@ -1,26 +1,30 @@
// http://www.datypic.com/sc/ooxml/e-m_naryPr-1.html
import { XmlComponent } from "@file/xml-components";
import { BuilderElement, XmlComponent } from "@file/xml-components";
import { MathAccentCharacter } from "./math-accent-character";
import { MathLimitLocation } from "./math-limit-location";
import { MathSubScriptHide } from "./math-sub-script-hide";
import { MathSuperScriptHide } from "./math-super-script-hide";
import { createMathAccentCharacter } from "./math-accent-character";
import { createMathLimitLocation } from "./math-limit-location";
import { createMathSubScriptHide } from "./math-sub-script-hide";
import { createMathSuperScriptHide } from "./math-super-script-hide";
export class MathNAryProperties extends XmlComponent {
public constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean, limitLocationVal?: string) {
super("m:naryPr");
type MathNAryPropertiesOptions = {
readonly accent: string;
readonly hasSuperScript: boolean;
readonly hasSubScript: boolean;
readonly limitLocationVal?: string;
};
if (!!accent) {
this.root.push(new MathAccentCharacter(accent));
}
this.root.push(new MathLimitLocation(limitLocationVal));
if (!hasSuperScript) {
this.root.push(new MathSuperScriptHide());
}
if (!hasSubScript) {
this.root.push(new MathSubScriptHide());
}
}
}
export const createMathNAryProperties = ({
accent,
hasSuperScript,
hasSubScript,
limitLocationVal,
}: MathNAryPropertiesOptions): XmlComponent =>
new BuilderElement({
name: "m:naryPr",
children: [
...(!!accent ? [createMathAccentCharacter({ accent })] : []),
createMathLimitLocation({ value: limitLocationVal }),
...(!hasSuperScript ? [createMathSuperScriptHide()] : []),
...(!hasSubScript ? [createMathSubScriptHide()] : []),
],
});