* build(deps-dev): bump eslint from 8.57.1 to 9.13.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v9.13.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Upgrade EsLint * Fix all new lint errors --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
46 lines
1.9 KiB
TypeScript
46 lines
1.9 KiB
TypeScript
// http://officeopenxml.com/WPsectionLineNumbering.php
|
|
import { BuilderElement, XmlComponent } from "@file/xml-components";
|
|
import { PositiveUniversalMeasure, decimalNumber, twipsMeasureValue } from "@util/values";
|
|
|
|
// <xsd:simpleType name="ST_LineNumberRestart">
|
|
// <xsd:restriction base="xsd:string">
|
|
// <xsd:enumeration value="newPage"/>
|
|
// <xsd:enumeration value="newSection"/>
|
|
// <xsd:enumeration value="continuous"/>
|
|
// </xsd:restriction>
|
|
// </xsd:simpleType>
|
|
|
|
export const LineNumberRestartFormat = {
|
|
NEW_PAGE: "newPage",
|
|
NEW_SECTION: "newSection",
|
|
CONTINUOUS: "continuous",
|
|
} as const;
|
|
|
|
// <xsd:complexType name="CT_LineNumber">
|
|
// <xsd:attribute name="countBy" type="ST_DecimalNumber" use="optional"/>
|
|
// <xsd:attribute name="start" type="ST_DecimalNumber" use="optional" default="1"/>
|
|
// <xsd:attribute name="distance" type="s:ST_TwipsMeasure" use="optional"/>
|
|
// <xsd:attribute name="restart" type="ST_LineNumberRestart" use="optional" default="newPage"/>
|
|
// </xsd:complexType>
|
|
|
|
export type ILineNumberAttributes = {
|
|
readonly countBy?: number;
|
|
readonly start?: number;
|
|
readonly restart?: (typeof LineNumberRestartFormat)[keyof typeof LineNumberRestartFormat];
|
|
readonly distance?: number | PositiveUniversalMeasure;
|
|
};
|
|
|
|
export const createLineNumberType = ({ countBy, start, restart, distance }: ILineNumberAttributes): XmlComponent =>
|
|
new BuilderElement<ILineNumberAttributes>({
|
|
name: "w:lnNumType",
|
|
attributes: {
|
|
countBy: { key: "w:countBy", value: countBy === undefined ? undefined : decimalNumber(countBy) },
|
|
start: { key: "w:start", value: start === undefined ? undefined : decimalNumber(start) },
|
|
restart: { key: "w:restart", value: restart },
|
|
distance: {
|
|
key: "w:distance",
|
|
value: distance === undefined ? undefined : twipsMeasureValue(distance),
|
|
},
|
|
},
|
|
});
|