correct sdt objects of table of contents
This commit is contained in:
@ -1,9 +1,9 @@
|
|||||||
import { Paragraph } from "file/paragraph";
|
import { Paragraph } from "file/paragraph";
|
||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "file/xml-components";
|
||||||
|
|
||||||
export class StdContent extends XmlComponent {
|
export class SdtContent extends XmlComponent {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("w:stdContent");
|
super("w:sdtContent");
|
||||||
}
|
}
|
||||||
|
|
||||||
public addGeneratedContent(paragraph: Paragraph): void {
|
public addGeneratedContent(paragraph: Paragraph): void {
|
@ -1,9 +1,9 @@
|
|||||||
import { XmlComponent } from "file/xml-components";
|
import { XmlComponent } from "file/xml-components";
|
||||||
import { Alias } from "./alias";
|
import { Alias } from "./alias";
|
||||||
|
|
||||||
export class StdProperties extends XmlComponent {
|
export class SdtProperties extends XmlComponent {
|
||||||
constructor(alias: string) {
|
constructor(alias: string) {
|
||||||
super("w:stdPr");
|
super("w:sdtPr");
|
||||||
this.root.push(new Alias(alias));
|
this.root.push(new Alias(alias));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,23 @@ import { Formatter } from "../../export/formatter";
|
|||||||
import { TableOfContents } from "./";
|
import { TableOfContents } from "./";
|
||||||
|
|
||||||
const DEFAULT_TOC = {
|
const DEFAULT_TOC = {
|
||||||
|
"w:sdt": [
|
||||||
|
{
|
||||||
|
"w:sdtPr": [
|
||||||
|
{
|
||||||
|
"w:alias": [
|
||||||
|
{
|
||||||
|
_attr: {
|
||||||
|
"w:val": "Table of Contents",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"w:sdtContent": [
|
||||||
|
{
|
||||||
"w:p": [
|
"w:p": [
|
||||||
{
|
{
|
||||||
"w:pPr": [],
|
"w:pPr": [],
|
||||||
@ -43,6 +60,13 @@ const DEFAULT_TOC = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"w:p": [
|
||||||
|
{
|
||||||
|
"w:pPr": [],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"w:r": [
|
"w:r": [
|
||||||
{
|
{
|
||||||
@ -60,6 +84,10 @@ const DEFAULT_TOC = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
describe("Table of Contents", () => {
|
describe("Table of Contents", () => {
|
||||||
|
@ -3,22 +3,22 @@ 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 { StdContent } from "./std-content";
|
import { SdtContent } from "./sdt-content";
|
||||||
import { StdProperties } from "./std-properties";
|
import { SdtProperties } from "./sdt-properties";
|
||||||
import { TableOfContentsInstruction } from "./table-of-contents-instruction";
|
import { TableOfContentsInstruction } from "./table-of-contents-instruction";
|
||||||
|
|
||||||
export class TableOfContents extends XmlComponent {
|
export class TableOfContents extends XmlComponent {
|
||||||
// private readonly tocProperties: TableOfContentsProperties;
|
// private readonly tocProperties: TableOfContentsProperties;
|
||||||
private readonly properties: StdProperties;
|
private readonly properties: SdtProperties;
|
||||||
|
|
||||||
private readonly content: StdContent;
|
private readonly content: SdtContent;
|
||||||
|
|
||||||
private readonly instruction: TableOfContentsInstruction;
|
private readonly instruction: TableOfContentsInstruction;
|
||||||
|
|
||||||
constructor(/*tocProperties?: TableOfContentsProperties*/) {
|
constructor(/*tocProperties?: TableOfContentsProperties*/) {
|
||||||
super("w:sdt");
|
super("w:sdt");
|
||||||
this.properties = new StdProperties("Table of Contents");
|
this.properties = new SdtProperties("Table of Contents");
|
||||||
this.content = new StdContent();
|
this.content = new SdtContent();
|
||||||
this.instruction = new TableOfContentsInstruction();
|
this.instruction = new TableOfContentsInstruction();
|
||||||
this.root.push(this.properties);
|
this.root.push(this.properties);
|
||||||
this.root.push(this.content);
|
this.root.push(this.content);
|
||||||
|
Reference in New Issue
Block a user