From 2da3ba02625dc20040afc29f99eb2f1cf84ebc64 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 26 Sep 2018 02:17:39 +0100 Subject: [PATCH] Rename variables --- ...ontents-instruction.ts => field-instruction.ts} | 3 ++- src/file/table-of-contents/sdt-content.ts | 2 +- src/file/table-of-contents/sdt-properties.ts | 3 ++- src/file/table-of-contents/table-of-contents.ts | 14 ++++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) rename src/file/table-of-contents/{table-of-contents-instruction.ts => field-instruction.ts} (96%) diff --git a/src/file/table-of-contents/table-of-contents-instruction.ts b/src/file/table-of-contents/field-instruction.ts similarity index 96% rename from src/file/table-of-contents/table-of-contents-instruction.ts rename to src/file/table-of-contents/field-instruction.ts index 1183ebd3de..766e6fc2f2 100644 --- a/src/file/table-of-contents/table-of-contents-instruction.ts +++ b/src/file/table-of-contents/field-instruction.ts @@ -1,3 +1,4 @@ +// http://officeopenxml.com/WPfieldInstructions.php import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { ITableOfContentsOptions } from "./table-of-contents-properties"; @@ -10,7 +11,7 @@ class TextAttributes extends XmlAttributeComponent<{ space: SpaceType }> { protected xmlKeys = { space: "xml:space" }; } -export class TableOfContentsInstruction extends XmlComponent { +export class FieldInstruction extends XmlComponent { private readonly properties: ITableOfContentsOptions; constructor(properties: ITableOfContentsOptions = {}) { diff --git a/src/file/table-of-contents/sdt-content.ts b/src/file/table-of-contents/sdt-content.ts index e668da6052..5228ff447f 100644 --- a/src/file/table-of-contents/sdt-content.ts +++ b/src/file/table-of-contents/sdt-content.ts @@ -1,6 +1,6 @@ import { XmlComponent } from "file/xml-components"; -export class SdtContent extends XmlComponent { +export class StructuredDocumentTagContent extends XmlComponent { constructor() { super("w:sdtContent"); } diff --git a/src/file/table-of-contents/sdt-properties.ts b/src/file/table-of-contents/sdt-properties.ts index bb8ef77a6b..3f7019f561 100644 --- a/src/file/table-of-contents/sdt-properties.ts +++ b/src/file/table-of-contents/sdt-properties.ts @@ -1,7 +1,8 @@ +// http://www.datypic.com/sc/ooxml/e-w_sdtPr-1.html import { XmlComponent } from "file/xml-components"; import { Alias } from "./alias"; -export class SdtProperties extends XmlComponent { +export class StructuredDocumentTagProperties extends XmlComponent { constructor(alias: string) { super("w:sdtPr"); this.root.push(new Alias(alias)); diff --git a/src/file/table-of-contents/table-of-contents.ts b/src/file/table-of-contents/table-of-contents.ts index fb7b709c4f..7b1ff0f66d 100644 --- a/src/file/table-of-contents/table-of-contents.ts +++ b/src/file/table-of-contents/table-of-contents.ts @@ -1,23 +1,25 @@ +// http://officeopenxml.com/WPtableOfContents.php +// http://www.datypic.com/sc/ooxml/e-w_sdt-1.html import { Paragraph } from "file/paragraph"; import { Run } from "file/paragraph/run"; import { Begin, End, Separate } from "file/paragraph/run/field"; import { XmlComponent } from "file/xml-components"; -import { SdtContent } from "./sdt-content"; -import { SdtProperties } from "./sdt-properties"; -import { TableOfContentsInstruction } from "./table-of-contents-instruction"; +import { FieldInstruction } from "./field-instruction"; +import { StructuredDocumentTagContent } from "./sdt-content"; +import { StructuredDocumentTagProperties } from "./sdt-properties"; import { ITableOfContentsOptions } from "./table-of-contents-properties"; export class TableOfContents extends XmlComponent { constructor(alias: string = "Table of Contents", properties?: ITableOfContentsOptions) { super("w:sdt"); - this.root.push(new SdtProperties(alias)); + this.root.push(new StructuredDocumentTagProperties(alias)); - const content = new SdtContent(); + const content = new StructuredDocumentTagContent(); const beginParagraph = new Paragraph(); const beginRun = new Run(); beginRun.addChildElement(new Begin(true)); - beginRun.addChildElement(new TableOfContentsInstruction(properties)); + beginRun.addChildElement(new FieldInstruction(properties)); beginRun.addChildElement(new Separate()); beginParagraph.addRun(beginRun); content.addChildElement(beginParagraph);