Rename variables

This commit is contained in:
Dolan
2018-09-26 02:17:39 +01:00
parent e08c7cbbfb
commit 2da3ba0262
4 changed files with 13 additions and 9 deletions

View File

@ -1,3 +1,4 @@
// http://officeopenxml.com/WPfieldInstructions.php
import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
import { ITableOfContentsOptions } from "./table-of-contents-properties"; import { ITableOfContentsOptions } from "./table-of-contents-properties";
@ -10,7 +11,7 @@ class TextAttributes extends XmlAttributeComponent<{ space: SpaceType }> {
protected xmlKeys = { space: "xml:space" }; protected xmlKeys = { space: "xml:space" };
} }
export class TableOfContentsInstruction extends XmlComponent { export class FieldInstruction extends XmlComponent {
private readonly properties: ITableOfContentsOptions; private readonly properties: ITableOfContentsOptions;
constructor(properties: ITableOfContentsOptions = {}) { constructor(properties: ITableOfContentsOptions = {}) {

View File

@ -1,6 +1,6 @@
import { XmlComponent } from "file/xml-components"; import { XmlComponent } from "file/xml-components";
export class SdtContent extends XmlComponent { export class StructuredDocumentTagContent extends XmlComponent {
constructor() { constructor() {
super("w:sdtContent"); super("w:sdtContent");
} }

View File

@ -1,7 +1,8 @@
// http://www.datypic.com/sc/ooxml/e-w_sdtPr-1.html
import { XmlComponent } from "file/xml-components"; import { XmlComponent } from "file/xml-components";
import { Alias } from "./alias"; import { Alias } from "./alias";
export class SdtProperties extends XmlComponent { export class StructuredDocumentTagProperties extends XmlComponent {
constructor(alias: string) { constructor(alias: string) {
super("w:sdtPr"); super("w:sdtPr");
this.root.push(new Alias(alias)); this.root.push(new Alias(alias));

View File

@ -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 { Paragraph } from "file/paragraph";
import { Run } from "file/paragraph/run"; import { Run } from "file/paragraph/run";
import { Begin, End, Separate } from "file/paragraph/run/field"; import { Begin, End, Separate } from "file/paragraph/run/field";
import { XmlComponent } from "file/xml-components"; import { XmlComponent } from "file/xml-components";
import { SdtContent } from "./sdt-content"; import { FieldInstruction } from "./field-instruction";
import { SdtProperties } from "./sdt-properties"; import { StructuredDocumentTagContent } from "./sdt-content";
import { TableOfContentsInstruction } from "./table-of-contents-instruction"; import { StructuredDocumentTagProperties } from "./sdt-properties";
import { ITableOfContentsOptions } from "./table-of-contents-properties"; import { ITableOfContentsOptions } from "./table-of-contents-properties";
export class TableOfContents extends XmlComponent { export class TableOfContents extends XmlComponent {
constructor(alias: string = "Table of Contents", properties?: ITableOfContentsOptions) { constructor(alias: string = "Table of Contents", properties?: ITableOfContentsOptions) {
super("w:sdt"); 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 beginParagraph = new Paragraph();
const beginRun = new Run(); const beginRun = new Run();
beginRun.addChildElement(new Begin(true)); beginRun.addChildElement(new Begin(true));
beginRun.addChildElement(new TableOfContentsInstruction(properties)); beginRun.addChildElement(new FieldInstruction(properties));
beginRun.addChildElement(new Separate()); beginRun.addChildElement(new Separate());
beginParagraph.addRun(beginRun); beginParagraph.addRun(beginRun);
content.addChildElement(beginParagraph); content.addChildElement(beginParagraph);