From a1b9be453bbace564b3c9034aab9462bb4dc9977 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 15 Aug 2019 00:47:55 +0100 Subject: [PATCH 001/107] Add math run and fraction --- demo/47-math.ts | 33 ++++++++++++++ src/file/paragraph/index.ts | 1 + src/file/paragraph/math/fraction/index.ts | 3 ++ .../math/fraction/math-denominator.spec.ts | 25 +++++++++++ .../math/fraction/math-denominator.ts | 11 +++++ .../math/fraction/math-fraction.spec.ts | 45 +++++++++++++++++++ .../paragraph/math/fraction/math-fraction.ts | 18 ++++++++ .../math/fraction/math-numerator.spec.ts | 25 +++++++++++ .../paragraph/math/fraction/math-numerator.ts | 11 +++++ src/file/paragraph/math/index.ts | 3 ++ src/file/paragraph/math/math-run.spec.ts | 21 +++++++++ src/file/paragraph/math/math-run.ts | 11 +++++ src/file/paragraph/math/math-text.spec.ts | 17 +++++++ src/file/paragraph/math/math-text.ts | 9 ++++ src/file/paragraph/math/math.spec.ts | 38 ++++++++++++++++ src/file/paragraph/math/math.ts | 19 ++++++++ src/file/paragraph/paragraph.ts | 3 +- 17 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 demo/47-math.ts create mode 100644 src/file/paragraph/math/fraction/index.ts create mode 100644 src/file/paragraph/math/fraction/math-denominator.spec.ts create mode 100644 src/file/paragraph/math/fraction/math-denominator.ts create mode 100644 src/file/paragraph/math/fraction/math-fraction.spec.ts create mode 100644 src/file/paragraph/math/fraction/math-fraction.ts create mode 100644 src/file/paragraph/math/fraction/math-numerator.spec.ts create mode 100644 src/file/paragraph/math/fraction/math-numerator.ts create mode 100644 src/file/paragraph/math/index.ts create mode 100644 src/file/paragraph/math/math-run.spec.ts create mode 100644 src/file/paragraph/math/math-run.ts create mode 100644 src/file/paragraph/math/math-text.spec.ts create mode 100644 src/file/paragraph/math/math-text.ts create mode 100644 src/file/paragraph/math/math.spec.ts create mode 100644 src/file/paragraph/math/math.ts diff --git a/demo/47-math.ts b/demo/47-math.ts new file mode 100644 index 0000000000..7862feac97 --- /dev/null +++ b/demo/47-math.ts @@ -0,0 +1,33 @@ +// Simple example to add text to a document +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Math, MathDenominator, MathFraction, MathNumerator, MathRun, Packer, Paragraph, TextRun } from "../build"; + +const doc = new Document(); + +doc.addSection({ + properties: {}, + children: [ + new Paragraph({ + children: [ + new Math({ + children: [ + new MathRun("2+2"), + new MathFraction({ + numerator: new MathNumerator("hi"), + denominator: new MathDenominator("2"), + }), + ], + }), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/src/file/paragraph/index.ts b/src/file/paragraph/index.ts index 222cb1bf4f..a2ab11a21e 100644 --- a/src/file/paragraph/index.ts +++ b/src/file/paragraph/index.ts @@ -4,3 +4,4 @@ export * from "./properties"; export * from "./run"; export * from "./links"; export * from "./image"; +export * from "./math"; diff --git a/src/file/paragraph/math/fraction/index.ts b/src/file/paragraph/math/fraction/index.ts new file mode 100644 index 0000000000..c8af438329 --- /dev/null +++ b/src/file/paragraph/math/fraction/index.ts @@ -0,0 +1,3 @@ +export * from "./math-fraction"; +export * from "./math-denominator"; +export * from "./math-numerator"; diff --git a/src/file/paragraph/math/fraction/math-denominator.spec.ts b/src/file/paragraph/math/fraction/math-denominator.spec.ts new file mode 100644 index 0000000000..cca8ae0ee1 --- /dev/null +++ b/src/file/paragraph/math/fraction/math-denominator.spec.ts @@ -0,0 +1,25 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathDenominator } from "./math-denominator"; + +describe("MathDenominator", () => { + describe("#constructor()", () => { + it("should create a MathDenominator with correct root key", () => { + const mathDenominator = new MathDenominator("2+2"); + const tree = new Formatter().format(mathDenominator); + expect(tree).to.deep.equal({ + "m:den": [ + { + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/fraction/math-denominator.ts b/src/file/paragraph/math/fraction/math-denominator.ts new file mode 100644 index 0000000000..da9f283bdc --- /dev/null +++ b/src/file/paragraph/math/fraction/math-denominator.ts @@ -0,0 +1,11 @@ +import { XmlComponent } from "file/xml-components"; + +import { MathRun } from "../math-run"; + +export class MathDenominator extends XmlComponent { + constructor(readonly text: string) { + super("m:den"); + + this.root.push(new MathRun(text)); + } +} diff --git a/src/file/paragraph/math/fraction/math-fraction.spec.ts b/src/file/paragraph/math/fraction/math-fraction.spec.ts new file mode 100644 index 0000000000..9a7386e85e --- /dev/null +++ b/src/file/paragraph/math/fraction/math-fraction.spec.ts @@ -0,0 +1,45 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathDenominator } from "./math-denominator"; +import { MathFraction } from "./math-fraction"; +import { MathNumerator } from "./math-numerator"; + +describe("MathFraction", () => { + describe("#constructor()", () => { + it("should create a MathFraction with correct root key", () => { + const mathFraction = new MathFraction({ + numerator: new MathNumerator("2"), + denominator: new MathDenominator("2"), + }); + const tree = new Formatter().format(mathFraction); + expect(tree).to.deep.equal({ + "m:f": [ + { + "m:num": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + { + "m:den": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/fraction/math-fraction.ts b/src/file/paragraph/math/fraction/math-fraction.ts new file mode 100644 index 0000000000..062c3ef575 --- /dev/null +++ b/src/file/paragraph/math/fraction/math-fraction.ts @@ -0,0 +1,18 @@ +import { XmlComponent } from "file/xml-components"; + +import { MathDenominator } from "./math-denominator"; +import { MathNumerator } from "./math-numerator"; + +export interface IMathFractionOptions { + readonly numerator: MathNumerator; + readonly denominator: MathDenominator; +} + +export class MathFraction extends XmlComponent { + constructor(readonly options: IMathFractionOptions) { + super("m:f"); + + this.root.push(options.numerator); + this.root.push(options.denominator); + } +} diff --git a/src/file/paragraph/math/fraction/math-numerator.spec.ts b/src/file/paragraph/math/fraction/math-numerator.spec.ts new file mode 100644 index 0000000000..1cc5fc4aa4 --- /dev/null +++ b/src/file/paragraph/math/fraction/math-numerator.spec.ts @@ -0,0 +1,25 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathNumerator } from "./math-numerator"; + +describe("MathNumerator", () => { + describe("#constructor()", () => { + it("should create a MathNumerator with correct root key", () => { + const mathNumerator = new MathNumerator("2+2"); + const tree = new Formatter().format(mathNumerator); + expect(tree).to.deep.equal({ + "m:num": [ + { + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/fraction/math-numerator.ts b/src/file/paragraph/math/fraction/math-numerator.ts new file mode 100644 index 0000000000..68799328cb --- /dev/null +++ b/src/file/paragraph/math/fraction/math-numerator.ts @@ -0,0 +1,11 @@ +import { XmlComponent } from "file/xml-components"; + +import { MathRun } from "../math-run"; + +export class MathNumerator extends XmlComponent { + constructor(readonly text: string) { + super("m:num"); + + this.root.push(new MathRun(text)); + } +} diff --git a/src/file/paragraph/math/index.ts b/src/file/paragraph/math/index.ts new file mode 100644 index 0000000000..9f3b22b5fa --- /dev/null +++ b/src/file/paragraph/math/index.ts @@ -0,0 +1,3 @@ +export * from "./math"; +export * from "./math-run"; +export * from "./fraction"; diff --git a/src/file/paragraph/math/math-run.spec.ts b/src/file/paragraph/math/math-run.spec.ts new file mode 100644 index 0000000000..2773a0fb9c --- /dev/null +++ b/src/file/paragraph/math/math-run.spec.ts @@ -0,0 +1,21 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "./math-run"; + +describe("MathRun", () => { + describe("#constructor()", () => { + it("should create a MathRun with correct root key", () => { + const mathRun = new MathRun("2+2"); + const tree = new Formatter().format(mathRun); + expect(tree).to.deep.equal({ + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/math-run.ts b/src/file/paragraph/math/math-run.ts new file mode 100644 index 0000000000..5b9b9536c4 --- /dev/null +++ b/src/file/paragraph/math/math-run.ts @@ -0,0 +1,11 @@ +import { XmlComponent } from "file/xml-components"; + +import { MathText } from "./math-text"; + +export class MathRun extends XmlComponent { + constructor(readonly text: string) { + super("m:r"); + + this.root.push(new MathText(text)); + } +} diff --git a/src/file/paragraph/math/math-text.spec.ts b/src/file/paragraph/math/math-text.spec.ts new file mode 100644 index 0000000000..0001816ed1 --- /dev/null +++ b/src/file/paragraph/math/math-text.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathText } from "./math-text"; + +describe("MathText", () => { + describe("#constructor()", () => { + it("should create a MathText with correct root key", () => { + const mathText = new MathText("2+2"); + const tree = new Formatter().format(mathText); + expect(tree).to.deep.equal({ + "m:t": ["2+2"], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/math-text.ts b/src/file/paragraph/math/math-text.ts new file mode 100644 index 0000000000..907294aab9 --- /dev/null +++ b/src/file/paragraph/math/math-text.ts @@ -0,0 +1,9 @@ +import { XmlComponent } from "file/xml-components"; + +export class MathText extends XmlComponent { + constructor(readonly text: string) { + super("m:t"); + + this.root.push(text); + } +} diff --git a/src/file/paragraph/math/math.spec.ts b/src/file/paragraph/math/math.spec.ts new file mode 100644 index 0000000000..d5c4f6f494 --- /dev/null +++ b/src/file/paragraph/math/math.spec.ts @@ -0,0 +1,38 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { Math } from "./math"; +import { MathRun } from "./math-run"; + +describe("Math", () => { + describe("#constructor()", () => { + it("should create a Math with correct root key", () => { + const math = new Math({ + children: [], + }); + const tree = new Formatter().format(math); + expect(tree).to.deep.equal({ + "m:oMath": {}, + }); + }); + + it("should be able to add children", () => { + const math = new Math({ + children: [new MathRun("2+2")], + }); + const tree = new Formatter().format(math); + expect(tree).to.deep.equal({ + "m:oMath": [ + { + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/math.ts b/src/file/paragraph/math/math.ts new file mode 100644 index 0000000000..eee6fdff65 --- /dev/null +++ b/src/file/paragraph/math/math.ts @@ -0,0 +1,19 @@ +// http://www.datypic.com/sc/ooxml/e-m_oMath-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathFraction } from "./fraction"; +import { MathRun } from "./math-run"; + +export interface IMathOptions { + readonly children: Array; +} + +export class Math extends XmlComponent { + constructor(readonly options: IMathOptions) { + super("m:oMath"); + + for (const child of options.children) { + this.root.push(child); + } + } +} diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 3f39ba68bc..c0375fac5c 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -15,6 +15,7 @@ import { HeadingLevel, Style } from "./formatting/style"; import { CenterTabStop, LeaderType, LeftTabStop, MaxRightTabStop, RightTabStop } from "./formatting/tab-stop"; import { NumberProperties } from "./formatting/unordered-list"; import { Bookmark, Hyperlink, OutlineLevel } from "./links"; +import { Math } from "./math"; import { ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, TextRun } from "./run"; @@ -54,7 +55,7 @@ export interface IParagraphOptions { readonly level: number; readonly custom?: boolean; }; - readonly children?: Array; + readonly children?: Array; } export class Paragraph extends XmlComponent { From 4f8d435e166fe3445649ea3b959cec90b87d226a Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 20 Aug 2019 20:40:40 +0100 Subject: [PATCH 002/107] Add Math Summation --- demo/47-math.ts | 13 +++- src/file/paragraph/math/index.ts | 1 + src/file/paragraph/math/math-run.ts | 1 + src/file/paragraph/math/math.ts | 3 +- src/file/paragraph/math/n-ary/index.ts | 7 ++ .../math/n-ary/math-accent-character.spec.ts | 22 ++++++ .../math/n-ary/math-accent-character.ts | 14 ++++ .../paragraph/math/n-ary/math-base.spec.ts | 27 +++++++ src/file/paragraph/math/n-ary/math-base.ts | 12 +++ .../math/n-ary/math-limit-location.spec.ts | 22 ++++++ .../math/n-ary/math-limit-location.ts | 14 ++++ .../math/n-ary/math-naray-properties.spec.ts | 33 ++++++++ .../math/n-ary/math-naray-properties.ts | 14 ++++ .../math/n-ary/math-sub-script.spec.ts | 27 +++++++ .../paragraph/math/n-ary/math-sub-script.ts | 12 +++ .../paragraph/math/n-ary/math-sum.spec.ts | 75 +++++++++++++++++++ src/file/paragraph/math/n-ary/math-sum.ts | 25 +++++++ .../math/n-ary/math-super-script.spec.ts | 27 +++++++ .../paragraph/math/n-ary/math-super-script.ts | 12 +++ 19 files changed, 359 insertions(+), 2 deletions(-) create mode 100644 src/file/paragraph/math/n-ary/index.ts create mode 100644 src/file/paragraph/math/n-ary/math-accent-character.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-accent-character.ts create mode 100644 src/file/paragraph/math/n-ary/math-base.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-base.ts create mode 100644 src/file/paragraph/math/n-ary/math-limit-location.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-limit-location.ts create mode 100644 src/file/paragraph/math/n-ary/math-naray-properties.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-naray-properties.ts create mode 100644 src/file/paragraph/math/n-ary/math-sub-script.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-sub-script.ts create mode 100644 src/file/paragraph/math/n-ary/math-sum.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-sum.ts create mode 100644 src/file/paragraph/math/n-ary/math-super-script.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-super-script.ts diff --git a/demo/47-math.ts b/demo/47-math.ts index 7862feac97..5cad1707de 100644 --- a/demo/47-math.ts +++ b/demo/47-math.ts @@ -1,7 +1,7 @@ // Simple example to add text to a document // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Math, MathDenominator, MathFraction, MathNumerator, MathRun, Packer, Paragraph, TextRun } from "../build"; +import { Document, Math, MathDenominator, MathFraction, MathNumerator, MathRun, MathSum, Packer, Paragraph, TextRun } from "../build"; const doc = new Document(); @@ -25,6 +25,17 @@ doc.addSection({ }), ], }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSum({ + child: new MathRun("test"), + }), + ], + }), + ], + }), ], }); diff --git a/src/file/paragraph/math/index.ts b/src/file/paragraph/math/index.ts index 9f3b22b5fa..063678689c 100644 --- a/src/file/paragraph/math/index.ts +++ b/src/file/paragraph/math/index.ts @@ -1,3 +1,4 @@ export * from "./math"; export * from "./math-run"; export * from "./fraction"; +export * from "./n-ary"; diff --git a/src/file/paragraph/math/math-run.ts b/src/file/paragraph/math/math-run.ts index 5b9b9536c4..3b7cceb362 100644 --- a/src/file/paragraph/math/math-run.ts +++ b/src/file/paragraph/math/math-run.ts @@ -1,3 +1,4 @@ +// http://www.datypic.com/sc/ooxml/e-m_r-1.html import { XmlComponent } from "file/xml-components"; import { MathText } from "./math-text"; diff --git a/src/file/paragraph/math/math.ts b/src/file/paragraph/math/math.ts index eee6fdff65..43272ed941 100644 --- a/src/file/paragraph/math/math.ts +++ b/src/file/paragraph/math/math.ts @@ -3,9 +3,10 @@ import { XmlComponent } from "file/xml-components"; import { MathFraction } from "./fraction"; import { MathRun } from "./math-run"; +import { MathSum } from "./n-ary"; export interface IMathOptions { - readonly children: Array; + readonly children: Array; } export class Math extends XmlComponent { diff --git a/src/file/paragraph/math/n-ary/index.ts b/src/file/paragraph/math/n-ary/index.ts new file mode 100644 index 0000000000..6929544152 --- /dev/null +++ b/src/file/paragraph/math/n-ary/index.ts @@ -0,0 +1,7 @@ +export * from "./math-accent-character"; +export * from "./math-base"; +export * from "./math-limit-location"; +export * from "./math-naray-properties"; +export * from "./math-sub-script"; +export * from "./math-sum"; +export * from "./math-super-script"; diff --git a/src/file/paragraph/math/n-ary/math-accent-character.spec.ts b/src/file/paragraph/math/n-ary/math-accent-character.spec.ts new file mode 100644 index 0000000000..b414f4c744 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-accent-character.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathAccentCharacter } from "./math-accent-character"; + +describe("MathAccentCharacter", () => { + describe("#constructor()", () => { + it("should create a MathAccentCharacter with correct root key", () => { + const mathAccentCharacter = new MathAccentCharacter("∑"); + + const tree = new Formatter().format(mathAccentCharacter); + expect(tree).to.deep.equal({ + "m:chr": { + _attr: { + "m:val": "∑", + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-accent-character.ts b/src/file/paragraph/math/n-ary/math-accent-character.ts new file mode 100644 index 0000000000..3a5a10d7d2 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-accent-character.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_chr-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathAccentCharacterAttributes extends XmlAttributeComponent<{ readonly accent: string }> { + protected readonly xmlKeys = { accent: "m:val" }; +} + +export class MathAccentCharacter extends XmlComponent { + constructor(readonly accent: string) { + super("m:chr"); + + this.root.push(new MathAccentCharacterAttributes({ accent })); + } +} diff --git a/src/file/paragraph/math/n-ary/math-base.spec.ts b/src/file/paragraph/math/n-ary/math-base.spec.ts new file mode 100644 index 0000000000..012147c4d9 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-base.spec.ts @@ -0,0 +1,27 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathBase } from "./math-base"; + +describe("MathBase", () => { + describe("#constructor()", () => { + it("should create a MathBase with correct root key", () => { + const mathBase = new MathBase(new MathRun("2+2")); + + const tree = new Formatter().format(mathBase); + expect(tree).to.deep.equal({ + "m:e": [ + { + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-base.ts b/src/file/paragraph/math/n-ary/math-base.ts new file mode 100644 index 0000000000..e75231cdb2 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-base.ts @@ -0,0 +1,12 @@ +// http://www.datypic.com/sc/ooxml/e-m_e-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathRun } from "../math-run"; + +export class MathBase extends XmlComponent { + constructor(readonly run: MathRun) { + super("m:e"); + + this.root.push(run); + } +} diff --git a/src/file/paragraph/math/n-ary/math-limit-location.spec.ts b/src/file/paragraph/math/n-ary/math-limit-location.spec.ts new file mode 100644 index 0000000000..426f3d0198 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-limit-location.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathLimitLocation } from "./math-limit-location"; + +describe("MathLimitLocation", () => { + describe("#constructor()", () => { + it("should create a MathLimitLocation with correct root key", () => { + const mathLimitLocation = new MathLimitLocation(); + + const tree = new Formatter().format(mathLimitLocation); + expect(tree).to.deep.equal({ + "m:limLoc": { + _attr: { + "m:val": "undOvr", + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-limit-location.ts b/src/file/paragraph/math/n-ary/math-limit-location.ts new file mode 100644 index 0000000000..5504e1890d --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-limit-location.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_limLoc-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathLimitLocationAttributes extends XmlAttributeComponent<{ readonly value: string }> { + protected readonly xmlKeys = { value: "m:val" }; +} + +export class MathLimitLocation extends XmlComponent { + constructor() { + super("m:limLoc"); + + this.root.push(new MathLimitLocationAttributes({ value: "undOvr" })); + } +} diff --git a/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts b/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts new file mode 100644 index 0000000000..01ac55fb03 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts @@ -0,0 +1,33 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathNArayProperties } from "./math-naray-properties"; + +describe("MathNArayProperties", () => { + describe("#constructor()", () => { + it("should create a MathNArayProperties with correct root key", () => { + const mathNArayProperties = new MathNArayProperties("∑"); + + const tree = new Formatter().format(mathNArayProperties); + expect(tree).to.deep.equal({ + "m:naryPr": [ + { + "m:chr": { + _attr: { + "m:val": "∑", + }, + }, + }, + { + "m:limLoc": { + _attr: { + "m:val": "undOvr", + }, + }, + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-naray-properties.ts b/src/file/paragraph/math/n-ary/math-naray-properties.ts new file mode 100644 index 0000000000..4b28b58794 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-naray-properties.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_naryPr-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathAccentCharacter } from "./math-accent-character"; +import { MathLimitLocation } from "./math-limit-location"; + +export class MathNArayProperties extends XmlComponent { + constructor(readonly accent: string) { + super("m:naryPr"); + + this.root.push(new MathAccentCharacter(accent)); + this.root.push(new MathLimitLocation()); + } +} diff --git a/src/file/paragraph/math/n-ary/math-sub-script.spec.ts b/src/file/paragraph/math/n-ary/math-sub-script.spec.ts new file mode 100644 index 0000000000..d09908b192 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-sub-script.spec.ts @@ -0,0 +1,27 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathSubScript } from "./math-sub-script"; + +describe("MathSubScript", () => { + describe("#constructor()", () => { + it("should create a MathSubScript with correct root key", () => { + const mathSubScript = new MathSubScript(new MathRun("2+2")); + + const tree = new Formatter().format(mathSubScript); + expect(tree).to.deep.equal({ + "m:sub": [ + { + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-sub-script.ts b/src/file/paragraph/math/n-ary/math-sub-script.ts new file mode 100644 index 0000000000..25fe8da894 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-sub-script.ts @@ -0,0 +1,12 @@ +// http://www.datypic.com/sc/ooxml/e-m_e-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathRun } from "../math-run"; + +export class MathSubScript extends XmlComponent { + constructor(readonly run: MathRun) { + super("m:sub"); + + this.root.push(run); + } +} diff --git a/src/file/paragraph/math/n-ary/math-sum.spec.ts b/src/file/paragraph/math/n-ary/math-sum.spec.ts new file mode 100644 index 0000000000..e168792b1f --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-sum.spec.ts @@ -0,0 +1,75 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathSum } from "./math-sum"; + +describe("MathSum", () => { + describe("#constructor()", () => { + it("should create a MathSum with correct root key", () => { + const mathSum = new MathSum({ + child: new MathRun("1"), + subScript: new MathRun("2"), + superScript: new MathRun("3"), + }); + + const tree = new Formatter().format(mathSum); + expect(tree).to.deep.equal({ + "m:nary": [ + { + "m:naryPr": [ + { + "m:chr": { + _attr: { + "m:val": "∑", + }, + }, + }, + { + "m:limLoc": { + _attr: { + "m:val": "undOvr", + }, + }, + }, + ], + }, + { + "m:sub": [ + { + "m:r": [ + { + "m:t": ["1"], + }, + ], + }, + ], + }, + { + "m:sup": [ + { + "m:r": [ + { + "m:t": ["1"], + }, + ], + }, + ], + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["1"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-sum.ts b/src/file/paragraph/math/n-ary/math-sum.ts new file mode 100644 index 0000000000..2664b87fad --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-sum.ts @@ -0,0 +1,25 @@ +// http://www.datypic.com/sc/ooxml/e-m_nary-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathRun } from "../math-run"; +import { MathBase } from "./math-base"; +import { MathNArayProperties } from "./math-naray-properties"; +import { MathSubScript } from "./math-sub-script"; +import { MathSuperScript } from "./math-super-script"; + +export interface IMathSumOptions { + readonly child: MathRun; + readonly subScript?: MathRun; + readonly superScript?: MathRun; +} + +export class MathSum extends XmlComponent { + constructor(readonly options: IMathSumOptions) { + super("m:nary"); + + this.root.push(new MathNArayProperties("∑")); + this.root.push(new MathSubScript(options.child)); + this.root.push(new MathSuperScript(options.child)); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/n-ary/math-super-script.spec.ts b/src/file/paragraph/math/n-ary/math-super-script.spec.ts new file mode 100644 index 0000000000..7270276c28 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-super-script.spec.ts @@ -0,0 +1,27 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathSuperScript } from "./math-super-script"; + +describe("MathSuperScript", () => { + describe("#constructor()", () => { + it("should create a MathSuperScript with correct root key", () => { + const mathSuperScript = new MathSuperScript(new MathRun("2+2")); + + const tree = new Formatter().format(mathSuperScript); + expect(tree).to.deep.equal({ + "m:sup": [ + { + "m:r": [ + { + "m:t": ["2+2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-super-script.ts b/src/file/paragraph/math/n-ary/math-super-script.ts new file mode 100644 index 0000000000..8296c59f6a --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-super-script.ts @@ -0,0 +1,12 @@ +// http://www.datypic.com/sc/ooxml/e-m_e-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathRun } from "../math-run"; + +export class MathSuperScript extends XmlComponent { + constructor(readonly run: MathRun) { + super("m:sup"); + + this.root.push(run); + } +} From ee435852107593385ed1a9112d76a594cd8ed94d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2020 09:48:31 +0000 Subject: [PATCH 003/107] build(deps-dev): bump @types/mocha from 8.0.0 to 8.0.1 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5174555098..c727674b25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.0.tgz", - "integrity": "sha512-jWeYcTo3sCH/rMgsdYXDTO85GNRyTCII5dayMIu/ZO4zbEot1E3iNGaOwpLReLUHjeNQFkgeNNVYlY4dX6azQQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.1.tgz", + "integrity": "sha512-TBZ6YdX7IZz4U9/mBoB8zCMRN1vXw8QdihRcZxD3I0Cv/r8XF8RggZ8WiXFws4aj5atzRR5hJrYer7g8nXwpnQ==", "dev": true }, "@types/node": { @@ -1029,7 +1029,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1058,7 +1058,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -1132,7 +1132,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1881,7 +1881,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -3015,7 +3015,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5430,7 +5430,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -6103,7 +6103,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -6315,7 +6315,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -6392,7 +6392,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -7701,7 +7701,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -8218,7 +8218,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8870,13 +8870,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8890,7 +8890,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -9023,7 +9023,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -9067,7 +9067,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 05dda37b710ccdf9b68820f94c988c30c8f36833 Mon Sep 17 00:00:00 2001 From: Jan Marten <546795+LeovR@users.noreply.github.com> Date: Thu, 6 Aug 2020 08:56:02 +0000 Subject: [PATCH 004/107] Fix comment regarding output file name --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 28781012fe..f48a42ecf6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -53,7 +53,7 @@ Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); }); -// Done! A file called 'My First Document.docx' will be in your file system. +// Done! A file called 'My Document.docx' will be in your file system. ```

From 7a48da440b0d2a6d3b9efdf89c0347dfd9730e57 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2020 22:43:32 +0000 Subject: [PATCH 005/107] build(deps): [security] bump prismjs from 1.20.0 to 1.21.0 Bumps [prismjs](https://github.com/PrismJS/prism) from 1.20.0 to 1.21.0. **This update includes a security fix.** - [Release notes](https://github.com/PrismJS/prism/releases) - [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md) - [Commits](https://github.com/PrismJS/prism/compare/v1.20.0...v1.21.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5174555098..a569f2b171 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1029,7 +1029,7 @@ }, "util": { "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1058,7 +1058,7 @@ }, "async": { "version": "0.9.2", - "resolved": "http://registry.npmjs.org/async/-/async-0.9.2.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", "dev": true }, @@ -1132,7 +1132,7 @@ }, "chalk": { "version": "1.1.3", - "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "dev": true, "requires": { @@ -1881,7 +1881,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -3015,7 +3015,7 @@ }, "fast-deep-equal": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=", "dev": true }, @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5430,7 +5430,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { @@ -6103,7 +6103,7 @@ }, "os-locale": { "version": "1.4.0", - "resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", "dev": true, "requires": { @@ -6315,7 +6315,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -6392,7 +6392,7 @@ }, "pify": { "version": "2.3.0", - "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, @@ -6498,9 +6498,9 @@ "dev": true }, "prismjs": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.20.0.tgz", - "integrity": "sha512-AEDjSrVNkynnw6A+B1DsFkd6AVdTnp+/WoUixFRULlCLZVRZlVQMVWio/16jv7G1FscUxQxOQhWwApgbnxr6kQ==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.21.0.tgz", + "integrity": "sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw==", "dev": true, "requires": { "clipboard": "^2.0.0" @@ -7701,7 +7701,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -8218,7 +8218,7 @@ }, "yargs": { "version": "3.10.0", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", "dev": true, "requires": { @@ -8870,13 +8870,13 @@ "dependencies": { "async": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/async/-/async-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz", "integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k=", "dev": true }, "colors": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, @@ -8890,7 +8890,7 @@ }, "wrap-ansi": { "version": "2.1.0", - "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", "dev": true, "requires": { @@ -9023,7 +9023,7 @@ }, "yargs": { "version": "4.8.1", - "resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz", "integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=", "dev": true, "requires": { @@ -9067,7 +9067,7 @@ }, "yargs-parser": { "version": "2.4.1", - "resolved": "http://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-2.4.1.tgz", "integrity": "sha1-hVaN488VD/SfpRgl8DqMiA3cxcQ=", "dev": true, "requires": { From 08f9926e600a2b9f334283949f9eb22fb3a50c9c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2020 08:38:15 +0000 Subject: [PATCH 006/107] build(deps-dev): bump sinon from 9.0.2 to 9.0.3 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.0.2 to 9.0.3. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e544100c5..658a46b4ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -498,9 +498,9 @@ } }, "@sinonjs/samsam": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.3.tgz", - "integrity": "sha512-QucHkc2uMJ0pFGjJUDP3F9dq5dx8QIaqISl9QgwLOh6P9yv877uONPGXh/OH/0zmM3tW1JjuJltAZV2l7zU+uQ==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.1.0.tgz", + "integrity": "sha512-42nyaQOVunX5Pm6GRJobmzbS7iLI+fhERITnETXzzwDZh+TtDr/Au3yAvXVjFmZ4wEUaE4Y3NFZfKv0bV0cbtg==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -7303,17 +7303,17 @@ "dev": true }, "sinon": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.2.tgz", - "integrity": "sha512-0uF8Q/QHkizNUmbK3LRFqx5cpTttEVXudywY9Uwzy8bTfZUhljZ7ARzSxnRHWYWtVTeh4Cw+tTb3iU21FQVO9A==", + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.3.tgz", + "integrity": "sha512-IKo9MIM111+smz9JGwLmw5U1075n1YXeAq8YeSFlndCLhAL5KGn6bLgu7b/4AYHTV/LcEMcRm2wU2YiL55/6Pg==", "dev": true, "requires": { "@sinonjs/commons": "^1.7.2", "@sinonjs/fake-timers": "^6.0.1", "@sinonjs/formatio": "^5.0.1", - "@sinonjs/samsam": "^5.0.3", + "@sinonjs/samsam": "^5.1.0", "diff": "^4.0.2", - "nise": "^4.0.1", + "nise": "^4.0.4", "supports-color": "^7.1.0" }, "dependencies": { From c91f135c2848b0394aa2cc80d5d8c8ca539a7b76 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2020 08:37:49 +0000 Subject: [PATCH 007/107] build(deps-dev): bump @types/mocha from 8.0.1 to 8.0.2 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.1 to 8.0.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6e544100c5..94a8bdd92e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.1.tgz", - "integrity": "sha512-TBZ6YdX7IZz4U9/mBoB8zCMRN1vXw8QdihRcZxD3I0Cv/r8XF8RggZ8WiXFws4aj5atzRR5hJrYer7g8nXwpnQ==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.2.tgz", + "integrity": "sha512-5cv8rmqT3KX9XtWDvSgGYfS4OwrKM2eei90GWLnTYz+AXRiBv5uYcKBjnkQ4katNvfYk3+o2bHGZUsDhdcoUyg==", "dev": true }, "@types/node": { From 8a189161f230b1c1c8acb3ef599dd595cc2a403e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 08:28:30 +0000 Subject: [PATCH 008/107] build(deps): [security] bump dot-prop from 4.2.0 to 4.2.1 Bumps [dot-prop](https://github.com/sindresorhus/dot-prop) from 4.2.0 to 4.2.1. **This update includes a security fix.** - [Release notes](https://github.com/sindresorhus/dot-prop/releases) - [Commits](https://github.com/sindresorhus/dot-prop/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2c8be0ca..9b967d2e20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2531,9 +2531,9 @@ "dev": true }, "dot-prop": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", - "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz", + "integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==", "dev": true, "requires": { "is-obj": "^1.0.0" From dc1f3aebe9bd3559ced112c8bd32d2200a96ff50 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 08:29:38 +0000 Subject: [PATCH 009/107] build(deps): bump @types/node from 14.0.27 to 14.6.0 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.0.27 to 14.6.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2c8be0ca..8024348871 100644 --- a/package-lock.json +++ b/package-lock.json @@ -582,9 +582,9 @@ "dev": true }, "@types/node": { - "version": "14.0.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.27.tgz", - "integrity": "sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g==" + "version": "14.6.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", + "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" }, "@types/request": { "version": "2.48.5", From 58fae6b201cc838a6566bb67cdfd06074aa11c9e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2020 08:30:15 +0000 Subject: [PATCH 010/107] build(deps-dev): bump @types/mocha from 8.0.2 to 8.0.3 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.2 to 8.0.3. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index df2c8be0ca..158af12419 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.2.tgz", - "integrity": "sha512-5cv8rmqT3KX9XtWDvSgGYfS4OwrKM2eei90GWLnTYz+AXRiBv5uYcKBjnkQ4katNvfYk3+o2bHGZUsDhdcoUyg==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.3.tgz", + "integrity": "sha512-vyxR57nv8NfcU0GZu8EUXZLTbCMupIUwy95LJ6lllN+JRPG25CwMHoB1q5xKh8YKhQnHYRAn4yW2yuHbf/5xgg==", "dev": true }, "@types/node": { From 1285304f974a356729b0686d253452c0e8dd3809 Mon Sep 17 00:00:00 2001 From: Raymond Berger Date: Wed, 19 Aug 2020 10:54:27 -1000 Subject: [PATCH 011/107] remove broken examples link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9dd52e1a94..84469fa454 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Please refer to the [documentation at https://docx.js.org/](https://docx.js.org/ # Examples -Check the `examples` section in the [documentation](https://docx.js.org/#/examples) and the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples. +Check the [demo folder](https://github.com/dolanmiu/docx/tree/master/demo) for examples. # Contributing From 364ce6d85664a8b7a149aed258fea97386fa2e41 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 18:35:48 +0000 Subject: [PATCH 012/107] build(deps-dev): bump ts-node from 8.10.2 to 9.0.0 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.10.2 to 9.0.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v8.10.2...v9.0.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 841f8d4763..b917352c3a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7915,9 +7915,9 @@ "dev": true }, "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", + "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", "dev": true, "requires": { "arg": "^4.1.0", diff --git a/package.json b/package.json index 9edda454f0..51e1b246c3 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "rimraf": "^3.0.2", "shelljs": "^0.8.4", "sinon": "^9.0.2", - "ts-node": "^8.10.2", + "ts-node": "^9.0.0", "tslint": "^6.1.3", "tslint-immutable": "^4.9.0", "typedoc": "^0.16.11", From 491c7abd1cf6ba0fe1f1439100f713a91b6227a9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 18:36:24 +0000 Subject: [PATCH 013/107] build(deps-dev): bump prettier from 2.0.5 to 2.1.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.0.5...2.1.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 841f8d4763..182c107308 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.0.tgz", + "integrity": "sha512-lz28cCbA1cDFHVuY8vvj6QuqOwIpyIfPUYkSl8AZ/vxH8qBXMMjE2knfLHCrZCmUsK/H1bg1P0tOo0dJkTJHvw==", "dev": true }, "prismjs": { From a576098639de279d24f5d824ece63121ef866840 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 19:36:39 +0000 Subject: [PATCH 014/107] build(deps-dev): bump prettier from 2.1.0 to 2.1.1 Bumps [prettier](https://github.com/prettier/prettier) from 2.1.0 to 2.1.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.0...2.1.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb7f22ddb9..f5f162c321 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.0.tgz", - "integrity": "sha512-lz28cCbA1cDFHVuY8vvj6QuqOwIpyIfPUYkSl8AZ/vxH8qBXMMjE2knfLHCrZCmUsK/H1bg1P0tOo0dJkTJHvw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", + "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", "dev": true }, "prismjs": { From 37251c84f8ae5849573457db2a5dd03415c8f62f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 19:37:11 +0000 Subject: [PATCH 015/107] build(deps): bump @types/node from 14.6.0 to 14.6.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.6.0 to 14.6.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb7f22ddb9..3c691f6b58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -582,9 +582,9 @@ "dev": true }, "@types/node": { - "version": "14.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", - "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" + "version": "14.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.2.tgz", + "integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A==" }, "@types/request": { "version": "2.48.5", From e196d9d917c621c8a9622b2033f6b23b65007f21 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 5 Sep 2020 18:40:40 +0100 Subject: [PATCH 016/107] Add Clippy the mascot --- docs/clippy.png | Bin 0 -> 30632 bytes docs/clippy.psd | Bin 0 -> 153099 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 docs/clippy.png create mode 100644 docs/clippy.psd diff --git a/docs/clippy.png b/docs/clippy.png new file mode 100644 index 0000000000000000000000000000000000000000..97bd4af2df2c9ddb8a708cfd0d519d6fb9db72ad GIT binary patch literal 30632 zcmeIb2UJwc)-H-D3L>DAL=+Gt2~Ey4If-P+nFg9nH#sK>A|S9)$vI2TAX!jy&N*kv zlJi^WmhIVRpa1f||Gsy}9RtPys@IxxR@GOt=KN}|rty)M6hXWF@HPSh0-ES^!I!}A zL*RQE`6lp_SI_S{@C(K4xw0h!0{YkU?`y$S==cZ-d^?76N>)k|;v70~QyPdaTpLPb zXKDsWBOriz?93oK#!xFFZK%E>jEi`^yqcKEP?w8Xky(OH!b|{aVEEj@0xIhuDW~IL zti!HL%)@;fY{vl@Fojw{i0n*FV3r(qT*N=@asch~%e2HqKSZpIxrq7BJ0wz)kR}p< zTR@4JX;?ry^o(potn4)O%dSbo4B=bnLYBOdvXX4mx%YI(ni%zlgbS11+$H zt{%rrLE%5U172|v8(3MHanRD*+S=0CGSa{;^l9nY+1Y977-$(7K!60u(jI07u>-*@ zNq!pnWk(QdsbgViW@QM65uMwGXv3|oxQL0*JG%J#b6%!q7ahSY|HKYJk=71kMoUja zNBd7ox;hs+X4V!aKZd5OLkl&5nnGb#mVh4pKkAtoz^&kx2JrvT<;Cs)*fFps5)v1E z|KoT~P5-fLODiE80D?au{YOnpIeRlG?MtX7+}c71Dr5sph2)=RZ)x=s`q%1Q!W1C> zkA|!a_5OpM^E>|$1gM?ie^5KW^Hc4IPyJkKFaR2dfCUs{1-Foc!%etuJ-2*x7XGK#Wi(1`sxDH_cuVJz4vP0PDblE{rJ$79XJv|fxVrPfYgV^Zl81?Ab z*`ZK2=&z1`Gxl#CNm&>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{r-i@v)>^^cM$EPv6KKwMOE4;>-(G&K>?JfjPrR)<>Pr=`QA!|# zQCzZPQ21ijz@FO3c&y?;kCS49htMT#et!OAVxMrLU(Xc9=cQg8J*#qK|I)=o_1(=! zjMD|8Y4_v(mR60iA1`(@Z%p2rzr~`iMEmC#ztkJ1%V!+ zbjvIB_l%DRr1Sf|69P(pYAVC7+_8+CSm8+zm*xK|5J|g}KLbndYAWVn01V&PV9#3~vZ810# z#@4UHkqcJhLrPnE-cD%Nzr|zB9a4x-@2jb@ts9h@(4b8{)j&h}ZUkUaFgV?Qe}H0$u3Tha^LbOOa0$ zN;cxj%&hQ7Rp7{oJKx&vQ>@)y>qt5{_!bFa$x;EC`rUn6Wo5AqhvnL0xM5T6YBmyb zy9le-oTXwHS&ACoo1WYFRLHo)y>uN_iol?yT3H;QQe|~?pkr5$a|yk@#rN@+wCeJF ztrsdpo0h6aFE(6!ZulED#m98u?Yc2$36Fq${oO)VX{d1|juiZ3I8vZ^*H)1NH%C|bt{z7-`jZ_;5VD|-Lf|jrk0$nS1jGQvHde$_gRJSI)$dPo4k%_n4zyKQ5x1k_wpx&og5!} zkXuE$jgwM@sCm+e=g$T9?ve|-cO{BXK7=ur(hu$gk52cu!~%N1Ug!uj)T8{%pA-Gl gyI4@_&K@H~Z*y#>1}RdX|1VupAxXh(el7R^2QQ4WkN^Mx literal 0 HcmV?d00001 diff --git a/docs/clippy.psd b/docs/clippy.psd new file mode 100644 index 0000000000000000000000000000000000000000..5193c920e65585a3b5eca7903fa57af7302ee932 GIT binary patch literal 153099 zcmeEv30xFM_J0pI3Mk%ZG)7~LK?S_PAVy-0F{lyoHUwb?4QDvS=ps2bm_s9K95YcD zjOVBm;&?_y(RfAM7!SY$Vl;`Pcn~9q49wL3`>K0}!DGW_cYpug{lH9jS69FH>eZ`P zud2JhQ}iD^Dnw8S(w_qkH?SE67r|c23TxMY@UUQqF8r*qlvlIo*E-X=|LW%hXC{P4 zL@Sd!PE|%tj|=Ejx_e)zj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;j_GnHnMO*o)?Ek&mRvZuhC&~M?E!^sjwi7Xt_G_ED*P&a| zh|o5%mS{^O;NKq5HnPTPI~5c9Yi)z_J|;SCr(ychcDjNBKqjR{Ki%81vz Date: Sat, 5 Sep 2020 18:41:24 +0100 Subject: [PATCH 017/107] Add Clippy to readme --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index f48a42ecf6..9d2150a441 100644 --- a/docs/README.md +++ b/docs/README.md @@ -57,7 +57,7 @@ Packer.toBuffer(doc).then((buffer) => { ```

- clippy the assistant + clippy the assistant

--- From 93a7d607b241f4c833301a2419cd42e03c9ddc95 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 5 Sep 2020 18:51:50 +0100 Subject: [PATCH 018/107] Update PSD --- docs/clippy.psd | Bin 153099 -> 153099 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/clippy.psd b/docs/clippy.psd index 5193c920e65585a3b5eca7903fa57af7302ee932..0d32ab12d06bab589658c43e5d024830bb338a83 100644 GIT binary patch delta 331 zcmeBP!`Z!tbAt;rtEr)tk?CYlW=ANipLw%xnvtQ2ftiV^u2GtiiLSAkiKT9mfoYO% zvav-NX=j4qXBAc68cC)GwqiymE4hN`BZ#hnHF5Zuq5*Z8`(ioB%bQw~CbRvVn tWP?oO$?TZ|a22LNRmMQIa23r4ncEFA8Lf?ZQOunzmnyY=(j3Ohod80aT}1!@ delta 330 zcmeBP!`Z!tbAt;rtFfV#p~YlRW=ANipLw&cQL3Rys-a=Bu4$5miEf&)Ns?}ofhmx% zOg1$&H#0ReN=&oSugER%^|kVxypcm>b2H0sRuy8jOK(6KHL&+wL8bF23HyA9OJbeRld{P(~ zm@5i$l6@F}3>C|y#3VDzBs1OAG|QCDa;bBfB`q0}7!rZli~+_EQzjc^ m8c$}=6hKp9icryPkh$F;lhN9k7scGka;Z|=C(U83+z9}TkYh~% From 0c068bb03b941bebe7eaba0b225f0287e347ea59 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2020 18:39:58 +0000 Subject: [PATCH 019/107] build(deps-dev): bump @types/webpack from 4.41.21 to 4.41.22 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.41.21 to 4.41.22. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 281094bd8d..e5cdbb79a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -670,9 +670,9 @@ } }, "@types/webpack": { - "version": "4.41.21", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.21.tgz", - "integrity": "sha512-2j9WVnNrr/8PLAB5csW44xzQSJwS26aOnICsP3pSGCEdsu6KYtfQ6QJsVUKHWRnm1bL7HziJsfh5fHqth87yKA==", + "version": "4.41.22", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.22.tgz", + "integrity": "sha512-JQDJK6pj8OMV9gWOnN1dcLCyU9Hzs6lux0wBO4lr1+gyEhIBR9U3FMrz12t2GPkg110XAxEAw2WHF6g7nZIbRQ==", "dev": true, "requires": { "@types/anymatch": "*", From 57c480a6c60b07d60df5ac4ec3bd5d452e22277f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 11 Sep 2020 16:44:55 +0000 Subject: [PATCH 020/107] build(deps): [security] bump node-fetch from 2.6.0 to 2.6.1 Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. **This update includes a security fix.** - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5cdbb79a5..316cb7c06c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5627,9 +5627,9 @@ } }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "dev": true }, "node-libs-browser": { From af0bf5ced5ac07f5ebaaefd5e4e3922969a5a8c5 Mon Sep 17 00:00:00 2001 From: Matt Walsh <51417385+netbymatt@users.noreply.github.com> Date: Fri, 11 Sep 2020 21:10:10 -0500 Subject: [PATCH 021/107] Fix row height option --- docs/usage/tables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/tables.md b/docs/usage/tables.md index a8e41de58a..38a74f8ba7 100644 --- a/docs/usage/tables.md +++ b/docs/usage/tables.md @@ -103,7 +103,7 @@ Here is a list of options you can add to the `table row`: | children | `Array` | Required | | cantSplit | `boolean` | Optional | | tableHeader | `boolean` | Optional | -| height | `{ value: number, rule: HeightRule }` | Optional | +| height | `{ height: number, rule: HeightRule }` | Optional | ### Repeat row From 38079b61718a0339e12e3c3414bca1c36b255201 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2020 18:43:32 +0000 Subject: [PATCH 022/107] build(deps-dev): bump prettier from 2.1.1 to 2.1.2 Bumps [prettier](https://github.com/prettier/prettier) from 2.1.1 to 2.1.2. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.1...2.1.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 316cb7c06c..ab66a41a83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6492,9 +6492,9 @@ "dev": true }, "prettier": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", - "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", + "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", "dev": true }, "prismjs": { From 5125e774314cf6664e8a3b3ff546aacc09bd9ded Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 5 Oct 2020 19:38:42 +0000 Subject: [PATCH 023/107] build(deps-dev): bump sinon from 9.0.3 to 9.1.0 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.0.3 to 9.1.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/compare/v9.0.3...v9.1.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index ab66a41a83..196fc1b90f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4919,9 +4919,9 @@ } }, "just-extend": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz", - "integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.1.tgz", + "integrity": "sha512-aWgeGFW67BP3e5181Ep1Fv2v8z//iBJfrvyTnq8wG86vEESwmonn1zPBJ0VfmT9CJq2FIT0VsETtrNFm2a+SHA==", "dev": true }, "keyv": { @@ -7303,9 +7303,9 @@ "dev": true }, "sinon": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.0.3.tgz", - "integrity": "sha512-IKo9MIM111+smz9JGwLmw5U1075n1YXeAq8YeSFlndCLhAL5KGn6bLgu7b/4AYHTV/LcEMcRm2wU2YiL55/6Pg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.1.0.tgz", + "integrity": "sha512-9zQShgaeylYH6qtsnNXlTvv0FGTTckuDfHBi+qhgj5PvW2r2WslHZpgc3uy3e/ZAoPkqaOASPi+juU6EdYRYxA==", "dev": true, "requires": { "@sinonjs/commons": "^1.7.2", @@ -7330,9 +7330,9 @@ "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" From 6cbe40cecb79ea4ff12a8544e947c0e6bc77e245 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 23 Sep 2020 11:23:00 +0200 Subject: [PATCH 024/107] add settings option to add trackRevisions --- src/file/settings/settings.ts | 11 +++++++++++ src/file/settings/track-revisions.spec.ts | 16 ++++++++++++++++ src/file/settings/track-revisions.ts | 7 +++++++ 3 files changed, 34 insertions(+) create mode 100644 src/file/settings/track-revisions.spec.ts create mode 100644 src/file/settings/track-revisions.ts diff --git a/src/file/settings/settings.ts b/src/file/settings/settings.ts index abae0e61d4..2fa4a27f0a 100644 --- a/src/file/settings/settings.ts +++ b/src/file/settings/settings.ts @@ -1,6 +1,7 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { Compatibility } from "./compatibility"; import { UpdateFields } from "./update-fields"; +import { TrackRevisions } from "./track-revisions"; export interface ISettingsAttributesProperties { readonly wpc?: string; @@ -46,6 +47,7 @@ export class SettingsAttributes extends XmlAttributeComponent child instanceof TrackRevisions)) { + this.addChildElement(this.trackRevisions); + } + + return this.trackRevisions; + } } diff --git a/src/file/settings/track-revisions.spec.ts b/src/file/settings/track-revisions.spec.ts new file mode 100644 index 0000000000..3875d51f0a --- /dev/null +++ b/src/file/settings/track-revisions.spec.ts @@ -0,0 +1,16 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { TrackRevisions } from "file/settings/track-revisions"; + +import { EMPTY_OBJECT } from "file/xml-components"; + +describe("TrackRevisions", () => { + describe("#constructor", () => { + it("creates an initially empty property object", () => { + const trackRevisions = new TrackRevisions(); + + const tree = new Formatter().format(trackRevisions); + expect(tree).to.deep.equal({ "w:trackRevisions": EMPTY_OBJECT }); + }); + }); +}); diff --git a/src/file/settings/track-revisions.ts b/src/file/settings/track-revisions.ts new file mode 100644 index 0000000000..2da692827e --- /dev/null +++ b/src/file/settings/track-revisions.ts @@ -0,0 +1,7 @@ +import { XmlComponent } from "file/xml-components"; + +export class TrackRevisions extends XmlComponent { + constructor() { + super("w:trackRevisions"); + } +} From 2adfe532dde74234e1f6665f85da4ae18f2775fb Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 23 Sep 2020 12:59:55 +0200 Subject: [PATCH 025/107] add more unit tests for trackRevision settings --- src/file/settings/settings.spec.ts | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/file/settings/settings.spec.ts b/src/file/settings/settings.spec.ts index 1e34c781c2..9be90669aa 100644 --- a/src/file/settings/settings.spec.ts +++ b/src/file/settings/settings.spec.ts @@ -79,4 +79,47 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:compat"); }); }); + describe("#addTrackRevisions", () => { + it("should add an empty Track Revisions", () => { + const settings = new Settings(); + settings.addTrackRevisions(); + + const tree = new Formatter().format(settings); + let keys: string[] = Object.keys(tree); + expect(keys[0]).to.be.equal("w:settings"); + const rootArray = tree["w:settings"]; + expect(rootArray).is.an.instanceof(Array); + expect(rootArray).has.length(2); + keys = Object.keys(rootArray[0]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("_attr"); + keys = Object.keys(rootArray[1]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("w:trackRevisions"); + }); + }); + describe("#addTrackRevisionsTwice", () => { + it("should add an empty Track Revisions if called twice", () => { + const settings = new Settings(); + settings.addTrackRevisions(); + settings.addTrackRevisions(); + + const tree = new Formatter().format(settings); + let keys: string[] = Object.keys(tree); + expect(keys[0]).to.be.equal("w:settings"); + const rootArray = tree["w:settings"]; + expect(rootArray).is.an.instanceof(Array); + expect(rootArray).has.length(2); + keys = Object.keys(rootArray[0]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("_attr"); + keys = Object.keys(rootArray[1]); + expect(keys).is.an.instanceof(Array); + expect(keys).has.length(1); + expect(keys[0]).to.be.equal("w:trackRevisions"); + }); + }); }); From 09db2c528a15a5442967e7633cfd2fd7b425f7c5 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Thu, 24 Sep 2020 10:24:00 +0200 Subject: [PATCH 026/107] added InsertedTextRun and DeletedTextRun for Revision Tracking --- src/file/index.ts | 1 + src/file/paragraph/paragraph.ts | 3 + src/file/track-revision/index.ts | 1 + .../track-revision/track-revision.spec.ts | 81 +++++++++++++++++++ src/file/track-revision/track-revision.ts | 72 +++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 src/file/track-revision/index.ts create mode 100644 src/file/track-revision/track-revision.spec.ts create mode 100644 src/file/track-revision/track-revision.ts diff --git a/src/file/index.ts b/src/file/index.ts index c4ce99e345..62e7e647ac 100644 --- a/src/file/index.ts +++ b/src/file/index.ts @@ -13,3 +13,4 @@ export * from "./header-wrapper"; export * from "./footer-wrapper"; export * from "./header"; export * from "./footnotes"; +export * from "./track-revision" diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index e1db0ec910..856c34aacf 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -3,6 +3,7 @@ import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run" import { IXmlableObject, XmlComponent } from "file/xml-components"; import { File } from "../file"; +import { InsertedTextRun, DeletedTextRun } from "../track-revision"; import { PageBreak } from "./formatting/page-break"; import { Bookmark, HyperlinkRef } from "./links"; import { IParagraphPropertiesOptions, ParagraphProperties } from "./properties"; @@ -19,6 +20,8 @@ export interface IParagraphOptions extends IParagraphPropertiesOptions { | SequentialIdentifier | FootnoteReferenceRun | HyperlinkRef + | InsertedTextRun + | DeletedTextRun )[]; } diff --git a/src/file/track-revision/index.ts b/src/file/track-revision/index.ts new file mode 100644 index 0000000000..20bb87a229 --- /dev/null +++ b/src/file/track-revision/index.ts @@ -0,0 +1 @@ +export * from "./track-revision"; diff --git a/src/file/track-revision/track-revision.spec.ts b/src/file/track-revision/track-revision.spec.ts new file mode 100644 index 0000000000..faa4d5a565 --- /dev/null +++ b/src/file/track-revision/track-revision.spec.ts @@ -0,0 +1,81 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { InsertedTextRun, DeletedTextRun } from "./track-revision"; +import { TextRun } from "../paragraph"; + +describe("InsertedTestRun", () => { + describe("#constructor", () => { + it("should create a inserted text run", () => { + const textRun = new TextRun({ + text: "some text" + }); + const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }) + const tree = new Formatter().format(insertedTextRun); + expect(tree).to.deep.equal({ + "w:ins": [ + { + "_attr": + { + "w:author": "Author", + "w:date": "123", + "w:id": 0 + } + }, + { + "w:r": [ + { + "w:t": [ + { + "_attr": + { + "xml:space": "preserve" + } + }, + "some text" + ] + } + ], + } + ] + }); + }); + }); +}); +describe("DeletedTestRun", () => { + describe("#constructor", () => { + it("should create a deleted text run", () => { + + const insertedParagraph = new DeletedTextRun({ text: 'some text', id: 0, date: "123", author: "Author" }) + const tree = new Formatter().format(insertedParagraph); + expect(tree).to.deep.equal({ + "w:del": [ + { + "_attr": + { + "w:author": "Author", + "w:date": "123", + "w:id": 0 + } + }, + { + "w:r": [ + { + "w:delText": [ + { + "_attr": + { + "xml:space": "preserve" + } + }, + "some text" + ] + } + ], + } + ] + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision.ts b/src/file/track-revision/track-revision.ts new file mode 100644 index 0000000000..1af9e7dba3 --- /dev/null +++ b/src/file/track-revision/track-revision.ts @@ -0,0 +1,72 @@ +import { SpaceType } from "file/space-type"; +import { XmlComponent, XmlAttributeComponent } from "file/xml-components"; +import { TextRun } from "../index"; + +export interface ITrackRevisionAttributesProperties { + readonly id: number; + readonly author: string; + readonly date: string; +} + +export class TrackRevisionAttributes extends XmlAttributeComponent { + protected readonly xmlKeys = { + id: "w:id", + author: "w:author", + date: "w:date", + }; +} + +export interface IInsertedTextRunOptions extends ITrackRevisionAttributesProperties { + readonly child: TextRun +} + +export interface IDeletedTextRunOptions extends ITrackRevisionAttributesProperties { + readonly text: string +} + +export class InsertedTextRun extends XmlComponent { + constructor(options: IInsertedTextRunOptions) { + super("w:ins"); + this.root.push( + new TrackRevisionAttributes({ + id: options.id, + author: options.author, + date: options.date, + }) + ); + this.addChildElement(options.child); + } +} + +export class DeletedTextRunWrapper extends XmlComponent { + constructor(text: string) { + super("w:r"); + this.root.push(new DeletedText(text)); + } +} + +class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { + protected readonly xmlKeys = { space: "xml:space" }; +} + +export class DeletedText extends XmlComponent { + constructor(text: string) { + super("w:delText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push(text); + } +} + +export class DeletedTextRun extends XmlComponent { + constructor(options: IDeletedTextRunOptions) { + super("w:del"); + this.root.push( + new TrackRevisionAttributes({ + id: options.id, + author: options.author, + date: options.date, + }) + ); + this.addChildElement(new DeletedTextRunWrapper(options.text)); + } +} From 065c17de741cb5b79245781cd3dabf164d8afc35 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Thu, 24 Sep 2020 10:43:15 +0200 Subject: [PATCH 027/107] style fixes --- src/file/index.ts | 2 +- .../track-revision/track-revision.spec.ts | 59 +++++++++---------- src/file/track-revision/track-revision.ts | 8 +-- 3 files changed, 32 insertions(+), 37 deletions(-) diff --git a/src/file/index.ts b/src/file/index.ts index 62e7e647ac..18f0a595e4 100644 --- a/src/file/index.ts +++ b/src/file/index.ts @@ -13,4 +13,4 @@ export * from "./header-wrapper"; export * from "./footer-wrapper"; export * from "./header"; export * from "./footnotes"; -export * from "./track-revision" +export * from "./track-revision"; diff --git a/src/file/track-revision/track-revision.spec.ts b/src/file/track-revision/track-revision.spec.ts index faa4d5a565..30a684fe9c 100644 --- a/src/file/track-revision/track-revision.spec.ts +++ b/src/file/track-revision/track-revision.spec.ts @@ -9,36 +9,34 @@ describe("InsertedTestRun", () => { describe("#constructor", () => { it("should create a inserted text run", () => { const textRun = new TextRun({ - text: "some text" + text: "some text", }); - const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }) + const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }); const tree = new Formatter().format(insertedTextRun); expect(tree).to.deep.equal({ "w:ins": [ { - "_attr": - { + _attr: { "w:author": "Author", - "w:date": "123", - "w:id": 0 - } + "w:date": "123", + "w:id": 0, + }, }, { "w:r": [ { "w:t": [ { - "_attr": - { - "xml:space": "preserve" - } + _attr: { + "xml:space": "preserve", + }, }, - "some text" - ] - } + "some text", + ], + }, ], - } - ] + }, + ], }); }); }); @@ -46,35 +44,32 @@ describe("InsertedTestRun", () => { describe("DeletedTestRun", () => { describe("#constructor", () => { it("should create a deleted text run", () => { - - const insertedParagraph = new DeletedTextRun({ text: 'some text', id: 0, date: "123", author: "Author" }) + const insertedParagraph = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); const tree = new Formatter().format(insertedParagraph); expect(tree).to.deep.equal({ "w:del": [ { - "_attr": - { + _attr: { "w:author": "Author", - "w:date": "123", - "w:id": 0 - } + "w:date": "123", + "w:id": 0, + }, }, { "w:r": [ { "w:delText": [ { - "_attr": - { - "xml:space": "preserve" - } + _attr: { + "xml:space": "preserve", + }, }, - "some text" - ] - } + "some text", + ], + }, ], - } - ] + }, + ], }); }); }); diff --git a/src/file/track-revision/track-revision.ts b/src/file/track-revision/track-revision.ts index 1af9e7dba3..052c7e29ea 100644 --- a/src/file/track-revision/track-revision.ts +++ b/src/file/track-revision/track-revision.ts @@ -17,11 +17,11 @@ export class TrackRevisionAttributes extends XmlAttributeComponent Date: Wed, 7 Oct 2020 08:55:47 +0000 Subject: [PATCH 028/107] build(deps-dev): bump sinon from 9.1.0 to 9.2.0 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.1.0 to 9.2.0. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/compare/v9.1.0...v9.2.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 196fc1b90f..d73f9f5d71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -498,9 +498,9 @@ } }, "@sinonjs/samsam": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.1.0.tgz", - "integrity": "sha512-42nyaQOVunX5Pm6GRJobmzbS7iLI+fhERITnETXzzwDZh+TtDr/Au3yAvXVjFmZ4wEUaE4Y3NFZfKv0bV0cbtg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.2.0.tgz", + "integrity": "sha512-CaIcyX5cDsjcW/ab7HposFWzV1kC++4HNsfnEdFJa7cP1QIuILAKV+BgfeqRXhcnSAc76r/Rh/O5C+300BwUIw==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -7303,15 +7303,15 @@ "dev": true }, "sinon": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.1.0.tgz", - "integrity": "sha512-9zQShgaeylYH6qtsnNXlTvv0FGTTckuDfHBi+qhgj5PvW2r2WslHZpgc3uy3e/ZAoPkqaOASPi+juU6EdYRYxA==", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.0.tgz", + "integrity": "sha512-eSNXz1XMcGEMHw08NJXSyTHIu6qTCOiN8x9ODACmZpNQpr0aXTBXBnI4xTzQzR+TEpOmLiKowGf9flCuKIzsbw==", "dev": true, "requires": { - "@sinonjs/commons": "^1.7.2", + "@sinonjs/commons": "^1.8.1", "@sinonjs/fake-timers": "^6.0.1", "@sinonjs/formatio": "^5.0.1", - "@sinonjs/samsam": "^5.1.0", + "@sinonjs/samsam": "^5.2.0", "diff": "^4.0.2", "nise": "^4.0.4", "supports-color": "^7.1.0" From cae6405d9a534afba21115988371c0fe05bc8204 Mon Sep 17 00:00:00 2001 From: Thomas Jansen Date: Wed, 7 Oct 2020 11:44:23 +0200 Subject: [PATCH 029/107] improved signature for deleted text runs, added demo 54 and added documentation for change tracking --- demo/54-track-revisions.ts | 132 +++++++ docs/_sidebar.md | 2 +- docs/usage/change-tracking.md | 58 +++ src/file/track-revision/index.ts | 3 +- .../deleted-page-number.spec.ts | 30 ++ .../deleted-page-number.ts | 30 ++ .../deleted-text-run.spec.ts | 371 ++++++++++++++++++ .../deleted-text-run.ts | 83 ++++ .../deleted-text.spec.ts | 15 + .../track-revision-components/deleted-text.ts | 15 + .../inserted-text-run.spec.ts | 37 ++ .../inserted-text-run.ts | 19 + .../track-revision/track-revision.spec.ts | 76 ---- src/file/track-revision/track-revision.ts | 63 +-- 14 files changed, 796 insertions(+), 138 deletions(-) create mode 100644 demo/54-track-revisions.ts create mode 100644 docs/usage/change-tracking.md create mode 100644 src/file/track-revision/track-revision-components/deleted-page-number.spec.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-page-number.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text-run.spec.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text-run.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text.spec.ts create mode 100644 src/file/track-revision/track-revision-components/deleted-text.ts create mode 100644 src/file/track-revision/track-revision-components/inserted-text-run.spec.ts create mode 100644 src/file/track-revision/track-revision-components/inserted-text-run.ts delete mode 100644 src/file/track-revision/track-revision.spec.ts diff --git a/demo/54-track-revisions.ts b/demo/54-track-revisions.ts new file mode 100644 index 0000000000..01d96082b8 --- /dev/null +++ b/demo/54-track-revisions.ts @@ -0,0 +1,132 @@ +// Track Revisions aka. "Track Changes" +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Packer, Paragraph, TextRun, ShadingType, DeletedTextRun, InsertedTextRun, Footer, PageNumber, AlignmentType, FootnoteReferenceRun } from "../build"; + +/* + For reference, see + - https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.insertedrun + - https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.deletedrun + + The method `addTrackRevisions()` adds an element `` to the `settings.xml` file. This specifies that the application shall track *new* revisions made to the existing document. + See also https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.trackrevisions + + Note that this setting enables to track *new changes* after teh file is generated, so this example will still show inserted and deleted text runs when you remove it. +*/ + +const doc = new Document({ + footnotes: [ + new Paragraph({ + children:[ + new TextRun("This is a footnote"), + new DeletedTextRun({ + text: " with some extra text which was deleted", + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + new InsertedTextRun({ + text: " and new content", + id: 1, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }) + ] + }), + ], +}); + +doc.Settings.addTrackRevisions() + +const paragraph = new Paragraph({ + children: [ + new TextRun("This is a simple demo "), + new TextRun({ + text: "on how to " + }), + new InsertedTextRun({ + text: "mark a text as an insertion ", + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }), + new DeletedTextRun({ + text: "or a deletion.", + id: 1, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }) + ], +}); + +doc.addSection({ + properties: {}, + children: [ + paragraph, + new Paragraph({ + children: [ + new TextRun("This is a demo "), + new DeletedTextRun({ + text: "in order", + color: "red", + bold: true, + size: 24, + font: { + name: "Garamond", + }, + shading: { + type: ShadingType.REVERSE_DIAGONAL_STRIPE, + color: "00FFFF", + fill: "FF0000", + }, + id: 2, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }).break(), + new InsertedTextRun({ + text: "to show how to ", + bold: false, + id: 3, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + new TextRun({ + bold: true, + children: [ "\tuse Inserted and Deleted TextRuns.", new FootnoteReferenceRun(1) ], + }), + ], + }), + ], + footers: { + default: new Footer({ + children: [ + new Paragraph({ + alignment: AlignmentType.CENTER, + children: [ + new TextRun("Awesome LLC"), + new TextRun({ + children: ["Page Number: ", PageNumber.CURRENT], + }), + new DeletedTextRun({ + children: [" to ", PageNumber.TOTAL_PAGES], + id: 4, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + new InsertedTextRun({ + children: [" from ", PageNumber.TOTAL_PAGES], + bold: true, + id: 5, + author: "Firstname Lastname", + date: "2020-10-06T09:05:00Z", + }), + ], + }), + ], + }), + }, +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/docs/_sidebar.md b/docs/_sidebar.md index a63970dff9..5d2ba31551 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -20,6 +20,7 @@ * [Tab Stops](usage/tab-stops.md) * [Table of Contents](usage/table-of-contents.md) * [Page Numbers](usage/page-numbers.md) + * [Change Tracking](usage/change-tracking.md) * Styling * [Styling with JS](usage/styling-with-js.md) * [Styling with XML](usage/styling-with-xml.md) @@ -28,4 +29,3 @@ * [Packers](usage/packers.md) * [Contribution Guidelines](contribution-guidelines.md) - diff --git a/docs/usage/change-tracking.md b/docs/usage/change-tracking.md new file mode 100644 index 0000000000..6f81e4d0d7 --- /dev/null +++ b/docs/usage/change-tracking.md @@ -0,0 +1,58 @@ +# Change Tracking + +> Instead of adding a `TextRun` into a `Paragraph`, you can also add an `InsertedTextRun` or `DeletedTextRun` where you need to supply an `id`, `author` and `date` for the change. + +```ts +import { Paragraph, TextRun, InsertedTextRun, DeletedTextRun } from "docx"; + +const paragraph = new Paragraph({ + children: [ + new TextRun("This is a simple demo "), + new TextRun({ + text: "on how to " + }), + new InsertedTextRun({ + text: "mark a text as an insertion ", + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }), + new DeletedTextRun({ + text: "or a deletion.", + id: 1, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }) + ], +}); +``` + +Note that for a `InsertedTextRun` and `DeletedTextRun`, it is not possible to simply call it with only a text as in `new TextRun("some text")`, since the additonal fields for change tracking need to be provided. Similar to a normal `TextRun` you can add additional text properties. + +```ts +import { Paragraph, TextRun, InsertedTextRun, DeletedTextRun } from "docx"; + +const paragraph = new Paragraph({ + children: [ + new TextRun("This is a simple demo"), + new DeletedTextRun({ + text: "with a deletion.", + color: "red", + bold: true, + size: 24, + id: 0, + author: "Firstname Lastname", + date: "2020-10-06T09:00:00Z", + }) + ], +}); +``` + +In addtion to marking text as inserted or deleted, change tracking can also be added via the document settings. This will enable new changes to be tracked as well. + +```ts +import { Document } from "docx"; + +const doc = new Document({}); +doc.Settings.addTrackRevisions() +``` \ No newline at end of file diff --git a/src/file/track-revision/index.ts b/src/file/track-revision/index.ts index 20bb87a229..eb2465d8fe 100644 --- a/src/file/track-revision/index.ts +++ b/src/file/track-revision/index.ts @@ -1 +1,2 @@ -export * from "./track-revision"; +export * from "./track-revision-components/inserted-text-run"; +export * from "./track-revision-components/deleted-text-run"; diff --git a/src/file/track-revision/track-revision-components/deleted-page-number.spec.ts b/src/file/track-revision/track-revision-components/deleted-page-number.spec.ts new file mode 100644 index 0000000000..5e0238da96 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-page-number.spec.ts @@ -0,0 +1,30 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { DeletedNumberOfPages, DeletedNumberOfPagesSection, DeletedPage } from "./deleted-page-number"; + +describe("Deleted Page", () => { + describe("#constructor()", () => { + it("uses the font name for both ascii and hAnsi", () => { + const tree = new Formatter().format(new DeletedPage()); + expect(tree).to.deep.equal({ "w:delInstrText": [{ _attr: { "xml:space": "preserve" } }, "PAGE"] }); + }); + }); +}); + +describe("Delted NumberOfPages", () => { + describe("#constructor()", () => { + it("uses the font name for both ascii and hAnsi", () => { + const tree = new Formatter().format(new DeletedNumberOfPages()); + expect(tree).to.deep.equal({ "w:delInstrText": [{ _attr: { "xml:space": "preserve" } }, "NUMPAGES"] }); + }); + }); +}); + +describe("Deleted NumberOfPagesSection", () => { + describe("#constructor()", () => { + it("uses the font name for both ascii and hAnsi", () => { + const tree = new Formatter().format(new DeletedNumberOfPagesSection()); + expect(tree).to.deep.equal({ "w:delInstrText": [{ _attr: { "xml:space": "preserve" } }, "SECTIONPAGES"] }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/deleted-page-number.ts b/src/file/track-revision/track-revision-components/deleted-page-number.ts new file mode 100644 index 0000000000..6ce6266f13 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-page-number.ts @@ -0,0 +1,30 @@ +import { SpaceType } from "file/space-type"; +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { + protected readonly xmlKeys = { space: "xml:space" }; +} + +export class DeletedPage extends XmlComponent { + constructor() { + super("w:delInstrText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push("PAGE"); + } +} + +export class DeletedNumberOfPages extends XmlComponent { + constructor() { + super("w:delInstrText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push("NUMPAGES"); + } +} + +export class DeletedNumberOfPagesSection extends XmlComponent { + constructor() { + super("w:delInstrText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + this.root.push("SECTIONPAGES"); + } +} diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts b/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts new file mode 100644 index 0000000000..7931e50406 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts @@ -0,0 +1,371 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { DeletedTextRun } from "./deleted-text-run"; +import { FootnoteReferenceRun, PageNumber } from "../../index"; + +describe("DeletedTextRun", () => { + describe("#constructor", () => { + it("should create a deleted text run", () => { + const deletedTextRun = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); + + describe("#constructor with formatting", () => { + it("should create a deleted text run", () => { + const deletedTextRun = new DeletedTextRun({ text: "some text", bold: true, id: 0, date: "123", author: "Author" }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:rPr": [ + { + "w:b": { + _attr: { + "w:val": true, + }, + }, + }, + { + "w:bCs": { + _attr: { + "w:val": true, + }, + }, + }, + ], + }, + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); + + describe("#break()", () => { + it("should add a break", () => { + const deletedTextRun = new DeletedTextRun({ + children: ["some text"], + id: 0, + date: "123", + author: "Author", + }).break(); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:br": {}, + }, + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); + + describe("page numbering", () => { + it("should be able to delete the total pages", () => { + const deletedTextRun = new DeletedTextRun({ + children: [" to ", PageNumber.TOTAL_PAGES], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + " to ", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "begin", + }, + }, + }, + { + "w:delInstrText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "NUMPAGES", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "separate", + }, + }, + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "end", + }, + }, + }, + ], + }, + ], + }); + }); + + it("should be able to delete the total pages in section", () => { + const deletedTextRun = new DeletedTextRun({ + children: [" to ", PageNumber.TOTAL_PAGES_IN_SECTION], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + " to ", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "begin", + }, + }, + }, + { + "w:delInstrText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "SECTIONPAGES", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "separate", + }, + }, + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "end", + }, + }, + }, + ], + }, + ], + }); + }); + + it("should be able to delete the current page", () => { + const deletedTextRun = new DeletedTextRun({ + children: [" to ", PageNumber.CURRENT], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + " to ", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "begin", + }, + }, + }, + { + "w:delInstrText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "PAGE", + ], + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "separate", + }, + }, + }, + { + "w:fldChar": { + _attr: { + "w:fldCharType": "end", + }, + }, + }, + ], + }, + ], + }); + }); + }); + + describe("footnote references", () => { + it("should add a valid footnote reference", () => { + const deletedTextRun = new DeletedTextRun({ + children: ["some text", new FootnoteReferenceRun(1)], + id: 0, + date: "123", + author: "Author", + }); + const tree = new Formatter().format(deletedTextRun); + expect(tree).to.deep.equal({ + "w:del": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:delText": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + { + "w:r": [ + { "w:rPr": [{ "w:rStyle": { _attr: { "w:val": "FootnoteReference" } } }] }, + { "w:footnoteReference": { _attr: { "w:id": 1 } } }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.ts b/src/file/track-revision/track-revision-components/deleted-text-run.ts new file mode 100644 index 0000000000..2342f70104 --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text-run.ts @@ -0,0 +1,83 @@ +import { IChangedAttributesProperties, ChangeAttributes } from "../track-revision"; +import { XmlComponent } from "file/xml-components"; +import { IRunOptions, RunProperties, IRunPropertiesOptions, FootnoteReferenceRun } from "../../index"; + +import { Break } from "../../paragraph/run/break"; +import { Begin, Separate, End } from "../../paragraph/run/field"; +import { PageNumber } from "../../paragraph/run/run"; + +import { DeletedPage, DeletedNumberOfPages, DeletedNumberOfPagesSection } from "./deleted-page-number"; +import { DeletedText } from "./deleted-text"; + +interface IDeletedRunOptions extends IRunPropertiesOptions, IChangedAttributesProperties { + readonly children?: (Begin | Separate | End | PageNumber | FootnoteReferenceRun | string)[]; + readonly text?: string; +} + +export class DeletedTextRun extends XmlComponent { + protected readonly deletedTextRunWrapper: DeletedTextRunWrapper; + + constructor(options: IDeletedRunOptions) { + super("w:del"); + this.root.push( + new ChangeAttributes({ + id: options.id, + author: options.author, + date: options.date, + }), + ); + this.deletedTextRunWrapper = new DeletedTextRunWrapper(options as IRunOptions); + this.addChildElement(this.deletedTextRunWrapper); + } + + public break(): DeletedTextRun { + this.deletedTextRunWrapper.break(); + return this; + } +} + +class DeletedTextRunWrapper extends XmlComponent { + constructor(options: IRunOptions) { + super("w:r"); + this.root.push(new RunProperties(options)); + + if (options.children) { + for (const child of options.children) { + if (typeof child === "string") { + switch (child) { + case PageNumber.CURRENT: + this.root.push(new Begin()); + this.root.push(new DeletedPage()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + case PageNumber.TOTAL_PAGES: + this.root.push(new Begin()); + this.root.push(new DeletedNumberOfPages()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + case PageNumber.TOTAL_PAGES_IN_SECTION: + this.root.push(new Begin()); + this.root.push(new DeletedNumberOfPagesSection()); + this.root.push(new Separate()); + this.root.push(new End()); + break; + default: + this.root.push(new DeletedText(child)); + break; + } + continue; + } + + this.root.push(child); + } + } else if (options.text) { + this.root.push(new DeletedText(options.text)); + } + } + + public break(): void { + this.root.splice(1, 0, new Break()); + } +} diff --git a/src/file/track-revision/track-revision-components/deleted-text.spec.ts b/src/file/track-revision/track-revision-components/deleted-text.spec.ts new file mode 100644 index 0000000000..d9c8de46bf --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text.spec.ts @@ -0,0 +1,15 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { DeletedText } from "./deleted-text"; + +describe("Deleted Text", () => { + describe("#constructor", () => { + it("adds the passed in text to the component", () => { + const t = new DeletedText(" this is\n text"); + const f = new Formatter().format(t); + expect(f).to.deep.equal({ + "w:delText": [{ _attr: { "xml:space": "preserve" } }, " this is\n text"], + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/deleted-text.ts b/src/file/track-revision/track-revision-components/deleted-text.ts new file mode 100644 index 0000000000..408b47304d --- /dev/null +++ b/src/file/track-revision/track-revision-components/deleted-text.ts @@ -0,0 +1,15 @@ +import { SpaceType } from "file/space-type"; +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { + protected readonly xmlKeys = { space: "xml:space" }; +} + +export class DeletedText extends XmlComponent { + constructor(text: string) { + super("w:delText"); + this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); + + this.root.push(text); + } +} diff --git a/src/file/track-revision/track-revision-components/inserted-text-run.spec.ts b/src/file/track-revision/track-revision-components/inserted-text-run.spec.ts new file mode 100644 index 0000000000..c23069fbba --- /dev/null +++ b/src/file/track-revision/track-revision-components/inserted-text-run.spec.ts @@ -0,0 +1,37 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; +import { InsertedTextRun } from "./inserted-text-run"; + +describe("InsertedTextRun", () => { + describe("#constructor", () => { + it("should create a inserted text run", () => { + const insertedTextRun = new InsertedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); + const tree = new Formatter().format(insertedTextRun); + expect(tree).to.deep.equal({ + "w:ins": [ + { + _attr: { + "w:author": "Author", + "w:date": "123", + "w:id": 0, + }, + }, + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "some text", + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/track-revision/track-revision-components/inserted-text-run.ts b/src/file/track-revision/track-revision-components/inserted-text-run.ts new file mode 100644 index 0000000000..49bd7f53ae --- /dev/null +++ b/src/file/track-revision/track-revision-components/inserted-text-run.ts @@ -0,0 +1,19 @@ +import { IChangedAttributesProperties, ChangeAttributes } from "../track-revision"; +import { XmlComponent } from "file/xml-components"; +import { TextRun, IRunOptions } from "../../index"; + +interface IInsertedRunOptions extends IChangedAttributesProperties, IRunOptions {} + +export class InsertedTextRun extends XmlComponent { + constructor(options: IInsertedRunOptions) { + super("w:ins"); + this.root.push( + new ChangeAttributes({ + id: options.id, + author: options.author, + date: options.date, + }), + ); + this.addChildElement(new TextRun(options as IRunOptions)); + } +} diff --git a/src/file/track-revision/track-revision.spec.ts b/src/file/track-revision/track-revision.spec.ts deleted file mode 100644 index 30a684fe9c..0000000000 --- a/src/file/track-revision/track-revision.spec.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { expect } from "chai"; - -import { Formatter } from "export/formatter"; - -import { InsertedTextRun, DeletedTextRun } from "./track-revision"; -import { TextRun } from "../paragraph"; - -describe("InsertedTestRun", () => { - describe("#constructor", () => { - it("should create a inserted text run", () => { - const textRun = new TextRun({ - text: "some text", - }); - const insertedTextRun = new InsertedTextRun({ child: textRun, id: 0, date: "123", author: "Author" }); - const tree = new Formatter().format(insertedTextRun); - expect(tree).to.deep.equal({ - "w:ins": [ - { - _attr: { - "w:author": "Author", - "w:date": "123", - "w:id": 0, - }, - }, - { - "w:r": [ - { - "w:t": [ - { - _attr: { - "xml:space": "preserve", - }, - }, - "some text", - ], - }, - ], - }, - ], - }); - }); - }); -}); -describe("DeletedTestRun", () => { - describe("#constructor", () => { - it("should create a deleted text run", () => { - const insertedParagraph = new DeletedTextRun({ text: "some text", id: 0, date: "123", author: "Author" }); - const tree = new Formatter().format(insertedParagraph); - expect(tree).to.deep.equal({ - "w:del": [ - { - _attr: { - "w:author": "Author", - "w:date": "123", - "w:id": 0, - }, - }, - { - "w:r": [ - { - "w:delText": [ - { - _attr: { - "xml:space": "preserve", - }, - }, - "some text", - ], - }, - ], - }, - ], - }); - }); - }); -}); diff --git a/src/file/track-revision/track-revision.ts b/src/file/track-revision/track-revision.ts index 052c7e29ea..4318e9a468 100644 --- a/src/file/track-revision/track-revision.ts +++ b/src/file/track-revision/track-revision.ts @@ -1,72 +1,15 @@ -import { SpaceType } from "file/space-type"; -import { XmlComponent, XmlAttributeComponent } from "file/xml-components"; -import { TextRun } from "../index"; +import { XmlAttributeComponent } from "file/xml-components"; -export interface ITrackRevisionAttributesProperties { +export interface IChangedAttributesProperties { readonly id: number; readonly author: string; readonly date: string; } -export class TrackRevisionAttributes extends XmlAttributeComponent { +export class ChangeAttributes extends XmlAttributeComponent { protected readonly xmlKeys = { id: "w:id", author: "w:author", date: "w:date", }; } - -export interface IInsertedTextRunOptions extends ITrackRevisionAttributesProperties { - readonly child: TextRun; -} - -export interface IDeletedTextRunOptions extends ITrackRevisionAttributesProperties { - readonly text: string; -} - -export class InsertedTextRun extends XmlComponent { - constructor(options: IInsertedTextRunOptions) { - super("w:ins"); - this.root.push( - new TrackRevisionAttributes({ - id: options.id, - author: options.author, - date: options.date, - }), - ); - this.addChildElement(options.child); - } -} - -export class DeletedTextRunWrapper extends XmlComponent { - constructor(text: string) { - super("w:r"); - this.root.push(new DeletedText(text)); - } -} - -class TextAttributes extends XmlAttributeComponent<{ readonly space: SpaceType }> { - protected readonly xmlKeys = { space: "xml:space" }; -} - -export class DeletedText extends XmlComponent { - constructor(text: string) { - super("w:delText"); - this.root.push(new TextAttributes({ space: SpaceType.PRESERVE })); - this.root.push(text); - } -} - -export class DeletedTextRun extends XmlComponent { - constructor(options: IDeletedTextRunOptions) { - super("w:del"); - this.root.push( - new TrackRevisionAttributes({ - id: options.id, - author: options.author, - date: options.date, - }), - ); - this.addChildElement(new DeletedTextRunWrapper(options.text)); - } -} From 700a74fd4ca689d39b6fd8d10c2aaa187c481d71 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Oct 2020 13:41:26 +0100 Subject: [PATCH 030/107] More math components --- demo/47-math.ts | 44 --- demo/55-math.ts | 259 ++++++++++++++++++ package-lock.json | 37 +-- package.json | 2 +- src/file/drawing/inline/inline.ts | 2 +- src/file/paragraph/math/brackets/index.ts | 4 + .../brackets/math-angled-brackets.spec.ts | 51 ++++ .../math/brackets/math-angled-brackets.ts | 20 ++ .../brackets/math-beginning-character.spec.ts | 22 ++ .../math/brackets/math-beginning-character.ts | 14 + .../brackets/math-bracket-properties.spec.ts | 45 +++ .../math/brackets/math-bracket-properties.ts | 16 ++ .../math/brackets/math-curly-brackets.spec.ts | 51 ++++ .../math/brackets/math-curly-brackets.ts | 20 ++ .../math/brackets/math-ending-char.ts | 14 + .../brackets/math-ending-character.spec.ts | 22 ++ .../math/brackets/math-round-brackets.spec.ts | 36 +++ .../math/brackets/math-round-brackets.ts | 15 + .../brackets/math-square-brackets.spec.ts | 51 ++++ .../math/brackets/math-square-brackets.ts | 20 ++ .../math/fraction/math-denominator.ts | 2 +- .../paragraph/math/fraction/math-fraction.ts | 2 +- .../paragraph/math/fraction/math-numerator.ts | 2 +- src/file/paragraph/math/function/index.ts | 3 + .../math/function/math-function-name.spec.ts | 27 ++ .../math/function/math-function-name.ts | 11 + .../function/math-function-properties.spec.ts | 18 ++ .../math/function/math-function-properties.ts | 8 + .../math/function/math-function.spec.ts | 48 ++++ .../paragraph/math/function/math-function.ts | 22 ++ src/file/paragraph/math/index.ts | 5 + src/file/paragraph/math/math-component.ts | 21 ++ src/file/paragraph/math/math-run.ts | 2 +- src/file/paragraph/math/math-text.ts | 2 +- src/file/paragraph/math/math.ts | 8 +- .../math/n-ary/math-accent-character.ts | 2 +- src/file/paragraph/math/n-ary/math-base.ts | 4 +- .../math/n-ary/math-naray-properties.spec.ts | 102 ++++++- .../math/n-ary/math-naray-properties.ts | 12 +- .../math/n-ary/math-sub-script-hide.spec.ts | 22 ++ .../math/n-ary/math-sub-script-hide.ts | 14 + .../math/n-ary/math-sub-script.spec.ts | 10 +- .../paragraph/math/n-ary/math-sub-script.ts | 10 +- .../paragraph/math/n-ary/math-sum.spec.ts | 4 +- src/file/paragraph/math/n-ary/math-sum.ts | 27 +- .../math/n-ary/math-super-script-hide.spec.ts | 22 ++ .../math/n-ary/math-super-script-hide.ts | 14 + .../math/n-ary/math-super-script.spec.ts | 10 +- .../paragraph/math/n-ary/math-super-script.ts | 10 +- src/file/paragraph/math/radical/index.ts | 3 + .../math/radical/math-degree-hide.spec.ts | 22 ++ .../math/radical/math-degree-hide.ts | 14 + .../math/radical/math-degree.spec.ts | 36 +++ .../paragraph/math/radical/math-degree.ts | 13 + .../radical/math-radical-properties.spec.ts | 35 +++ .../math/radical/math-radical-properties.ts | 13 + .../math/radical/math-radical.spec.ts | 48 ++++ .../paragraph/math/radical/math-radical.ts | 22 ++ src/file/paragraph/math/script/index.ts | 4 + .../math/script/pre-sub-super-script/index.ts | 2 + ...b-super-script-function-properties.spec.ts | 17 ++ ...re-sub-super-script-function-properties.ts | 8 + ...math-pre-sub-super-script-function.spec.ts | 60 ++++ .../math-pre-sub-super-script-function.ts | 23 ++ .../paragraph/math/script/sub-script/index.ts | 2 + ...ath-sub-script-function-properties.spec.ts | 17 ++ .../math-sub-script-function-properties.ts | 8 + .../math-sub-script-function.spec.ts | 48 ++++ .../sub-script/math-sub-script-function.ts | 21 ++ .../math/script/sub-super-script/index.ts | 2 + ...b-super-script-function-properties.spec.ts | 17 ++ ...th-sub-super-script-function-properties.ts | 8 + .../math-sub-super-script-function.spec.ts | 60 ++++ .../math-sub-super-script-function.ts | 23 ++ .../math/script/super-script/index.ts | 2 + ...h-super-script-function-properties.spec.ts | 17 ++ .../math-super-script-function-properties.ts | 8 + .../math-super-script-function.spec.ts | 48 ++++ .../math-super-script-function.ts | 21 ++ src/file/paragraph/paragraph.ts | 4 +- src/file/settings/settings.ts | 6 +- .../deleted-text-run.spec.ts | 2 +- .../deleted-text-run.ts | 9 +- .../inserted-text-run.ts | 5 +- tslint.json | 2 + 85 files changed, 1716 insertions(+), 123 deletions(-) delete mode 100644 demo/47-math.ts create mode 100644 demo/55-math.ts create mode 100644 src/file/paragraph/math/brackets/index.ts create mode 100644 src/file/paragraph/math/brackets/math-angled-brackets.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-angled-brackets.ts create mode 100644 src/file/paragraph/math/brackets/math-beginning-character.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-beginning-character.ts create mode 100644 src/file/paragraph/math/brackets/math-bracket-properties.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-bracket-properties.ts create mode 100644 src/file/paragraph/math/brackets/math-curly-brackets.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-curly-brackets.ts create mode 100644 src/file/paragraph/math/brackets/math-ending-char.ts create mode 100644 src/file/paragraph/math/brackets/math-ending-character.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-round-brackets.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-round-brackets.ts create mode 100644 src/file/paragraph/math/brackets/math-square-brackets.spec.ts create mode 100644 src/file/paragraph/math/brackets/math-square-brackets.ts create mode 100644 src/file/paragraph/math/function/index.ts create mode 100644 src/file/paragraph/math/function/math-function-name.spec.ts create mode 100644 src/file/paragraph/math/function/math-function-name.ts create mode 100644 src/file/paragraph/math/function/math-function-properties.spec.ts create mode 100644 src/file/paragraph/math/function/math-function-properties.ts create mode 100644 src/file/paragraph/math/function/math-function.spec.ts create mode 100644 src/file/paragraph/math/function/math-function.ts create mode 100644 src/file/paragraph/math/math-component.ts create mode 100644 src/file/paragraph/math/n-ary/math-sub-script-hide.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-sub-script-hide.ts create mode 100644 src/file/paragraph/math/n-ary/math-super-script-hide.spec.ts create mode 100644 src/file/paragraph/math/n-ary/math-super-script-hide.ts create mode 100644 src/file/paragraph/math/radical/index.ts create mode 100644 src/file/paragraph/math/radical/math-degree-hide.spec.ts create mode 100644 src/file/paragraph/math/radical/math-degree-hide.ts create mode 100644 src/file/paragraph/math/radical/math-degree.spec.ts create mode 100644 src/file/paragraph/math/radical/math-degree.ts create mode 100644 src/file/paragraph/math/radical/math-radical-properties.spec.ts create mode 100644 src/file/paragraph/math/radical/math-radical-properties.ts create mode 100644 src/file/paragraph/math/radical/math-radical.spec.ts create mode 100644 src/file/paragraph/math/radical/math-radical.ts create mode 100644 src/file/paragraph/math/script/index.ts create mode 100644 src/file/paragraph/math/script/pre-sub-super-script/index.ts create mode 100644 src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.spec.ts create mode 100644 src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.ts create mode 100644 src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts create mode 100644 src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts create mode 100644 src/file/paragraph/math/script/sub-script/index.ts create mode 100644 src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.spec.ts create mode 100644 src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.ts create mode 100644 src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts create mode 100644 src/file/paragraph/math/script/sub-script/math-sub-script-function.ts create mode 100644 src/file/paragraph/math/script/sub-super-script/index.ts create mode 100644 src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.spec.ts create mode 100644 src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.ts create mode 100644 src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts create mode 100644 src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts create mode 100644 src/file/paragraph/math/script/super-script/index.ts create mode 100644 src/file/paragraph/math/script/super-script/math-super-script-function-properties.spec.ts create mode 100644 src/file/paragraph/math/script/super-script/math-super-script-function-properties.ts create mode 100644 src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts create mode 100644 src/file/paragraph/math/script/super-script/math-super-script-function.ts diff --git a/demo/47-math.ts b/demo/47-math.ts deleted file mode 100644 index 5cad1707de..0000000000 --- a/demo/47-math.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Simple example to add text to a document -// Import from 'docx' rather than '../build' if you install from npm -import * as fs from "fs"; -import { Document, Math, MathDenominator, MathFraction, MathNumerator, MathRun, MathSum, Packer, Paragraph, TextRun } from "../build"; - -const doc = new Document(); - -doc.addSection({ - properties: {}, - children: [ - new Paragraph({ - children: [ - new Math({ - children: [ - new MathRun("2+2"), - new MathFraction({ - numerator: new MathNumerator("hi"), - denominator: new MathDenominator("2"), - }), - ], - }), - new TextRun({ - text: "Foo Bar", - bold: true, - }), - ], - }), - new Paragraph({ - children: [ - new Math({ - children: [ - new MathSum({ - child: new MathRun("test"), - }), - ], - }), - ], - }), - ], -}); - -Packer.toBuffer(doc).then((buffer) => { - fs.writeFileSync("My Document.docx", buffer); -}); diff --git a/demo/55-math.ts b/demo/55-math.ts new file mode 100644 index 0000000000..92993a695a --- /dev/null +++ b/demo/55-math.ts @@ -0,0 +1,259 @@ +// Simple example to add text to a document +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { + Document, + Math, + MathAngledBrackets, + MathCurlyBrackets, + MathDenominator, + MathFraction, + MathFunction, + MathNumerator, + MathPreSubSuperScript, + MathRadical, + MathRoundBrackets, + MathRun, + MathSquareBrackets, + MathSubScript, + MathSubSuperScript, + MathSum, + MathSuperScript, + Packer, + Paragraph, + TextRun, +} from "../build"; + +const doc = new Document(); + +doc.addSection({ + properties: {}, + children: [ + new Paragraph({ + children: [ + new Math({ + children: [ + new MathRun("2+2"), + new MathFraction({ + numerator: new MathNumerator("hi"), + denominator: new MathDenominator("2"), + }), + ], + }), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSum({ + child: new MathRun("test"), + }), + new MathSum({ + child: new MathSuperScript({ + child: new MathRun("e"), + superScript: new MathRun("2"), + }), + subScript: new MathRun("i"), + }), + new MathSum({ + child: new MathRadical({ + child: new MathRun("i"), + }), + subScript: new MathRun("i"), + superScript: new MathRun("10"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSuperScript({ + child: new MathRun("test"), + superScript: new MathRun("hello"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSubScript({ + child: new MathRun("test"), + subScript: new MathRun("hello"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSubScript({ + child: new MathRun("x"), + subScript: new MathSuperScript({ + child: new MathRun("y"), + superScript: new MathRun("2"), + }), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSubSuperScript({ + child: new MathRun("test"), + superScript: new MathRun("hello"), + subScript: new MathRun("world"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathPreSubSuperScript({ + child: new MathRun("test"), + superScript: new MathRun("hello"), + subScript: new MathRun("world"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSubScript({ + child: new MathFraction({ + numerator: new MathNumerator("1"), + denominator: new MathDenominator("2"), + }), + subScript: new MathRun("4"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSubScript({ + child: new MathRadical({ + child: new MathFraction({ + numerator: new MathNumerator("1"), + denominator: new MathDenominator("2"), + }), + degree: new MathRun("4"), + }), + subScript: new MathRun("x"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathRadical({ + child: new MathRun("4"), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathFunction({ + name: new MathSuperScript({ + child: new MathRun("cos"), + superScript: new MathRun("-1"), + }), + child: new MathRun("100"), + }), + new MathRun("×"), + new MathFunction({ + name: new MathRun("sin"), + child: new MathRun("360"), + }), + new MathRun("= x"), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathRoundBrackets({ + child: new MathFraction({ + numerator: new MathNumerator("1"), + denominator: new MathDenominator("2"), + }), + }), + new MathSquareBrackets({ + child: new MathFraction({ + numerator: new MathNumerator("1"), + denominator: new MathDenominator("2"), + }), + }), + new MathCurlyBrackets({ + child: new MathFraction({ + numerator: new MathNumerator("1"), + denominator: new MathDenominator("2"), + }), + }), + new MathAngledBrackets({ + child: new MathFraction({ + numerator: new MathNumerator("1"), + denominator: new MathDenominator("2"), + }), + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathFraction({ + numerator: new Math({ + children: [ + new MathRadical({ + child: new MathRun("4"), + }), + ], + }), + demoninator: new MathRun("2a"), + }), + ], + }), + ], + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/package-lock.json b/package-lock.json index d73f9f5d71..7d28a68d7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1088,7 +1088,7 @@ }, "awesome-typescript-loader": { "version": "3.5.0", - "resolved": "http://registry.npmjs.org/awesome-typescript-loader/-/awesome-typescript-loader-3.5.0.tgz", + "resolved": "https://registry.npmjs.org/awesome-typescript-loader/-/awesome-typescript-loader-3.5.0.tgz", "integrity": "sha512-qzgm9SEvodVkSi9QY7Me1/rujg+YBNMjayNSAyzNghwTEez++gXoPCwMvpbHRG7wrOkDCiF6dquvv9ESmUBAuw==", "dev": true, "requires": { @@ -1665,7 +1665,7 @@ }, "chai": { "version": "3.5.0", - "resolved": "http://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", "dev": true, "requires": { @@ -2153,7 +2153,7 @@ }, "deep-eql": { "version": "0.1.3", - "resolved": "http://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", "dev": true, "requires": { @@ -4373,7 +4373,7 @@ "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=", "dev": true }, "is-ci": { @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5098,7 +5098,7 @@ }, "load-json-file": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, "requires": { @@ -5395,7 +5395,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -5585,7 +5585,7 @@ }, "ncp": { "version": "1.0.1", - "resolved": "http://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-1.0.1.tgz", "integrity": "sha1-0VNn5cuHQyuhF9K/gP30Wuz7QkY=", "dev": true }, @@ -5603,7 +5603,7 @@ }, "next-tick": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, @@ -7116,7 +7116,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -7719,7 +7719,7 @@ }, "strip-eof": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, @@ -7996,10 +7996,13 @@ } }, "tslint-immutable": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/tslint-immutable/-/tslint-immutable-4.9.1.tgz", - "integrity": "sha512-iIFCq08H4YyNIX0bV5N6fGQtAmjc4OQZKQCgBP5WHgQaITyGAHPVmAw+Yf7qe0zbRCvCDZdrdEC/191fLGFiww==", - "dev": true + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/tslint-immutable/-/tslint-immutable-6.0.1.tgz", + "integrity": "sha512-3GQ6HffN64gLmT/N1YzyVMqyf6uBjMvhNaevK8B0K01/QC0OU5AQZrH4TjMHo1IdG3JpqsZvuRy9IW1LA3zjwA==", + "dev": true, + "requires": { + "tsutils": "^2.28.0 || ^3.0.0" + } }, "tsutils": { "version": "2.29.0", @@ -8654,7 +8657,7 @@ }, "load-json-file": { "version": "2.0.0", - "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true, "requires": { @@ -8855,7 +8858,7 @@ }, "winston": { "version": "2.1.1", - "resolved": "http://registry.npmjs.org/winston/-/winston-2.1.1.tgz", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz", "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=", "dev": true, "requires": { diff --git a/package.json b/package.json index 51e1b246c3..f9a27f0fcb 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "sinon": "^9.0.2", "ts-node": "^9.0.0", "tslint": "^6.1.3", - "tslint-immutable": "^4.9.0", + "tslint-immutable": "^6.0.1", "typedoc": "^0.16.11", "typescript": "2.9.2", "webpack": "^3.10.0" diff --git a/src/file/drawing/inline/inline.ts b/src/file/drawing/inline/inline.ts index 7c40e7c3b3..bf83e36764 100644 --- a/src/file/drawing/inline/inline.ts +++ b/src/file/drawing/inline/inline.ts @@ -12,7 +12,7 @@ export class Inline extends XmlComponent { private readonly extent: Extent; private readonly graphic: Graphic; - constructor(readonly mediaData: IMediaData, private readonly dimensions: IMediaDataDimensions) { + constructor(mediaData: IMediaData, private readonly dimensions: IMediaDataDimensions) { super("wp:inline"); this.root.push( diff --git a/src/file/paragraph/math/brackets/index.ts b/src/file/paragraph/math/brackets/index.ts new file mode 100644 index 0000000000..e6559cde29 --- /dev/null +++ b/src/file/paragraph/math/brackets/index.ts @@ -0,0 +1,4 @@ +export * from "./math-round-brackets"; +export * from "./math-square-brackets"; +export * from "./math-curly-brackets"; +export * from "./math-angled-brackets"; diff --git a/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts b/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts new file mode 100644 index 0000000000..735e0da272 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts @@ -0,0 +1,51 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathAngledBrackets } from "./math-angled-brackets"; + +describe("MathAngledBrackets", () => { + describe("#constructor()", () => { + it("should create a MathAngledBrackets with correct root key", () => { + const mathAngledBrackets = new MathAngledBrackets({ + child: new MathRun("60"), + }); + + const tree = new Formatter().format(mathAngledBrackets); + expect(tree).to.deep.equal({ + "m:d": [ + { + "m:dPr": [ + { + "m:begChr": { + _attr: { + "m:val": "〈", + }, + }, + }, + { + "m:endChr": { + _attr: { + "m:val": "〉", + }, + }, + }, + ], + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["60"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-angled-brackets.ts b/src/file/paragraph/math/brackets/math-angled-brackets.ts new file mode 100644 index 0000000000..fbafb7e738 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-angled-brackets.ts @@ -0,0 +1,20 @@ +// http://www.datypic.com/sc/ooxml/e-m_d-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../math-component"; +import { MathBase } from "../n-ary"; +import { MathBracketProperties } from "./math-bracket-properties"; + +export class MathAngledBrackets extends XmlComponent { + constructor(options: { readonly child: MathComponent }) { + super("m:d"); + + this.root.push( + new MathBracketProperties({ + beginningCharacter: "〈", + endingCharacter: "〉", + }), + ); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/brackets/math-beginning-character.spec.ts b/src/file/paragraph/math/brackets/math-beginning-character.spec.ts new file mode 100644 index 0000000000..bf9196c0a9 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-beginning-character.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathBeginningCharacter } from "./math-beginning-character"; + +describe("MathBeginningCharacter", () => { + describe("#constructor()", () => { + it("should create a MathBeginningCharacter with correct root key", () => { + const mathBeginningCharacter = new MathBeginningCharacter("["); + + const tree = new Formatter().format(mathBeginningCharacter); + expect(tree).to.deep.equal({ + "m:begChr": { + _attr: { + "m:val": "[", + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-beginning-character.ts b/src/file/paragraph/math/brackets/math-beginning-character.ts new file mode 100644 index 0000000000..aa9e06d87a --- /dev/null +++ b/src/file/paragraph/math/brackets/math-beginning-character.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_begChr-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathBeginningCharacterAttributes extends XmlAttributeComponent<{ readonly character: string }> { + protected readonly xmlKeys = { character: "m:val" }; +} + +export class MathBeginningCharacter extends XmlComponent { + constructor(character: string) { + super("m:begChr"); + + this.root.push(new MathBeginningCharacterAttributes({ character })); + } +} diff --git a/src/file/paragraph/math/brackets/math-bracket-properties.spec.ts b/src/file/paragraph/math/brackets/math-bracket-properties.spec.ts new file mode 100644 index 0000000000..d80976d8f6 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-bracket-properties.spec.ts @@ -0,0 +1,45 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathBracketProperties } from "./math-bracket-properties"; + +describe("MathBracketProperties", () => { + describe("#constructor()", () => { + it("should create a MathBracketProperties with correct root key", () => { + const mathBracketProperties = new MathBracketProperties(); + + const tree = new Formatter().format(mathBracketProperties); + expect(tree).to.deep.equal({ + "m:dPr": {}, + }); + }); + + it("should create a MathBracketProperties with correct root key and add brackets", () => { + const mathBracketProperties = new MathBracketProperties({ + beginningCharacter: "[", + endingCharacter: "]", + }); + + const tree = new Formatter().format(mathBracketProperties); + expect(tree).to.deep.equal({ + "m:dPr": [ + { + "m:begChr": { + _attr: { + "m:val": "[", + }, + }, + }, + { + "m:endChr": { + _attr: { + "m:val": "]", + }, + }, + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-bracket-properties.ts b/src/file/paragraph/math/brackets/math-bracket-properties.ts new file mode 100644 index 0000000000..5bba7bf935 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-bracket-properties.ts @@ -0,0 +1,16 @@ +// http://www.datypic.com/sc/ooxml/e-m_dPr-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathBeginningCharacter } from "./math-beginning-character"; +import { MathEndingCharacter } from "./math-ending-char"; + +export class MathBracketProperties extends XmlComponent { + constructor(options?: { readonly beginningCharacter: string; readonly endingCharacter: string }) { + super("m:dPr"); + + if (!!options) { + this.root.push(new MathBeginningCharacter(options.beginningCharacter)); + this.root.push(new MathEndingCharacter(options.endingCharacter)); + } + } +} diff --git a/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts b/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts new file mode 100644 index 0000000000..6e44621b21 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts @@ -0,0 +1,51 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathCurlyBrackets } from "./math-curly-brackets"; + +describe("MathCurlyBrackets", () => { + describe("#constructor()", () => { + it("should create a MathCurlyBrackets with correct root key", () => { + const mathCurlyBrackets = new MathCurlyBrackets({ + child: new MathRun("60"), + }); + + const tree = new Formatter().format(mathCurlyBrackets); + expect(tree).to.deep.equal({ + "m:d": [ + { + "m:dPr": [ + { + "m:begChr": { + _attr: { + "m:val": "{", + }, + }, + }, + { + "m:endChr": { + _attr: { + "m:val": "}", + }, + }, + }, + ], + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["60"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-curly-brackets.ts b/src/file/paragraph/math/brackets/math-curly-brackets.ts new file mode 100644 index 0000000000..4d540ec8bc --- /dev/null +++ b/src/file/paragraph/math/brackets/math-curly-brackets.ts @@ -0,0 +1,20 @@ +// http://www.datypic.com/sc/ooxml/e-m_d-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../math-component"; +import { MathBase } from "../n-ary"; +import { MathBracketProperties } from "./math-bracket-properties"; + +export class MathCurlyBrackets extends XmlComponent { + constructor(options: { readonly child: MathComponent }) { + super("m:d"); + + this.root.push( + new MathBracketProperties({ + beginningCharacter: "{", + endingCharacter: "}", + }), + ); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/brackets/math-ending-char.ts b/src/file/paragraph/math/brackets/math-ending-char.ts new file mode 100644 index 0000000000..86d0a0a58c --- /dev/null +++ b/src/file/paragraph/math/brackets/math-ending-char.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_endChr-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathEndingCharacterAttributes extends XmlAttributeComponent<{ readonly character: string }> { + protected readonly xmlKeys = { character: "m:val" }; +} + +export class MathEndingCharacter extends XmlComponent { + constructor(character: string) { + super("m:endChr"); + + this.root.push(new MathEndingCharacterAttributes({ character })); + } +} diff --git a/src/file/paragraph/math/brackets/math-ending-character.spec.ts b/src/file/paragraph/math/brackets/math-ending-character.spec.ts new file mode 100644 index 0000000000..ba28ac7840 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-ending-character.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathEndingCharacter } from "./math-ending-char"; + +describe("MathEndingCharacter", () => { + describe("#constructor()", () => { + it("should create a MathEndingCharacter with correct root key", () => { + const mathEndingCharacter = new MathEndingCharacter("]"); + + const tree = new Formatter().format(mathEndingCharacter); + expect(tree).to.deep.equal({ + "m:endChr": { + _attr: { + "m:val": "]", + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-round-brackets.spec.ts b/src/file/paragraph/math/brackets/math-round-brackets.spec.ts new file mode 100644 index 0000000000..cb28126a20 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-round-brackets.spec.ts @@ -0,0 +1,36 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathRoundBrackets } from "./math-round-brackets"; + +describe("MathRoundBrackets", () => { + describe("#constructor()", () => { + it("should create a MathRoundBrackets with correct root key", () => { + const mathRoundBrackets = new MathRoundBrackets({ + child: new MathRun("60"), + }); + + const tree = new Formatter().format(mathRoundBrackets); + expect(tree).to.deep.equal({ + "m:d": [ + { + "m:dPr": {}, + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["60"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-round-brackets.ts b/src/file/paragraph/math/brackets/math-round-brackets.ts new file mode 100644 index 0000000000..2302fa30f1 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-round-brackets.ts @@ -0,0 +1,15 @@ +// http://www.datypic.com/sc/ooxml/e-m_d-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../math-component"; +import { MathBase } from "../n-ary"; +import { MathBracketProperties } from "./math-bracket-properties"; + +export class MathRoundBrackets extends XmlComponent { + constructor(options: { readonly child: MathComponent }) { + super("m:d"); + + this.root.push(new MathBracketProperties()); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/brackets/math-square-brackets.spec.ts b/src/file/paragraph/math/brackets/math-square-brackets.spec.ts new file mode 100644 index 0000000000..03b8aef03d --- /dev/null +++ b/src/file/paragraph/math/brackets/math-square-brackets.spec.ts @@ -0,0 +1,51 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathSquareBrackets } from "./math-square-brackets"; + +describe("MathSquareBrackets", () => { + describe("#constructor()", () => { + it("should create a MathSquareBrackets with correct root key", () => { + const mathSquareBrackets = new MathSquareBrackets({ + child: new MathRun("60"), + }); + + const tree = new Formatter().format(mathSquareBrackets); + expect(tree).to.deep.equal({ + "m:d": [ + { + "m:dPr": [ + { + "m:begChr": { + _attr: { + "m:val": "[", + }, + }, + }, + { + "m:endChr": { + _attr: { + "m:val": "]", + }, + }, + }, + ], + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["60"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/brackets/math-square-brackets.ts b/src/file/paragraph/math/brackets/math-square-brackets.ts new file mode 100644 index 0000000000..3c3d385357 --- /dev/null +++ b/src/file/paragraph/math/brackets/math-square-brackets.ts @@ -0,0 +1,20 @@ +// http://www.datypic.com/sc/ooxml/e-m_d-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../math-component"; +import { MathBase } from "../n-ary"; +import { MathBracketProperties } from "./math-bracket-properties"; + +export class MathSquareBrackets extends XmlComponent { + constructor(options: { readonly child: MathComponent }) { + super("m:d"); + + this.root.push( + new MathBracketProperties({ + beginningCharacter: "[", + endingCharacter: "]", + }), + ); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/fraction/math-denominator.ts b/src/file/paragraph/math/fraction/math-denominator.ts index da9f283bdc..f640324c2e 100644 --- a/src/file/paragraph/math/fraction/math-denominator.ts +++ b/src/file/paragraph/math/fraction/math-denominator.ts @@ -3,7 +3,7 @@ import { XmlComponent } from "file/xml-components"; import { MathRun } from "../math-run"; export class MathDenominator extends XmlComponent { - constructor(readonly text: string) { + constructor(text: string) { super("m:den"); this.root.push(new MathRun(text)); diff --git a/src/file/paragraph/math/fraction/math-fraction.ts b/src/file/paragraph/math/fraction/math-fraction.ts index 062c3ef575..574a989bba 100644 --- a/src/file/paragraph/math/fraction/math-fraction.ts +++ b/src/file/paragraph/math/fraction/math-fraction.ts @@ -9,7 +9,7 @@ export interface IMathFractionOptions { } export class MathFraction extends XmlComponent { - constructor(readonly options: IMathFractionOptions) { + constructor(options: IMathFractionOptions) { super("m:f"); this.root.push(options.numerator); diff --git a/src/file/paragraph/math/fraction/math-numerator.ts b/src/file/paragraph/math/fraction/math-numerator.ts index 68799328cb..f7e68715b8 100644 --- a/src/file/paragraph/math/fraction/math-numerator.ts +++ b/src/file/paragraph/math/fraction/math-numerator.ts @@ -3,7 +3,7 @@ import { XmlComponent } from "file/xml-components"; import { MathRun } from "../math-run"; export class MathNumerator extends XmlComponent { - constructor(readonly text: string) { + constructor(text: string) { super("m:num"); this.root.push(new MathRun(text)); diff --git a/src/file/paragraph/math/function/index.ts b/src/file/paragraph/math/function/index.ts new file mode 100644 index 0000000000..58243c2710 --- /dev/null +++ b/src/file/paragraph/math/function/index.ts @@ -0,0 +1,3 @@ +export * from "./math-function"; +export * from "./math-function-name"; +export * from "./math-function-properties"; diff --git a/src/file/paragraph/math/function/math-function-name.spec.ts b/src/file/paragraph/math/function/math-function-name.spec.ts new file mode 100644 index 0000000000..bdb38d7596 --- /dev/null +++ b/src/file/paragraph/math/function/math-function-name.spec.ts @@ -0,0 +1,27 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathFunctionName } from "./math-function-name"; + +describe("MathFunctionName", () => { + describe("#constructor()", () => { + it("should create a MathFunctionName with correct root key", () => { + const mathFunctionName = new MathFunctionName(new MathRun("2")); + + const tree = new Formatter().format(mathFunctionName); + expect(tree).to.deep.equal({ + "m:fName": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/function/math-function-name.ts b/src/file/paragraph/math/function/math-function-name.ts new file mode 100644 index 0000000000..011e82133a --- /dev/null +++ b/src/file/paragraph/math/function/math-function-name.ts @@ -0,0 +1,11 @@ +// http://www.datypic.com/sc/ooxml/e-m_fName-1.html +import { XmlComponent } from "file/xml-components"; +import { MathComponent } from "../math-component"; + +export class MathFunctionName extends XmlComponent { + constructor(child: MathComponent) { + super("m:fName"); + + this.root.push(child); + } +} diff --git a/src/file/paragraph/math/function/math-function-properties.spec.ts b/src/file/paragraph/math/function/math-function-properties.spec.ts new file mode 100644 index 0000000000..63ec2e4f60 --- /dev/null +++ b/src/file/paragraph/math/function/math-function-properties.spec.ts @@ -0,0 +1,18 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathFunctionProperties } from "./math-function-properties"; + +describe("MathFunctionProperties", () => { + describe("#constructor()", () => { + it("should create a MathFunctionProperties with correct root key", () => { + const mathFunctionProperties = new MathFunctionProperties(); + + const tree = new Formatter().format(mathFunctionProperties); + expect(tree).to.deep.equal({ + "m:funcPr": {}, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/function/math-function-properties.ts b/src/file/paragraph/math/function/math-function-properties.ts new file mode 100644 index 0000000000..f6e8d608ac --- /dev/null +++ b/src/file/paragraph/math/function/math-function-properties.ts @@ -0,0 +1,8 @@ +// http://www.datypic.com/sc/ooxml/e-m_radPr-1.html +import { XmlComponent } from "file/xml-components"; + +export class MathFunctionProperties extends XmlComponent { + constructor() { + super("m:funcPr"); + } +} diff --git a/src/file/paragraph/math/function/math-function.spec.ts b/src/file/paragraph/math/function/math-function.spec.ts new file mode 100644 index 0000000000..4320a853c6 --- /dev/null +++ b/src/file/paragraph/math/function/math-function.spec.ts @@ -0,0 +1,48 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathFunction } from "./math-function"; + +describe("MathFunction", () => { + describe("#constructor()", () => { + it("should create a MathFunction with correct root key", () => { + const mathFunction = new MathFunction({ + name: new MathRun("sin"), + child: new MathRun("60"), + }); + + const tree = new Formatter().format(mathFunction); + expect(tree).to.deep.equal({ + "m:func": [ + { + "m:funcPr": {}, + }, + { + "m:fName": [ + { + "m:r": [ + { + "m:t": ["sin"], + }, + ], + }, + ], + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["60"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/function/math-function.ts b/src/file/paragraph/math/function/math-function.ts new file mode 100644 index 0000000000..b3de75ddb8 --- /dev/null +++ b/src/file/paragraph/math/function/math-function.ts @@ -0,0 +1,22 @@ +// http://www.datypic.com/sc/ooxml/e-m_func-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../math-component"; +import { MathBase } from "../n-ary"; +import { MathFunctionName } from "./math-function-name"; +import { MathFunctionProperties } from "./math-function-properties"; + +export interface IMathFunctionOptions { + readonly child: MathComponent; + readonly name: MathComponent; +} + +export class MathFunction extends XmlComponent { + constructor(options: IMathFunctionOptions) { + super("m:func"); + + this.root.push(new MathFunctionProperties()); + this.root.push(new MathFunctionName(options.name)); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/index.ts b/src/file/paragraph/math/index.ts index 063678689c..b42ec908f6 100644 --- a/src/file/paragraph/math/index.ts +++ b/src/file/paragraph/math/index.ts @@ -2,3 +2,8 @@ export * from "./math"; export * from "./math-run"; export * from "./fraction"; export * from "./n-ary"; +export * from "./script"; +export * from "./math-component"; +export * from "./radical"; +export * from "./function"; +export * from "./brackets"; diff --git a/src/file/paragraph/math/math-component.ts b/src/file/paragraph/math/math-component.ts new file mode 100644 index 0000000000..afe83235f4 --- /dev/null +++ b/src/file/paragraph/math/math-component.ts @@ -0,0 +1,21 @@ +import { MathAngledBrackets, MathCurlyBrackets, MathRoundBrackets, MathSquareBrackets } from "./brackets"; +import { MathFraction } from "./fraction"; +import { MathFunction } from "./function"; +import { MathRun } from "./math-run"; +import { MathSum } from "./n-ary"; +import { MathRadical } from "./radical"; +import { MathSubScript, MathSubSuperScript, MathSuperScript } from "./script"; + +export type MathComponent = + | MathRun + | MathFraction + | MathSum + | MathSuperScript + | MathSubScript + | MathSubSuperScript + | MathRadical + | MathFunction + | MathRoundBrackets + | MathCurlyBrackets + | MathAngledBrackets + | MathSquareBrackets; diff --git a/src/file/paragraph/math/math-run.ts b/src/file/paragraph/math/math-run.ts index 3b7cceb362..0d2c48910f 100644 --- a/src/file/paragraph/math/math-run.ts +++ b/src/file/paragraph/math/math-run.ts @@ -4,7 +4,7 @@ import { XmlComponent } from "file/xml-components"; import { MathText } from "./math-text"; export class MathRun extends XmlComponent { - constructor(readonly text: string) { + constructor(text: string) { super("m:r"); this.root.push(new MathText(text)); diff --git a/src/file/paragraph/math/math-text.ts b/src/file/paragraph/math/math-text.ts index 907294aab9..6087c7e611 100644 --- a/src/file/paragraph/math/math-text.ts +++ b/src/file/paragraph/math/math-text.ts @@ -1,7 +1,7 @@ import { XmlComponent } from "file/xml-components"; export class MathText extends XmlComponent { - constructor(readonly text: string) { + constructor(text: string) { super("m:t"); this.root.push(text); diff --git a/src/file/paragraph/math/math.ts b/src/file/paragraph/math/math.ts index 43272ed941..69ebae4dff 100644 --- a/src/file/paragraph/math/math.ts +++ b/src/file/paragraph/math/math.ts @@ -1,16 +1,14 @@ // http://www.datypic.com/sc/ooxml/e-m_oMath-1.html import { XmlComponent } from "file/xml-components"; -import { MathFraction } from "./fraction"; -import { MathRun } from "./math-run"; -import { MathSum } from "./n-ary"; +import { MathComponent } from "./math-component"; export interface IMathOptions { - readonly children: Array; + readonly children: MathComponent[]; } export class Math extends XmlComponent { - constructor(readonly options: IMathOptions) { + constructor(options: IMathOptions) { super("m:oMath"); for (const child of options.children) { diff --git a/src/file/paragraph/math/n-ary/math-accent-character.ts b/src/file/paragraph/math/n-ary/math-accent-character.ts index 3a5a10d7d2..00182bd1f2 100644 --- a/src/file/paragraph/math/n-ary/math-accent-character.ts +++ b/src/file/paragraph/math/n-ary/math-accent-character.ts @@ -6,7 +6,7 @@ class MathAccentCharacterAttributes extends XmlAttributeComponent<{ readonly acc } export class MathAccentCharacter extends XmlComponent { - constructor(readonly accent: string) { + constructor(accent: string) { super("m:chr"); this.root.push(new MathAccentCharacterAttributes({ accent })); diff --git a/src/file/paragraph/math/n-ary/math-base.ts b/src/file/paragraph/math/n-ary/math-base.ts index e75231cdb2..7c06a67c23 100644 --- a/src/file/paragraph/math/n-ary/math-base.ts +++ b/src/file/paragraph/math/n-ary/math-base.ts @@ -1,10 +1,10 @@ // http://www.datypic.com/sc/ooxml/e-m_e-1.html import { XmlComponent } from "file/xml-components"; -import { MathRun } from "../math-run"; +import { MathComponent } from "../math-component"; export class MathBase extends XmlComponent { - constructor(readonly run: MathRun) { + constructor(run: MathComponent) { super("m:e"); this.root.push(run); diff --git a/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts b/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts index 01ac55fb03..70aa74a1c4 100644 --- a/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts +++ b/src/file/paragraph/math/n-ary/math-naray-properties.spec.ts @@ -7,7 +7,7 @@ import { MathNArayProperties } from "./math-naray-properties"; describe("MathNArayProperties", () => { describe("#constructor()", () => { it("should create a MathNArayProperties with correct root key", () => { - const mathNArayProperties = new MathNArayProperties("∑"); + const mathNArayProperties = new MathNArayProperties("∑", true, true); const tree = new Formatter().format(mathNArayProperties); expect(tree).to.deep.equal({ @@ -29,5 +29,105 @@ describe("MathNArayProperties", () => { ], }); }); + + it("should add super-script hide attributes", () => { + const mathNArayProperties = new MathNArayProperties("∑", false, true); + + const tree = new Formatter().format(mathNArayProperties); + expect(tree).to.deep.equal({ + "m:naryPr": [ + { + "m:chr": { + _attr: { + "m:val": "∑", + }, + }, + }, + { + "m:limLoc": { + _attr: { + "m:val": "undOvr", + }, + }, + }, + { + "m:supHide": { + _attr: { + "m:val": 1, + }, + }, + }, + ], + }); + }); + + it("should add sub-script hide attributes", () => { + const mathNArayProperties = new MathNArayProperties("∑", true, false); + + const tree = new Formatter().format(mathNArayProperties); + expect(tree).to.deep.equal({ + "m:naryPr": [ + { + "m:chr": { + _attr: { + "m:val": "∑", + }, + }, + }, + { + "m:limLoc": { + _attr: { + "m:val": "undOvr", + }, + }, + }, + { + "m:subHide": { + _attr: { + "m:val": 1, + }, + }, + }, + ], + }); + }); + + it("should add both super-script and sub-script hide attributes", () => { + const mathNArayProperties = new MathNArayProperties("∑", false, false); + + const tree = new Formatter().format(mathNArayProperties); + expect(tree).to.deep.equal({ + "m:naryPr": [ + { + "m:chr": { + _attr: { + "m:val": "∑", + }, + }, + }, + { + "m:limLoc": { + _attr: { + "m:val": "undOvr", + }, + }, + }, + { + "m:supHide": { + _attr: { + "m:val": 1, + }, + }, + }, + { + "m:subHide": { + _attr: { + "m:val": 1, + }, + }, + }, + ], + }); + }); }); }); diff --git a/src/file/paragraph/math/n-ary/math-naray-properties.ts b/src/file/paragraph/math/n-ary/math-naray-properties.ts index 4b28b58794..f8e91e746a 100644 --- a/src/file/paragraph/math/n-ary/math-naray-properties.ts +++ b/src/file/paragraph/math/n-ary/math-naray-properties.ts @@ -3,12 +3,22 @@ import { 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"; export class MathNArayProperties extends XmlComponent { - constructor(readonly accent: string) { + constructor(accent: string, hasSuperScript: boolean, hasSubScript: boolean) { super("m:naryPr"); this.root.push(new MathAccentCharacter(accent)); this.root.push(new MathLimitLocation()); + + if (!hasSuperScript) { + this.root.push(new MathSuperScriptHide()); + } + + if (!hasSubScript) { + this.root.push(new MathSubScriptHide()); + } } } diff --git a/src/file/paragraph/math/n-ary/math-sub-script-hide.spec.ts b/src/file/paragraph/math/n-ary/math-sub-script-hide.spec.ts new file mode 100644 index 0000000000..2e9845172f --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-sub-script-hide.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathSubScriptHide } from "./math-sub-script-hide"; + +describe("MathSubScriptHide", () => { + describe("#constructor()", () => { + it("should create a MathSubScriptHide with correct root key", () => { + const mathSubScriptHide = new MathSubScriptHide(); + + const tree = new Formatter().format(mathSubScriptHide); + expect(tree).to.deep.equal({ + "m:subHide": { + _attr: { + "m:val": 1, + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-sub-script-hide.ts b/src/file/paragraph/math/n-ary/math-sub-script-hide.ts new file mode 100644 index 0000000000..ef735744e0 --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-sub-script-hide.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_subHide-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathSubScriptHideAttributes extends XmlAttributeComponent<{ readonly hide: number }> { + protected readonly xmlKeys = { hide: "m:val" }; +} + +export class MathSubScriptHide extends XmlComponent { + constructor() { + super("m:subHide"); + + this.root.push(new MathSubScriptHideAttributes({ hide: 1 })); + } +} diff --git a/src/file/paragraph/math/n-ary/math-sub-script.spec.ts b/src/file/paragraph/math/n-ary/math-sub-script.spec.ts index d09908b192..5a4009811e 100644 --- a/src/file/paragraph/math/n-ary/math-sub-script.spec.ts +++ b/src/file/paragraph/math/n-ary/math-sub-script.spec.ts @@ -3,14 +3,14 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; import { MathRun } from "../math-run"; -import { MathSubScript } from "./math-sub-script"; +import { MathSubScriptElement } from "./math-sub-script"; -describe("MathSubScript", () => { +describe("MathSubScriptElement", () => { describe("#constructor()", () => { - it("should create a MathSubScript with correct root key", () => { - const mathSubScript = new MathSubScript(new MathRun("2+2")); + it("should create a MathSubScriptElement with correct root key", () => { + const mathSubScriptElement = new MathSubScriptElement(new MathRun("2+2")); - const tree = new Formatter().format(mathSubScript); + const tree = new Formatter().format(mathSubScriptElement); expect(tree).to.deep.equal({ "m:sub": [ { diff --git a/src/file/paragraph/math/n-ary/math-sub-script.ts b/src/file/paragraph/math/n-ary/math-sub-script.ts index 25fe8da894..aaa8530e74 100644 --- a/src/file/paragraph/math/n-ary/math-sub-script.ts +++ b/src/file/paragraph/math/n-ary/math-sub-script.ts @@ -1,12 +1,12 @@ -// http://www.datypic.com/sc/ooxml/e-m_e-1.html +// http://www.datypic.com/sc/ooxml/e-m_sub-3.html import { XmlComponent } from "file/xml-components"; -import { MathRun } from "../math-run"; +import { MathComponent } from "../math-component"; -export class MathSubScript extends XmlComponent { - constructor(readonly run: MathRun) { +export class MathSubScriptElement extends XmlComponent { + constructor(child: MathComponent) { super("m:sub"); - this.root.push(run); + this.root.push(child); } } diff --git a/src/file/paragraph/math/n-ary/math-sum.spec.ts b/src/file/paragraph/math/n-ary/math-sum.spec.ts index e168792b1f..9f0d213aa4 100644 --- a/src/file/paragraph/math/n-ary/math-sum.spec.ts +++ b/src/file/paragraph/math/n-ary/math-sum.spec.ts @@ -40,7 +40,7 @@ describe("MathSum", () => { { "m:r": [ { - "m:t": ["1"], + "m:t": ["2"], }, ], }, @@ -51,7 +51,7 @@ describe("MathSum", () => { { "m:r": [ { - "m:t": ["1"], + "m:t": ["3"], }, ], }, diff --git a/src/file/paragraph/math/n-ary/math-sum.ts b/src/file/paragraph/math/n-ary/math-sum.ts index 2664b87fad..a16603982d 100644 --- a/src/file/paragraph/math/n-ary/math-sum.ts +++ b/src/file/paragraph/math/n-ary/math-sum.ts @@ -1,25 +1,32 @@ // http://www.datypic.com/sc/ooxml/e-m_nary-1.html import { XmlComponent } from "file/xml-components"; -import { MathRun } from "../math-run"; +import { MathComponent } from "../math-component"; import { MathBase } from "./math-base"; import { MathNArayProperties } from "./math-naray-properties"; -import { MathSubScript } from "./math-sub-script"; -import { MathSuperScript } from "./math-super-script"; +import { MathSubScriptElement } from "./math-sub-script"; +import { MathSuperScriptElement } from "./math-super-script"; export interface IMathSumOptions { - readonly child: MathRun; - readonly subScript?: MathRun; - readonly superScript?: MathRun; + readonly child: MathComponent; + readonly subScript?: MathComponent; + readonly superScript?: MathComponent; } export class MathSum extends XmlComponent { - constructor(readonly options: IMathSumOptions) { + constructor(options: IMathSumOptions) { super("m:nary"); - this.root.push(new MathNArayProperties("∑")); - this.root.push(new MathSubScript(options.child)); - this.root.push(new MathSuperScript(options.child)); + this.root.push(new MathNArayProperties("∑", !!options.superScript, !!options.subScript)); + + if (!!options.subScript) { + this.root.push(new MathSubScriptElement(options.subScript)); + } + + if (!!options.superScript) { + this.root.push(new MathSuperScriptElement(options.superScript)); + } + this.root.push(new MathBase(options.child)); } } diff --git a/src/file/paragraph/math/n-ary/math-super-script-hide.spec.ts b/src/file/paragraph/math/n-ary/math-super-script-hide.spec.ts new file mode 100644 index 0000000000..89a28564ac --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-super-script-hide.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathSuperScriptHide } from "./math-super-script-hide"; + +describe("MathSuperScriptHide", () => { + describe("#constructor()", () => { + it("should create a MathSuperScriptHide with correct root key", () => { + const mathSuperScriptHide = new MathSuperScriptHide(); + + const tree = new Formatter().format(mathSuperScriptHide); + expect(tree).to.deep.equal({ + "m:supHide": { + _attr: { + "m:val": 1, + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/n-ary/math-super-script-hide.ts b/src/file/paragraph/math/n-ary/math-super-script-hide.ts new file mode 100644 index 0000000000..a55c15a7ad --- /dev/null +++ b/src/file/paragraph/math/n-ary/math-super-script-hide.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_subHide-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathSuperScriptHideAttributes extends XmlAttributeComponent<{ readonly hide: number }> { + protected readonly xmlKeys = { hide: "m:val" }; +} + +export class MathSuperScriptHide extends XmlComponent { + constructor() { + super("m:supHide"); + + this.root.push(new MathSuperScriptHideAttributes({ hide: 1 })); + } +} diff --git a/src/file/paragraph/math/n-ary/math-super-script.spec.ts b/src/file/paragraph/math/n-ary/math-super-script.spec.ts index 7270276c28..85a5195c0f 100644 --- a/src/file/paragraph/math/n-ary/math-super-script.spec.ts +++ b/src/file/paragraph/math/n-ary/math-super-script.spec.ts @@ -3,14 +3,14 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; import { MathRun } from "../math-run"; -import { MathSuperScript } from "./math-super-script"; +import { MathSuperScriptElement } from "./math-super-script"; -describe("MathSuperScript", () => { +describe("MathSuperScriptElement", () => { describe("#constructor()", () => { - it("should create a MathSuperScript with correct root key", () => { - const mathSuperScript = new MathSuperScript(new MathRun("2+2")); + it("should create a MathSuperScriptElement with correct root key", () => { + const mathSuperScriptElement = new MathSuperScriptElement(new MathRun("2+2")); - const tree = new Formatter().format(mathSuperScript); + const tree = new Formatter().format(mathSuperScriptElement); expect(tree).to.deep.equal({ "m:sup": [ { diff --git a/src/file/paragraph/math/n-ary/math-super-script.ts b/src/file/paragraph/math/n-ary/math-super-script.ts index 8296c59f6a..1d29bda52b 100644 --- a/src/file/paragraph/math/n-ary/math-super-script.ts +++ b/src/file/paragraph/math/n-ary/math-super-script.ts @@ -1,12 +1,12 @@ -// http://www.datypic.com/sc/ooxml/e-m_e-1.html +// http://www.datypic.com/sc/ooxml/e-m_sup-3.html import { XmlComponent } from "file/xml-components"; -import { MathRun } from "../math-run"; +import { MathComponent } from "../math-component"; -export class MathSuperScript extends XmlComponent { - constructor(readonly run: MathRun) { +export class MathSuperScriptElement extends XmlComponent { + constructor(child: MathComponent) { super("m:sup"); - this.root.push(run); + this.root.push(child); } } diff --git a/src/file/paragraph/math/radical/index.ts b/src/file/paragraph/math/radical/index.ts new file mode 100644 index 0000000000..78240ccd13 --- /dev/null +++ b/src/file/paragraph/math/radical/index.ts @@ -0,0 +1,3 @@ +export * from "./math-degree"; +export * from "./math-radical"; +export * from "./math-radical-properties"; diff --git a/src/file/paragraph/math/radical/math-degree-hide.spec.ts b/src/file/paragraph/math/radical/math-degree-hide.spec.ts new file mode 100644 index 0000000000..0c3f335a13 --- /dev/null +++ b/src/file/paragraph/math/radical/math-degree-hide.spec.ts @@ -0,0 +1,22 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathDegreeHide } from "./math-degree-hide"; + +describe("MathDegreeHide", () => { + describe("#constructor()", () => { + it("should create a MathDegreeHide with correct root key", () => { + const mathDegreeHide = new MathDegreeHide(); + + const tree = new Formatter().format(mathDegreeHide); + expect(tree).to.deep.equal({ + "m:degHide": { + _attr: { + "m:val": 1, + }, + }, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/radical/math-degree-hide.ts b/src/file/paragraph/math/radical/math-degree-hide.ts new file mode 100644 index 0000000000..c1b9dd2ae5 --- /dev/null +++ b/src/file/paragraph/math/radical/math-degree-hide.ts @@ -0,0 +1,14 @@ +// http://www.datypic.com/sc/ooxml/e-m_degHide-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +class MathDegreeHideAttributes extends XmlAttributeComponent<{ readonly hide: number }> { + protected readonly xmlKeys = { hide: "m:val" }; +} + +export class MathDegreeHide extends XmlComponent { + constructor() { + super("m:degHide"); + + this.root.push(new MathDegreeHideAttributes({ hide: 1 })); + } +} diff --git a/src/file/paragraph/math/radical/math-degree.spec.ts b/src/file/paragraph/math/radical/math-degree.spec.ts new file mode 100644 index 0000000000..6a1c28656b --- /dev/null +++ b/src/file/paragraph/math/radical/math-degree.spec.ts @@ -0,0 +1,36 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathDegree } from "./math-degree"; + +describe("MathDegree", () => { + describe("#constructor()", () => { + it("should create a MathDegree with correct root key", () => { + const mathDegree = new MathDegree(); + + const tree = new Formatter().format(mathDegree); + expect(tree).to.deep.equal({ + "m:deg": {}, + }); + }); + + it("should create a MathDegree with correct root key with child", () => { + const mathDegree = new MathDegree(new MathRun("2")); + + const tree = new Formatter().format(mathDegree); + expect(tree).to.deep.equal({ + "m:deg": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/radical/math-degree.ts b/src/file/paragraph/math/radical/math-degree.ts new file mode 100644 index 0000000000..402ee8ffda --- /dev/null +++ b/src/file/paragraph/math/radical/math-degree.ts @@ -0,0 +1,13 @@ +// http://www.datypic.com/sc/ooxml/e-m_deg-1.html +import { XmlComponent } from "file/xml-components"; +import { MathComponent } from "../math-component"; + +export class MathDegree extends XmlComponent { + constructor(child?: MathComponent) { + super("m:deg"); + + if (!!child) { + this.root.push(child); + } + } +} diff --git a/src/file/paragraph/math/radical/math-radical-properties.spec.ts b/src/file/paragraph/math/radical/math-radical-properties.spec.ts new file mode 100644 index 0000000000..12d29a2962 --- /dev/null +++ b/src/file/paragraph/math/radical/math-radical-properties.spec.ts @@ -0,0 +1,35 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRadicalProperties } from "./math-radical-properties"; + +describe("MathRadicalProperties", () => { + describe("#constructor()", () => { + it("should create a MathRadicalProperties with correct root key", () => { + const mathRadicalProperties = new MathRadicalProperties(true); + + const tree = new Formatter().format(mathRadicalProperties); + expect(tree).to.deep.equal({ + "m:radPr": {}, + }); + }); + + it("should create a MathRadicalProperties with correct root key with degree hide", () => { + const mathRadicalProperties = new MathRadicalProperties(false); + + const tree = new Formatter().format(mathRadicalProperties); + expect(tree).to.deep.equal({ + "m:radPr": [ + { + "m:degHide": { + _attr: { + "m:val": 1, + }, + }, + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/radical/math-radical-properties.ts b/src/file/paragraph/math/radical/math-radical-properties.ts new file mode 100644 index 0000000000..b4e90ed4df --- /dev/null +++ b/src/file/paragraph/math/radical/math-radical-properties.ts @@ -0,0 +1,13 @@ +// http://www.datypic.com/sc/ooxml/e-m_radPr-1.html +import { XmlComponent } from "file/xml-components"; +import { MathDegreeHide } from "./math-degree-hide"; + +export class MathRadicalProperties extends XmlComponent { + constructor(hasDegree: boolean) { + super("m:radPr"); + + if (!hasDegree) { + this.root.push(new MathDegreeHide()); + } + } +} diff --git a/src/file/paragraph/math/radical/math-radical.spec.ts b/src/file/paragraph/math/radical/math-radical.spec.ts new file mode 100644 index 0000000000..7d7d7c4225 --- /dev/null +++ b/src/file/paragraph/math/radical/math-radical.spec.ts @@ -0,0 +1,48 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../math-run"; +import { MathRadical } from "./math-radical"; + +describe("MathRadical", () => { + describe("#constructor()", () => { + it("should create a MathRadical with correct root key", () => { + const mathRadical = new MathRadical({ + child: new MathRun("e"), + degree: new MathRun("2"), + }); + + const tree = new Formatter().format(mathRadical); + expect(tree).to.deep.equal({ + "m:rad": [ + { + "m:radPr": {}, + }, + { + "m:deg": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["e"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/radical/math-radical.ts b/src/file/paragraph/math/radical/math-radical.ts new file mode 100644 index 0000000000..76fc2dc7ca --- /dev/null +++ b/src/file/paragraph/math/radical/math-radical.ts @@ -0,0 +1,22 @@ +// http://www.datypic.com/sc/ooxml/e-m_rad-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../math-component"; +import { MathBase } from "../n-ary"; +import { MathDegree } from "./math-degree"; +import { MathRadicalProperties } from "./math-radical-properties"; + +export interface IMathRadicalOptions { + readonly child: MathComponent; + readonly degree?: MathComponent; +} + +export class MathRadical extends XmlComponent { + constructor(options: IMathRadicalOptions) { + super("m:rad"); + + this.root.push(new MathRadicalProperties(!!options.degree)); + this.root.push(new MathDegree(options.degree)); + this.root.push(new MathBase(options.child)); + } +} diff --git a/src/file/paragraph/math/script/index.ts b/src/file/paragraph/math/script/index.ts new file mode 100644 index 0000000000..a83e54975e --- /dev/null +++ b/src/file/paragraph/math/script/index.ts @@ -0,0 +1,4 @@ +export * from "./super-script"; +export * from "./sub-script"; +export * from "./sub-super-script"; +export * from "./pre-sub-super-script"; diff --git a/src/file/paragraph/math/script/pre-sub-super-script/index.ts b/src/file/paragraph/math/script/pre-sub-super-script/index.ts new file mode 100644 index 0000000000..8660a75017 --- /dev/null +++ b/src/file/paragraph/math/script/pre-sub-super-script/index.ts @@ -0,0 +1,2 @@ +export * from "./math-pre-sub-super-script-function"; +export * from "./math-pre-sub-super-script-function-properties"; diff --git a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.spec.ts b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.spec.ts new file mode 100644 index 0000000000..a6f1d5383e --- /dev/null +++ b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties"; + +describe("MathPreSubSuperScriptProperties", () => { + describe("#constructor()", () => { + it("should create a MathPreSubSuperScriptProperties with correct root key", () => { + const mathPreSubSuperScriptProperties = new MathPreSubSuperScriptProperties(); + + const tree = new Formatter().format(mathPreSubSuperScriptProperties); + expect(tree).to.deep.equal({ + "m:sPrePr": {}, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.ts b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.ts new file mode 100644 index 0000000000..fed0cb3564 --- /dev/null +++ b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function-properties.ts @@ -0,0 +1,8 @@ +// http://www.datypic.com/sc/ooxml/e-m_sPrePr-1.html +import { XmlComponent } from "file/xml-components"; + +export class MathPreSubSuperScriptProperties extends XmlComponent { + constructor() { + super("m:sPrePr"); + } +} diff --git a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts new file mode 100644 index 0000000000..956a2ff445 --- /dev/null +++ b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts @@ -0,0 +1,60 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../../math-run"; +import { MathPreSubSuperScript } from "./math-pre-sub-super-script-function"; + +describe("MathPreSubScript", () => { + describe("#constructor()", () => { + it("should create a MathPreSubScript with correct root key", () => { + const mathPreSubScript = new MathPreSubSuperScript({ + child: new MathRun("e"), + subScript: new MathRun("2"), + superScript: new MathRun("5"), + }); + + const tree = new Formatter().format(mathPreSubScript); + expect(tree).to.deep.equal({ + "m:sPre": [ + { + "m:sPrePr": {}, + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["e"], + }, + ], + }, + ], + }, + { + "m:sub": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + { + "m:sup": [ + { + "m:r": [ + { + "m:t": ["5"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts new file mode 100644 index 0000000000..a0bdc321a0 --- /dev/null +++ b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts @@ -0,0 +1,23 @@ +// http://www.datypic.com/sc/ooxml/e-m_sPre-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../../math-component"; +import { MathBase, MathSubScriptElement, MathSuperScriptElement } from "../../n-ary"; +import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties"; + +export interface IMathPreSubSuperScriptOptions { + readonly child: MathComponent; + readonly subScript: MathComponent; + readonly superScript: MathComponent; +} + +export class MathPreSubSuperScript extends XmlComponent { + constructor(options: IMathPreSubSuperScriptOptions) { + super("m:sPre"); + + this.root.push(new MathPreSubSuperScriptProperties()); + this.root.push(new MathBase(options.child)); + this.root.push(new MathSubScriptElement(options.subScript)); + this.root.push(new MathSuperScriptElement(options.superScript)); + } +} diff --git a/src/file/paragraph/math/script/sub-script/index.ts b/src/file/paragraph/math/script/sub-script/index.ts new file mode 100644 index 0000000000..0f1c27fe51 --- /dev/null +++ b/src/file/paragraph/math/script/sub-script/index.ts @@ -0,0 +1,2 @@ +export * from "./math-sub-script-function"; +export * from "./math-sub-script-function-properties"; diff --git a/src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.spec.ts b/src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.spec.ts new file mode 100644 index 0000000000..be229e066b --- /dev/null +++ b/src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { MathSubScriptProperties } from "./math-sub-script-function-properties"; + +describe("MathSubScriptProperties", () => { + describe("#constructor()", () => { + it("should create a MathSubScriptProperties with correct root key", () => { + const mathSubScriptProperties = new MathSubScriptProperties(); + + const tree = new Formatter().format(mathSubScriptProperties); + expect(tree).to.deep.equal({ + "m:sSubPr": {}, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.ts b/src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.ts new file mode 100644 index 0000000000..bf37b1d885 --- /dev/null +++ b/src/file/paragraph/math/script/sub-script/math-sub-script-function-properties.ts @@ -0,0 +1,8 @@ +// http://www.datypic.com/sc/ooxml/e-m_sSubPr-1.html +import { XmlComponent } from "file/xml-components"; + +export class MathSubScriptProperties extends XmlComponent { + constructor() { + super("m:sSubPr"); + } +} diff --git a/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts b/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts new file mode 100644 index 0000000000..dd33598d81 --- /dev/null +++ b/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts @@ -0,0 +1,48 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../../math-run"; +import { MathSubScript } from "./math-sub-script-function"; + +describe("MathSubScript", () => { + describe("#constructor()", () => { + it("should create a MathSubScript with correct root key", () => { + const mathSubScript = new MathSubScript({ + child: new MathRun("e"), + subScript: new MathRun("2"), + }); + + const tree = new Formatter().format(mathSubScript); + expect(tree).to.deep.equal({ + "m:sSub": [ + { + "m:sSubPr": {}, + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["e"], + }, + ], + }, + ], + }, + { + "m:sub": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts b/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts new file mode 100644 index 0000000000..a5c26cd06c --- /dev/null +++ b/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts @@ -0,0 +1,21 @@ +// http://www.datypic.com/sc/ooxml/e-m_sSub-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../../math-component"; +import { MathBase, MathSubScriptElement } from "../../n-ary"; +import { MathSubScriptProperties } from "./math-sub-script-function-properties"; + +export interface IMathSubScriptOptions { + readonly child: MathComponent; + readonly subScript: MathComponent; +} + +export class MathSubScript extends XmlComponent { + constructor(options: IMathSubScriptOptions) { + super("m:sSub"); + + this.root.push(new MathSubScriptProperties()); + this.root.push(new MathBase(options.child)); + this.root.push(new MathSubScriptElement(options.subScript)); + } +} diff --git a/src/file/paragraph/math/script/sub-super-script/index.ts b/src/file/paragraph/math/script/sub-super-script/index.ts new file mode 100644 index 0000000000..88ddeb69fa --- /dev/null +++ b/src/file/paragraph/math/script/sub-super-script/index.ts @@ -0,0 +1,2 @@ +export * from "./math-sub-super-script-function"; +export * from "./math-sub-super-script-function-properties"; diff --git a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.spec.ts b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.spec.ts new file mode 100644 index 0000000000..b0f934823a --- /dev/null +++ b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties"; + +describe("MathSubSuperScriptProperties", () => { + describe("#constructor()", () => { + it("should create a MathSubSuperScriptProperties with correct root key", () => { + const mathSubSuperScriptProperties = new MathSubSuperScriptProperties(); + + const tree = new Formatter().format(mathSubSuperScriptProperties); + expect(tree).to.deep.equal({ + "m:sSubSupPr": {}, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.ts b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.ts new file mode 100644 index 0000000000..b3218a7d3a --- /dev/null +++ b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function-properties.ts @@ -0,0 +1,8 @@ +// http://www.datypic.com/sc/ooxml/e-m_sSubSupPr-1.html +import { XmlComponent } from "file/xml-components"; + +export class MathSubSuperScriptProperties extends XmlComponent { + constructor() { + super("m:sSubSupPr"); + } +} diff --git a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts new file mode 100644 index 0000000000..5e7f976db7 --- /dev/null +++ b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts @@ -0,0 +1,60 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../../math-run"; +import { MathSubSuperScript } from "./math-sub-super-script-function"; + +describe("MathSubScript", () => { + describe("#constructor()", () => { + it("should create a MathSubScript with correct root key", () => { + const mathSubScript = new MathSubSuperScript({ + child: new MathRun("e"), + subScript: new MathRun("2"), + superScript: new MathRun("5"), + }); + + const tree = new Formatter().format(mathSubScript); + expect(tree).to.deep.equal({ + "m:sSubSup": [ + { + "m:sSubSupPr": {}, + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["e"], + }, + ], + }, + ], + }, + { + "m:sub": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + { + "m:sup": [ + { + "m:r": [ + { + "m:t": ["5"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts new file mode 100644 index 0000000000..91bdfe6781 --- /dev/null +++ b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts @@ -0,0 +1,23 @@ +// http://www.datypic.com/sc/ooxml/e-m_sSubSup-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../../math-component"; +import { MathBase, MathSubScriptElement, MathSuperScriptElement } from "../../n-ary"; +import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties"; + +export interface IMathSubSuperScriptOptions { + readonly child: MathComponent; + readonly subScript: MathComponent; + readonly superScript: MathComponent; +} + +export class MathSubSuperScript extends XmlComponent { + constructor(options: IMathSubSuperScriptOptions) { + super("m:sSubSup"); + + this.root.push(new MathSubSuperScriptProperties()); + this.root.push(new MathBase(options.child)); + this.root.push(new MathSubScriptElement(options.subScript)); + this.root.push(new MathSuperScriptElement(options.superScript)); + } +} diff --git a/src/file/paragraph/math/script/super-script/index.ts b/src/file/paragraph/math/script/super-script/index.ts new file mode 100644 index 0000000000..2864fe9ac5 --- /dev/null +++ b/src/file/paragraph/math/script/super-script/index.ts @@ -0,0 +1,2 @@ +export * from "./math-super-script-function"; +export * from "./math-super-script-function-properties"; diff --git a/src/file/paragraph/math/script/super-script/math-super-script-function-properties.spec.ts b/src/file/paragraph/math/script/super-script/math-super-script-function-properties.spec.ts new file mode 100644 index 0000000000..f95920f152 --- /dev/null +++ b/src/file/paragraph/math/script/super-script/math-super-script-function-properties.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { MathSuperScriptProperties } from "./math-super-script-function-properties"; + +describe("MathSuperScriptProperties", () => { + describe("#constructor()", () => { + it("should create a MathSuperScriptProperties with correct root key", () => { + const mathSuperScriptProperties = new MathSuperScriptProperties(); + + const tree = new Formatter().format(mathSuperScriptProperties); + expect(tree).to.deep.equal({ + "m:sSupPr": {}, + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/super-script/math-super-script-function-properties.ts b/src/file/paragraph/math/script/super-script/math-super-script-function-properties.ts new file mode 100644 index 0000000000..ea5dbac20b --- /dev/null +++ b/src/file/paragraph/math/script/super-script/math-super-script-function-properties.ts @@ -0,0 +1,8 @@ +// http://www.datypic.com/sc/ooxml/e-m_sSupPr-1.html +import { XmlComponent } from "file/xml-components"; + +export class MathSuperScriptProperties extends XmlComponent { + constructor() { + super("m:sSupPr"); + } +} diff --git a/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts b/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts new file mode 100644 index 0000000000..6e6beb5e04 --- /dev/null +++ b/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts @@ -0,0 +1,48 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { MathRun } from "../../math-run"; +import { MathSuperScript } from "./math-super-script-function"; + +describe("MathSuperScript", () => { + describe("#constructor()", () => { + it("should create a MathSuperScript with correct root key", () => { + const mathSuperScript = new MathSuperScript({ + child: new MathRun("e"), + superScript: new MathRun("2"), + }); + + const tree = new Formatter().format(mathSuperScript); + expect(tree).to.deep.equal({ + "m:sSup": [ + { + "m:sSupPr": {}, + }, + { + "m:e": [ + { + "m:r": [ + { + "m:t": ["e"], + }, + ], + }, + ], + }, + { + "m:sup": [ + { + "m:r": [ + { + "m:t": ["2"], + }, + ], + }, + ], + }, + ], + }); + }); + }); +}); diff --git a/src/file/paragraph/math/script/super-script/math-super-script-function.ts b/src/file/paragraph/math/script/super-script/math-super-script-function.ts new file mode 100644 index 0000000000..d48ece6985 --- /dev/null +++ b/src/file/paragraph/math/script/super-script/math-super-script-function.ts @@ -0,0 +1,21 @@ +// http://www.datypic.com/sc/ooxml/e-m_sSup-1.html +import { XmlComponent } from "file/xml-components"; + +import { MathComponent } from "../../math-component"; +import { MathBase, MathSuperScriptElement } from "../../n-ary"; +import { MathSuperScriptProperties } from "./math-super-script-function-properties"; + +export interface IMathSuperScriptOptions { + readonly child: MathComponent; + readonly superScript: MathComponent; +} + +export class MathSuperScript extends XmlComponent { + constructor(options: IMathSuperScriptOptions) { + super("m:sSup"); + + this.root.push(new MathSuperScriptProperties()); + this.root.push(new MathBase(options.child)); + this.root.push(new MathSuperScriptElement(options.superScript)); + } +} diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 68fa7d00d4..60efb0da34 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -2,11 +2,11 @@ import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { IXmlableObject, XmlComponent } from "file/xml-components"; +import { File } from "../file"; +import { DeletedTextRun, InsertedTextRun } from "../track-revision"; import { PageBreak } from "./formatting/page-break"; import { Bookmark, HyperlinkRef } from "./links"; import { Math } from "./math"; -import { File } from "../file"; -import { InsertedTextRun, DeletedTextRun } from "../track-revision"; import { IParagraphPropertiesOptions, ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run"; diff --git a/src/file/settings/settings.ts b/src/file/settings/settings.ts index 2fa4a27f0a..d828d21fb5 100644 --- a/src/file/settings/settings.ts +++ b/src/file/settings/settings.ts @@ -1,7 +1,7 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { Compatibility } from "./compatibility"; -import { UpdateFields } from "./update-fields"; import { TrackRevisions } from "./track-revisions"; +import { UpdateFields } from "./update-fields"; export interface ISettingsAttributesProperties { readonly wpc?: string; @@ -46,8 +46,8 @@ export class SettingsAttributes extends XmlAttributeComponent { describe("#constructor", () => { diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.ts b/src/file/track-revision/track-revision-components/deleted-text-run.ts index 2342f70104..56d384b31b 100644 --- a/src/file/track-revision/track-revision-components/deleted-text-run.ts +++ b/src/file/track-revision/track-revision-components/deleted-text-run.ts @@ -1,12 +1,11 @@ -import { IChangedAttributesProperties, ChangeAttributes } from "../track-revision"; import { XmlComponent } from "file/xml-components"; -import { IRunOptions, RunProperties, IRunPropertiesOptions, FootnoteReferenceRun } from "../../index"; +import { FootnoteReferenceRun, IRunOptions, IRunPropertiesOptions, RunProperties } from "../../index"; import { Break } from "../../paragraph/run/break"; -import { Begin, Separate, End } from "../../paragraph/run/field"; +import { Begin, End, Separate } from "../../paragraph/run/field"; import { PageNumber } from "../../paragraph/run/run"; - -import { DeletedPage, DeletedNumberOfPages, DeletedNumberOfPagesSection } from "./deleted-page-number"; +import { ChangeAttributes, IChangedAttributesProperties } from "../track-revision"; +import { DeletedNumberOfPages, DeletedNumberOfPagesSection, DeletedPage } from "./deleted-page-number"; import { DeletedText } from "./deleted-text"; interface IDeletedRunOptions extends IRunPropertiesOptions, IChangedAttributesProperties { diff --git a/src/file/track-revision/track-revision-components/inserted-text-run.ts b/src/file/track-revision/track-revision-components/inserted-text-run.ts index 49bd7f53ae..3d39e92c1c 100644 --- a/src/file/track-revision/track-revision-components/inserted-text-run.ts +++ b/src/file/track-revision/track-revision-components/inserted-text-run.ts @@ -1,6 +1,7 @@ -import { IChangedAttributesProperties, ChangeAttributes } from "../track-revision"; import { XmlComponent } from "file/xml-components"; -import { TextRun, IRunOptions } from "../../index"; + +import { IRunOptions, TextRun } from "../../index"; +import { ChangeAttributes, IChangedAttributesProperties } from "../track-revision"; interface IInsertedRunOptions extends IChangedAttributesProperties, IRunOptions {} diff --git a/tslint.json b/tslint.json index d6eb606eba..cb979f920a 100644 --- a/tslint.json +++ b/tslint.json @@ -21,6 +21,8 @@ "no-duplicate-imports": true, "unnecessary-constructor": true, "file-name-casing": [true, "kebab-case"], + "interface-name": [true, "always-prefix"], + "ordered-imports": true, // Functional Programming Rules "no-parameter-reassignment": true, "readonly-keyword": true, From daea8d286811baf336d938d2541fb9b550c21b91 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 12 Oct 2020 22:13:03 +0100 Subject: [PATCH 031/107] Make fractions take math component --- demo/55-math.ts | 40 ++++++++----------- .../math/fraction/math-denominator.spec.ts | 3 +- .../math/fraction/math-denominator.ts | 6 +-- .../math/fraction/math-fraction.spec.ts | 7 ++-- .../paragraph/math/fraction/math-fraction.ts | 9 +++-- .../math/fraction/math-numerator.spec.ts | 3 +- .../paragraph/math/fraction/math-numerator.ts | 6 +-- 7 files changed, 35 insertions(+), 39 deletions(-) diff --git a/demo/55-math.ts b/demo/55-math.ts index 92993a695a..ad7473915c 100644 --- a/demo/55-math.ts +++ b/demo/55-math.ts @@ -6,10 +6,8 @@ import { Math, MathAngledBrackets, MathCurlyBrackets, - MathDenominator, MathFraction, MathFunction, - MathNumerator, MathPreSubSuperScript, MathRadical, MathRoundBrackets, @@ -35,8 +33,8 @@ doc.addSection({ children: [ new MathRun("2+2"), new MathFraction({ - numerator: new MathNumerator("hi"), - denominator: new MathDenominator("2"), + numerator: new MathRun("hi"), + denominator: new MathRun("2"), }), ], }), @@ -142,8 +140,8 @@ doc.addSection({ children: [ new MathSubScript({ child: new MathFraction({ - numerator: new MathNumerator("1"), - denominator: new MathDenominator("2"), + numerator: new MathRun("1"), + denominator: new MathRun("2"), }), subScript: new MathRun("4"), }), @@ -158,8 +156,8 @@ doc.addSection({ new MathSubScript({ child: new MathRadical({ child: new MathFraction({ - numerator: new MathNumerator("1"), - denominator: new MathDenominator("2"), + numerator: new MathRun("1"), + denominator: new MathRun("2"), }), degree: new MathRun("4"), }), @@ -207,26 +205,26 @@ doc.addSection({ children: [ new MathRoundBrackets({ child: new MathFraction({ - numerator: new MathNumerator("1"), - denominator: new MathDenominator("2"), + numerator: new MathRun("1"), + denominator: new MathRun("2"), }), }), new MathSquareBrackets({ child: new MathFraction({ - numerator: new MathNumerator("1"), - denominator: new MathDenominator("2"), + numerator: new MathRun("1"), + denominator: new MathRun("2"), }), }), new MathCurlyBrackets({ child: new MathFraction({ - numerator: new MathNumerator("1"), - denominator: new MathDenominator("2"), + numerator: new MathRun("1"), + denominator: new MathRun("2"), }), }), new MathAngledBrackets({ child: new MathFraction({ - numerator: new MathNumerator("1"), - denominator: new MathDenominator("2"), + numerator: new MathRun("1"), + denominator: new MathRun("2"), }), }), ], @@ -238,14 +236,10 @@ doc.addSection({ new Math({ children: [ new MathFraction({ - numerator: new Math({ - children: [ - new MathRadical({ - child: new MathRun("4"), - }), - ], + numerator: new MathRadical({ + child: new MathRun("4"), }), - demoninator: new MathRun("2a"), + denominator: new MathRun("2a"), }), ], }), diff --git a/src/file/paragraph/math/fraction/math-denominator.spec.ts b/src/file/paragraph/math/fraction/math-denominator.spec.ts index cca8ae0ee1..a5f50ce1ad 100644 --- a/src/file/paragraph/math/fraction/math-denominator.spec.ts +++ b/src/file/paragraph/math/fraction/math-denominator.spec.ts @@ -2,12 +2,13 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +import { MathRun } from "../math-run"; import { MathDenominator } from "./math-denominator"; describe("MathDenominator", () => { describe("#constructor()", () => { it("should create a MathDenominator with correct root key", () => { - const mathDenominator = new MathDenominator("2+2"); + const mathDenominator = new MathDenominator(new MathRun("2+2")); const tree = new Formatter().format(mathDenominator); expect(tree).to.deep.equal({ "m:den": [ diff --git a/src/file/paragraph/math/fraction/math-denominator.ts b/src/file/paragraph/math/fraction/math-denominator.ts index f640324c2e..db59eabc8c 100644 --- a/src/file/paragraph/math/fraction/math-denominator.ts +++ b/src/file/paragraph/math/fraction/math-denominator.ts @@ -1,11 +1,11 @@ import { XmlComponent } from "file/xml-components"; -import { MathRun } from "../math-run"; +import { MathComponent } from "../math-component"; export class MathDenominator extends XmlComponent { - constructor(text: string) { + constructor(child: MathComponent) { super("m:den"); - this.root.push(new MathRun(text)); + this.root.push(child); } } diff --git a/src/file/paragraph/math/fraction/math-fraction.spec.ts b/src/file/paragraph/math/fraction/math-fraction.spec.ts index 9a7386e85e..9ebd3c4bcd 100644 --- a/src/file/paragraph/math/fraction/math-fraction.spec.ts +++ b/src/file/paragraph/math/fraction/math-fraction.spec.ts @@ -2,16 +2,15 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; -import { MathDenominator } from "./math-denominator"; +import { MathRun } from "../math-run"; import { MathFraction } from "./math-fraction"; -import { MathNumerator } from "./math-numerator"; describe("MathFraction", () => { describe("#constructor()", () => { it("should create a MathFraction with correct root key", () => { const mathFraction = new MathFraction({ - numerator: new MathNumerator("2"), - denominator: new MathDenominator("2"), + numerator: new MathRun("2"), + denominator: new MathRun("2"), }); const tree = new Formatter().format(mathFraction); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/fraction/math-fraction.ts b/src/file/paragraph/math/fraction/math-fraction.ts index 574a989bba..65768a1fca 100644 --- a/src/file/paragraph/math/fraction/math-fraction.ts +++ b/src/file/paragraph/math/fraction/math-fraction.ts @@ -1,18 +1,19 @@ import { XmlComponent } from "file/xml-components"; +import { MathComponent } from "../math-component"; import { MathDenominator } from "./math-denominator"; import { MathNumerator } from "./math-numerator"; export interface IMathFractionOptions { - readonly numerator: MathNumerator; - readonly denominator: MathDenominator; + readonly numerator: MathComponent; + readonly denominator: MathComponent; } export class MathFraction extends XmlComponent { constructor(options: IMathFractionOptions) { super("m:f"); - this.root.push(options.numerator); - this.root.push(options.denominator); + this.root.push(new MathNumerator(options.numerator)); + this.root.push(new MathDenominator(options.denominator)); } } diff --git a/src/file/paragraph/math/fraction/math-numerator.spec.ts b/src/file/paragraph/math/fraction/math-numerator.spec.ts index 1cc5fc4aa4..862dc18938 100644 --- a/src/file/paragraph/math/fraction/math-numerator.spec.ts +++ b/src/file/paragraph/math/fraction/math-numerator.spec.ts @@ -2,12 +2,13 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; +import { MathRun } from "../math-run"; import { MathNumerator } from "./math-numerator"; describe("MathNumerator", () => { describe("#constructor()", () => { it("should create a MathNumerator with correct root key", () => { - const mathNumerator = new MathNumerator("2+2"); + const mathNumerator = new MathNumerator(new MathRun("2+2")); const tree = new Formatter().format(mathNumerator); expect(tree).to.deep.equal({ "m:num": [ diff --git a/src/file/paragraph/math/fraction/math-numerator.ts b/src/file/paragraph/math/fraction/math-numerator.ts index f7e68715b8..bad0ace36f 100644 --- a/src/file/paragraph/math/fraction/math-numerator.ts +++ b/src/file/paragraph/math/fraction/math-numerator.ts @@ -1,11 +1,11 @@ import { XmlComponent } from "file/xml-components"; -import { MathRun } from "../math-run"; +import { MathComponent } from "../math-component"; export class MathNumerator extends XmlComponent { - constructor(text: string) { + constructor(child: MathComponent) { super("m:num"); - this.root.push(new MathRun(text)); + this.root.push(child); } } From 102d6aa55c6341a372c5e7c73cec7b9c71a32e3b Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 12 Oct 2020 22:48:38 +0100 Subject: [PATCH 032/107] Add prepForXml test --- src/file/paragraph/paragraph.spec.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 04cc8af8e4..0b8e9acd00 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -5,8 +5,9 @@ import { stub } from "sinon"; import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; +import { File } from "../file"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; -import { Bookmark } from "./links"; +import { Bookmark, HyperlinkRef } from "./links"; import { Paragraph } from "./paragraph"; describe("Paragraph", () => { @@ -759,4 +760,23 @@ describe("Paragraph", () => { }); }); }); + + describe("#prepForXml", () => { + it("should set paragraph outline level to the given value", () => { + const paragraph = new Paragraph({ + children: [new HyperlinkRef("myAnchorId")], + }); + const fileMock = ({ + HyperlinkCache: { + myAnchorId: "test", + }, + // tslint:disable-next-line: no-any + } as any) as File; + paragraph.prepForXml(fileMock); + const tree = new Formatter().format(paragraph); + expect(tree).to.deep.equal({ + "w:p": ["test"], + }); + }); + }); }); From e36e9e1cf4e3f8a86646e44862295b4e15072dce Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 13 Oct 2020 01:23:27 +0100 Subject: [PATCH 033/107] Add initial math documentation --- docs/_sidebar.md | 1 + docs/images/math-example.png | Bin 0 -> 16782 bytes docs/usage/math.md | 126 +++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 docs/images/math-example.png create mode 100644 docs/usage/math.md diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 5d2ba31551..bcdb03c55f 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -21,6 +21,7 @@ * [Table of Contents](usage/table-of-contents.md) * [Page Numbers](usage/page-numbers.md) * [Change Tracking](usage/change-tracking.md) + * [Math](usage/math.md) * Styling * [Styling with JS](usage/styling-with-js.md) * [Styling with XML](usage/styling-with-xml.md) diff --git a/docs/images/math-example.png b/docs/images/math-example.png new file mode 100644 index 0000000000000000000000000000000000000000..c92f8806f93c1639be5750c3252766494b53d83e GIT binary patch literal 16782 zcmeIZWmr{Tw?4etY!IYDK)OS^OG=P#5Rfh@N$D;X1SzFNQc^mlQyP@+mhSF+=k|Hd zbAIRl|L}f#zr5Gsx|VzGz1FNT$GFEB_n3yND$8IzBz_2iKrrNFpQ}S42xs6DM?nU^ zD0>)=LLlg-){>H{a*~pis!k3T*0$ylh-_$F!h@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~RpWOi~V>#VS5Y;)kSvQ=+UVFl?0K7I3KK74WLT5MU_f&g;ru zB>~zF0UBwW+Vh>^L^R7?Q6&u@OAtZU`@pI!kqIb;v@w|a(XawL5npO*Dq9F9*=K;? zv!%*~NF_~I`97dBcrWBLTl0p?VZOnCcRA@FXn=}c<9VDT45ANpUESA{S0L!g2FJC6 zSIY>#S9h3OScF|Utb*vrn#-&+ytn>B2>4a+0D`1E>VSY_DEv4I2Kb*rUA;gpQ}zW$ zm%zX*4vnW;aaESTztVwlrMNtetQ8x0gR=f#xIon@(~E<&n~Uy20E46F01kbT0#X9R zkR)ZosVUdz`&eQy26cGc{W&d-Lgkor8}1I;K6VY_h*Q==x13#1FYAW1^z~V4Yip%D zICnu|xz6YKH$VLNPN-w03Y$HB>*7@L$A?) z?quAvlDvY}=TC=0!it{PmBt1&$O zvIcO|AG&42y+y}nKQ~%n%FV?!DG)T;ph|&v8vPi+&UED` z5I$F9M!m5HTgOW|0v{EaX&tacgW(gn;ecWOGa&qHItW`P=#<3%zK3G$vB>#WW ck_)VEoZo7vSKYOMGKR=WDL*fkFb?{E0Hh44Y5)KL literal 0 HcmV?d00001 diff --git a/docs/usage/math.md b/docs/usage/math.md new file mode 100644 index 0000000000..e38f393ac9 --- /dev/null +++ b/docs/usage/math.md @@ -0,0 +1,126 @@ +# Math + +!> Math requires an understanding of [Sections](usage/sections.md) and [Paragraphs](usage/paragraph.md). + +## Intro + +- To add math, create a `Math` object +- Add `MathComponents` inside `Math` +- `MathComponents` can have nested `MathComponents` inside. e.g. A fraction where the numerator is a square root, and the demoninator as another fraction. More on `MathComponents` below + +## Example + +```ts +new Math({ + children: [ + new MathRun("2+2"), + new MathFraction({ + numerator: [new MathRun("hi")], + denominator: [new MathRun("2")], + }), + ], +}), +``` + +This will produce: + +

+ clippy the assistant +

+ +## Math Components + +`MathComponents` are the unit sized building blocks of an equation in `docx`. A `MathComponent` takes in more nested `MathComponents` until you reach `MathRun`, which has no children. `MathRun` is similar to a [TextRun](usage/text.md). + +### Math Run + +`MathRun` is the most basic `MathComponent`. + +#### Example + +```ts +new MathRun("2+2"); +``` + +```ts +new MathRun("hello"); +``` + +An example of it being used inside `Math`: + +```ts +new Math({ + children: [ + new MathRun("2"), + new MathRun("+"), + new MathRun("2"), + ], +}), +``` + +### Math Fraction + +`MathFractions` require a `numerator` and a `demoninator`, which are both a list of `MathComponents` + +#### Example + +```ts +new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], +}), +``` + +```ts +new MathFraction({ + numerator: [ + new MathRun("1"), + new MathRadical({ + child: [new MathRun("2")], + }), + ], + denominator: [new MathRun("2")], +}), +``` + +An example of it being used inside `Math`: + +```ts +new Math({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + new MathText("+"), + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + new MathText("= 1"), + ], +}), +``` + +### Sum + +A `MathComponent` for `Σ`. It can take a `superScript` and/or `subScript` as arguments to add `MathComponents` (usually limits) on the top and bottom + +```ts +new MathSum({ + child: [new MathRun("i")], +}), +``` + +```ts +new MathSum({ + child: [ + new MathSuperScript({ + child: new MathRun("e"), + superScript: new MathRun("2"), + }) + ], + subScript: [new MathRun("i")], + superScript: [new MathRun("10")], +}), +``` From 5be195fd9115beaad6d1100bd83d88612e096bdd Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 13 Oct 2020 02:06:27 +0100 Subject: [PATCH 034/107] Turn math component into array --- demo/55-math.ts | 193 +++++++++++------- .../brackets/math-angled-brackets.spec.ts | 2 +- .../math/brackets/math-angled-brackets.ts | 4 +- .../math/brackets/math-curly-brackets.spec.ts | 2 +- .../math/brackets/math-curly-brackets.ts | 4 +- .../math/brackets/math-round-brackets.spec.ts | 2 +- .../math/brackets/math-round-brackets.ts | 4 +- .../brackets/math-square-brackets.spec.ts | 2 +- .../math/brackets/math-square-brackets.ts | 4 +- .../math/fraction/math-denominator.spec.ts | 2 +- .../math/fraction/math-denominator.ts | 6 +- .../math/fraction/math-fraction.spec.ts | 4 +- .../paragraph/math/fraction/math-fraction.ts | 4 +- .../math/fraction/math-numerator.spec.ts | 2 +- .../paragraph/math/fraction/math-numerator.ts | 6 +- .../math/function/math-function-name.spec.ts | 2 +- .../math/function/math-function-name.ts | 6 +- .../math/function/math-function.spec.ts | 4 +- .../paragraph/math/function/math-function.ts | 6 +- .../paragraph/math/n-ary/math-base.spec.ts | 2 +- src/file/paragraph/math/n-ary/math-base.ts | 6 +- .../math/n-ary/math-sub-script.spec.ts | 2 +- .../paragraph/math/n-ary/math-sub-script.ts | 6 +- .../paragraph/math/n-ary/math-sum.spec.ts | 6 +- src/file/paragraph/math/n-ary/math-sum.ts | 8 +- .../math/n-ary/math-super-script.spec.ts | 2 +- .../paragraph/math/n-ary/math-super-script.ts | 6 +- .../math/radical/math-degree.spec.ts | 2 +- .../paragraph/math/radical/math-degree.ts | 8 +- .../math/radical/math-radical.spec.ts | 4 +- .../paragraph/math/radical/math-radical.ts | 6 +- ...math-pre-sub-super-script-function.spec.ts | 6 +- .../math-pre-sub-super-script-function.ts | 8 +- .../math-sub-script-function.spec.ts | 4 +- .../sub-script/math-sub-script-function.ts | 6 +- .../math-sub-super-script-function.spec.ts | 6 +- .../math-sub-super-script-function.ts | 8 +- .../math-super-script-function.spec.ts | 4 +- .../math-super-script-function.ts | 6 +- 39 files changed, 208 insertions(+), 157 deletions(-) diff --git a/demo/55-math.ts b/demo/55-math.ts index ad7473915c..3dc6c1a17c 100644 --- a/demo/55-math.ts +++ b/demo/55-math.ts @@ -33,8 +33,8 @@ doc.addSection({ children: [ new MathRun("2+2"), new MathFraction({ - numerator: new MathRun("hi"), - denominator: new MathRun("2"), + numerator: [new MathRun("hi")], + denominator: [new MathRun("2")], }), ], }), @@ -44,26 +44,43 @@ doc.addSection({ }), ], }), + // new Paragraph({ + // children: [ + // new MathFraction({ + // numerator: [ + // new MathRun("1"), + // new MathRadical({ + // children: [new MathRun("2")], + // }), + // ], + // denominator: [new MathRun("2")], + // }), + // ], + // }), new Paragraph({ children: [ new Math({ children: [ new MathSum({ - child: new MathRun("test"), + children: [new MathRun("test")], }), new MathSum({ - child: new MathSuperScript({ - child: new MathRun("e"), - superScript: new MathRun("2"), - }), - subScript: new MathRun("i"), + children: [ + new MathSuperScript({ + children: [new MathRun("e")], + superScript: [new MathRun("2")], + }), + ], + subScript: [new MathRun("i")], }), new MathSum({ - child: new MathRadical({ - child: new MathRun("i"), - }), - subScript: new MathRun("i"), - superScript: new MathRun("10"), + children: [ + new MathRadical({ + children: [new MathRun("i")], + }), + ], + subScript: [new MathRun("i")], + superScript: [new MathRun("10")], }), ], }), @@ -74,8 +91,8 @@ doc.addSection({ new Math({ children: [ new MathSuperScript({ - child: new MathRun("test"), - superScript: new MathRun("hello"), + children: [new MathRun("test")], + superScript: [new MathRun("hello")], }), ], }), @@ -86,8 +103,8 @@ doc.addSection({ new Math({ children: [ new MathSubScript({ - child: new MathRun("test"), - subScript: new MathRun("hello"), + children: [new MathRun("test")], + subScript: [new MathRun("hello")], }), ], }), @@ -98,11 +115,13 @@ doc.addSection({ new Math({ children: [ new MathSubScript({ - child: new MathRun("x"), - subScript: new MathSuperScript({ - child: new MathRun("y"), - superScript: new MathRun("2"), - }), + children: [new MathRun("x")], + subScript: [ + new MathSuperScript({ + children: [new MathRun("y")], + superScript: [new MathRun("2")], + }), + ], }), ], }), @@ -113,9 +132,9 @@ doc.addSection({ new Math({ children: [ new MathSubSuperScript({ - child: new MathRun("test"), - superScript: new MathRun("hello"), - subScript: new MathRun("world"), + children: [new MathRun("test")], + superScript: [new MathRun("hello")], + subScript: [new MathRun("world")], }), ], }), @@ -126,9 +145,9 @@ doc.addSection({ new Math({ children: [ new MathPreSubSuperScript({ - child: new MathRun("test"), - superScript: new MathRun("hello"), - subScript: new MathRun("world"), + children: [new MathRun("test")], + superScript: [new MathRun("hello")], + subScript: [new MathRun("world")], }), ], }), @@ -139,29 +158,35 @@ doc.addSection({ new Math({ children: [ new MathSubScript({ - child: new MathFraction({ - numerator: new MathRun("1"), - denominator: new MathRun("2"), - }), - subScript: new MathRun("4"), - }), - ], - }), - ], - }), - new Paragraph({ - children: [ - new Math({ - children: [ - new MathSubScript({ - child: new MathRadical({ - child: new MathFraction({ - numerator: new MathRun("1"), - denominator: new MathRun("2"), + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], }), - degree: new MathRun("4"), - }), - subScript: new MathRun("x"), + ], + subScript: [new MathRun("4")], + }), + ], + }), + ], + }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathSubScript({ + children: [ + new MathRadical({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], + degree: [new MathRun("4")], + }), + ], + subScript: [new MathRun("x")], }), ], }), @@ -172,7 +197,7 @@ doc.addSection({ new Math({ children: [ new MathRadical({ - child: new MathRun("4"), + children: [new MathRun("4")], }), ], }), @@ -183,16 +208,18 @@ doc.addSection({ new Math({ children: [ new MathFunction({ - name: new MathSuperScript({ - child: new MathRun("cos"), - superScript: new MathRun("-1"), - }), - child: new MathRun("100"), + name: [ + new MathSuperScript({ + children: [new MathRun("cos")], + superScript: [new MathRun("-1")], + }), + ], + children: [new MathRun("100")], }), new MathRun("×"), new MathFunction({ - name: new MathRun("sin"), - child: new MathRun("360"), + name: [new MathRun("sin")], + children: [new MathRun("360")], }), new MathRun("= x"), ], @@ -204,28 +231,36 @@ doc.addSection({ new Math({ children: [ new MathRoundBrackets({ - child: new MathFraction({ - numerator: new MathRun("1"), - denominator: new MathRun("2"), - }), + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], }), new MathSquareBrackets({ - child: new MathFraction({ - numerator: new MathRun("1"), - denominator: new MathRun("2"), - }), + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], }), new MathCurlyBrackets({ - child: new MathFraction({ - numerator: new MathRun("1"), - denominator: new MathRun("2"), - }), + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], }), new MathAngledBrackets({ - child: new MathFraction({ - numerator: new MathRun("1"), - denominator: new MathRun("2"), - }), + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], }), ], }), @@ -236,10 +271,12 @@ doc.addSection({ new Math({ children: [ new MathFraction({ - numerator: new MathRadical({ - child: new MathRun("4"), - }), - denominator: new MathRun("2a"), + numerator: [ + new MathRadical({ + children: [new MathRun("4")], + }), + ], + denominator: [new MathRun("2a")], }), ], }), diff --git a/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts b/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts index 735e0da272..ccd73b192b 100644 --- a/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts +++ b/src/file/paragraph/math/brackets/math-angled-brackets.spec.ts @@ -9,7 +9,7 @@ describe("MathAngledBrackets", () => { describe("#constructor()", () => { it("should create a MathAngledBrackets with correct root key", () => { const mathAngledBrackets = new MathAngledBrackets({ - child: new MathRun("60"), + children: [new MathRun("60")], }); const tree = new Formatter().format(mathAngledBrackets); diff --git a/src/file/paragraph/math/brackets/math-angled-brackets.ts b/src/file/paragraph/math/brackets/math-angled-brackets.ts index fbafb7e738..48fe0d415d 100644 --- a/src/file/paragraph/math/brackets/math-angled-brackets.ts +++ b/src/file/paragraph/math/brackets/math-angled-brackets.ts @@ -6,7 +6,7 @@ import { MathBase } from "../n-ary"; import { MathBracketProperties } from "./math-bracket-properties"; export class MathAngledBrackets extends XmlComponent { - constructor(options: { readonly child: MathComponent }) { + constructor(options: { readonly children: MathComponent[] }) { super("m:d"); this.root.push( @@ -15,6 +15,6 @@ export class MathAngledBrackets extends XmlComponent { endingCharacter: "〉", }), ); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts b/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts index 6e44621b21..d6defd57ef 100644 --- a/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts +++ b/src/file/paragraph/math/brackets/math-curly-brackets.spec.ts @@ -9,7 +9,7 @@ describe("MathCurlyBrackets", () => { describe("#constructor()", () => { it("should create a MathCurlyBrackets with correct root key", () => { const mathCurlyBrackets = new MathCurlyBrackets({ - child: new MathRun("60"), + children: [new MathRun("60")], }); const tree = new Formatter().format(mathCurlyBrackets); diff --git a/src/file/paragraph/math/brackets/math-curly-brackets.ts b/src/file/paragraph/math/brackets/math-curly-brackets.ts index 4d540ec8bc..ccce71e6a7 100644 --- a/src/file/paragraph/math/brackets/math-curly-brackets.ts +++ b/src/file/paragraph/math/brackets/math-curly-brackets.ts @@ -6,7 +6,7 @@ import { MathBase } from "../n-ary"; import { MathBracketProperties } from "./math-bracket-properties"; export class MathCurlyBrackets extends XmlComponent { - constructor(options: { readonly child: MathComponent }) { + constructor(options: { readonly children: MathComponent[] }) { super("m:d"); this.root.push( @@ -15,6 +15,6 @@ export class MathCurlyBrackets extends XmlComponent { endingCharacter: "}", }), ); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/brackets/math-round-brackets.spec.ts b/src/file/paragraph/math/brackets/math-round-brackets.spec.ts index cb28126a20..5138e9d085 100644 --- a/src/file/paragraph/math/brackets/math-round-brackets.spec.ts +++ b/src/file/paragraph/math/brackets/math-round-brackets.spec.ts @@ -9,7 +9,7 @@ describe("MathRoundBrackets", () => { describe("#constructor()", () => { it("should create a MathRoundBrackets with correct root key", () => { const mathRoundBrackets = new MathRoundBrackets({ - child: new MathRun("60"), + children: [new MathRun("60")], }); const tree = new Formatter().format(mathRoundBrackets); diff --git a/src/file/paragraph/math/brackets/math-round-brackets.ts b/src/file/paragraph/math/brackets/math-round-brackets.ts index 2302fa30f1..6fe60318a4 100644 --- a/src/file/paragraph/math/brackets/math-round-brackets.ts +++ b/src/file/paragraph/math/brackets/math-round-brackets.ts @@ -6,10 +6,10 @@ import { MathBase } from "../n-ary"; import { MathBracketProperties } from "./math-bracket-properties"; export class MathRoundBrackets extends XmlComponent { - constructor(options: { readonly child: MathComponent }) { + constructor(options: { readonly children: MathComponent[] }) { super("m:d"); this.root.push(new MathBracketProperties()); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/brackets/math-square-brackets.spec.ts b/src/file/paragraph/math/brackets/math-square-brackets.spec.ts index 03b8aef03d..b0e2ec9e26 100644 --- a/src/file/paragraph/math/brackets/math-square-brackets.spec.ts +++ b/src/file/paragraph/math/brackets/math-square-brackets.spec.ts @@ -9,7 +9,7 @@ describe("MathSquareBrackets", () => { describe("#constructor()", () => { it("should create a MathSquareBrackets with correct root key", () => { const mathSquareBrackets = new MathSquareBrackets({ - child: new MathRun("60"), + children: [new MathRun("60")], }); const tree = new Formatter().format(mathSquareBrackets); diff --git a/src/file/paragraph/math/brackets/math-square-brackets.ts b/src/file/paragraph/math/brackets/math-square-brackets.ts index 3c3d385357..fdfe88a004 100644 --- a/src/file/paragraph/math/brackets/math-square-brackets.ts +++ b/src/file/paragraph/math/brackets/math-square-brackets.ts @@ -6,7 +6,7 @@ import { MathBase } from "../n-ary"; import { MathBracketProperties } from "./math-bracket-properties"; export class MathSquareBrackets extends XmlComponent { - constructor(options: { readonly child: MathComponent }) { + constructor(options: { readonly children: MathComponent[] }) { super("m:d"); this.root.push( @@ -15,6 +15,6 @@ export class MathSquareBrackets extends XmlComponent { endingCharacter: "]", }), ); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/fraction/math-denominator.spec.ts b/src/file/paragraph/math/fraction/math-denominator.spec.ts index a5f50ce1ad..f2e7459e1e 100644 --- a/src/file/paragraph/math/fraction/math-denominator.spec.ts +++ b/src/file/paragraph/math/fraction/math-denominator.spec.ts @@ -8,7 +8,7 @@ import { MathDenominator } from "./math-denominator"; describe("MathDenominator", () => { describe("#constructor()", () => { it("should create a MathDenominator with correct root key", () => { - const mathDenominator = new MathDenominator(new MathRun("2+2")); + const mathDenominator = new MathDenominator([new MathRun("2+2")]); const tree = new Formatter().format(mathDenominator); expect(tree).to.deep.equal({ "m:den": [ diff --git a/src/file/paragraph/math/fraction/math-denominator.ts b/src/file/paragraph/math/fraction/math-denominator.ts index db59eabc8c..8df68bf4b0 100644 --- a/src/file/paragraph/math/fraction/math-denominator.ts +++ b/src/file/paragraph/math/fraction/math-denominator.ts @@ -3,9 +3,11 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathDenominator extends XmlComponent { - constructor(child: MathComponent) { + constructor(children: MathComponent[]) { super("m:den"); - this.root.push(child); + for (const child of children) { + this.root.push(child); + } } } diff --git a/src/file/paragraph/math/fraction/math-fraction.spec.ts b/src/file/paragraph/math/fraction/math-fraction.spec.ts index 9ebd3c4bcd..51cac646bf 100644 --- a/src/file/paragraph/math/fraction/math-fraction.spec.ts +++ b/src/file/paragraph/math/fraction/math-fraction.spec.ts @@ -9,8 +9,8 @@ describe("MathFraction", () => { describe("#constructor()", () => { it("should create a MathFraction with correct root key", () => { const mathFraction = new MathFraction({ - numerator: new MathRun("2"), - denominator: new MathRun("2"), + numerator: [new MathRun("2")], + denominator: [new MathRun("2")], }); const tree = new Formatter().format(mathFraction); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/fraction/math-fraction.ts b/src/file/paragraph/math/fraction/math-fraction.ts index 65768a1fca..84a803a872 100644 --- a/src/file/paragraph/math/fraction/math-fraction.ts +++ b/src/file/paragraph/math/fraction/math-fraction.ts @@ -5,8 +5,8 @@ import { MathDenominator } from "./math-denominator"; import { MathNumerator } from "./math-numerator"; export interface IMathFractionOptions { - readonly numerator: MathComponent; - readonly denominator: MathComponent; + readonly numerator: MathComponent[]; + readonly denominator: MathComponent[]; } export class MathFraction extends XmlComponent { diff --git a/src/file/paragraph/math/fraction/math-numerator.spec.ts b/src/file/paragraph/math/fraction/math-numerator.spec.ts index 862dc18938..e3aaf35c0e 100644 --- a/src/file/paragraph/math/fraction/math-numerator.spec.ts +++ b/src/file/paragraph/math/fraction/math-numerator.spec.ts @@ -8,7 +8,7 @@ import { MathNumerator } from "./math-numerator"; describe("MathNumerator", () => { describe("#constructor()", () => { it("should create a MathNumerator with correct root key", () => { - const mathNumerator = new MathNumerator(new MathRun("2+2")); + const mathNumerator = new MathNumerator([new MathRun("2+2")]); const tree = new Formatter().format(mathNumerator); expect(tree).to.deep.equal({ "m:num": [ diff --git a/src/file/paragraph/math/fraction/math-numerator.ts b/src/file/paragraph/math/fraction/math-numerator.ts index bad0ace36f..b7a49d9a75 100644 --- a/src/file/paragraph/math/fraction/math-numerator.ts +++ b/src/file/paragraph/math/fraction/math-numerator.ts @@ -3,9 +3,11 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathNumerator extends XmlComponent { - constructor(child: MathComponent) { + constructor(children: MathComponent[]) { super("m:num"); - this.root.push(child); + for (const child of children) { + this.root.push(child); + } } } diff --git a/src/file/paragraph/math/function/math-function-name.spec.ts b/src/file/paragraph/math/function/math-function-name.spec.ts index bdb38d7596..8a37ee998e 100644 --- a/src/file/paragraph/math/function/math-function-name.spec.ts +++ b/src/file/paragraph/math/function/math-function-name.spec.ts @@ -8,7 +8,7 @@ import { MathFunctionName } from "./math-function-name"; describe("MathFunctionName", () => { describe("#constructor()", () => { it("should create a MathFunctionName with correct root key", () => { - const mathFunctionName = new MathFunctionName(new MathRun("2")); + const mathFunctionName = new MathFunctionName([new MathRun("2")]); const tree = new Formatter().format(mathFunctionName); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/function/math-function-name.ts b/src/file/paragraph/math/function/math-function-name.ts index 011e82133a..e58488dd28 100644 --- a/src/file/paragraph/math/function/math-function-name.ts +++ b/src/file/paragraph/math/function/math-function-name.ts @@ -3,9 +3,11 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathFunctionName extends XmlComponent { - constructor(child: MathComponent) { + constructor(children: MathComponent[]) { super("m:fName"); - this.root.push(child); + for (const child of children) { + this.root.push(child); + } } } diff --git a/src/file/paragraph/math/function/math-function.spec.ts b/src/file/paragraph/math/function/math-function.spec.ts index 4320a853c6..6ea02b6c9d 100644 --- a/src/file/paragraph/math/function/math-function.spec.ts +++ b/src/file/paragraph/math/function/math-function.spec.ts @@ -9,8 +9,8 @@ describe("MathFunction", () => { describe("#constructor()", () => { it("should create a MathFunction with correct root key", () => { const mathFunction = new MathFunction({ - name: new MathRun("sin"), - child: new MathRun("60"), + name: [new MathRun("sin")], + children: [new MathRun("60")], }); const tree = new Formatter().format(mathFunction); diff --git a/src/file/paragraph/math/function/math-function.ts b/src/file/paragraph/math/function/math-function.ts index b3de75ddb8..86b66392cc 100644 --- a/src/file/paragraph/math/function/math-function.ts +++ b/src/file/paragraph/math/function/math-function.ts @@ -7,8 +7,8 @@ import { MathFunctionName } from "./math-function-name"; import { MathFunctionProperties } from "./math-function-properties"; export interface IMathFunctionOptions { - readonly child: MathComponent; - readonly name: MathComponent; + readonly children: MathComponent[]; + readonly name: MathComponent[]; } export class MathFunction extends XmlComponent { @@ -17,6 +17,6 @@ export class MathFunction extends XmlComponent { this.root.push(new MathFunctionProperties()); this.root.push(new MathFunctionName(options.name)); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/n-ary/math-base.spec.ts b/src/file/paragraph/math/n-ary/math-base.spec.ts index 012147c4d9..c282537970 100644 --- a/src/file/paragraph/math/n-ary/math-base.spec.ts +++ b/src/file/paragraph/math/n-ary/math-base.spec.ts @@ -8,7 +8,7 @@ import { MathBase } from "./math-base"; describe("MathBase", () => { describe("#constructor()", () => { it("should create a MathBase with correct root key", () => { - const mathBase = new MathBase(new MathRun("2+2")); + const mathBase = new MathBase([new MathRun("2+2")]); const tree = new Formatter().format(mathBase); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/n-ary/math-base.ts b/src/file/paragraph/math/n-ary/math-base.ts index 7c06a67c23..6c2320439f 100644 --- a/src/file/paragraph/math/n-ary/math-base.ts +++ b/src/file/paragraph/math/n-ary/math-base.ts @@ -4,9 +4,11 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathBase extends XmlComponent { - constructor(run: MathComponent) { + constructor(children: MathComponent[]) { super("m:e"); - this.root.push(run); + for (const child of children) { + this.root.push(child); + } } } diff --git a/src/file/paragraph/math/n-ary/math-sub-script.spec.ts b/src/file/paragraph/math/n-ary/math-sub-script.spec.ts index 5a4009811e..d342946b74 100644 --- a/src/file/paragraph/math/n-ary/math-sub-script.spec.ts +++ b/src/file/paragraph/math/n-ary/math-sub-script.spec.ts @@ -8,7 +8,7 @@ import { MathSubScriptElement } from "./math-sub-script"; describe("MathSubScriptElement", () => { describe("#constructor()", () => { it("should create a MathSubScriptElement with correct root key", () => { - const mathSubScriptElement = new MathSubScriptElement(new MathRun("2+2")); + const mathSubScriptElement = new MathSubScriptElement([new MathRun("2+2")]); const tree = new Formatter().format(mathSubScriptElement); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/n-ary/math-sub-script.ts b/src/file/paragraph/math/n-ary/math-sub-script.ts index aaa8530e74..48268312cf 100644 --- a/src/file/paragraph/math/n-ary/math-sub-script.ts +++ b/src/file/paragraph/math/n-ary/math-sub-script.ts @@ -4,9 +4,11 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathSubScriptElement extends XmlComponent { - constructor(child: MathComponent) { + constructor(children: MathComponent[]) { super("m:sub"); - this.root.push(child); + for (const child of children) { + this.root.push(child); + } } } diff --git a/src/file/paragraph/math/n-ary/math-sum.spec.ts b/src/file/paragraph/math/n-ary/math-sum.spec.ts index 9f0d213aa4..1e76815147 100644 --- a/src/file/paragraph/math/n-ary/math-sum.spec.ts +++ b/src/file/paragraph/math/n-ary/math-sum.spec.ts @@ -9,9 +9,9 @@ describe("MathSum", () => { describe("#constructor()", () => { it("should create a MathSum with correct root key", () => { const mathSum = new MathSum({ - child: new MathRun("1"), - subScript: new MathRun("2"), - superScript: new MathRun("3"), + children: [new MathRun("1")], + subScript: [new MathRun("2")], + superScript: [new MathRun("3")], }); const tree = new Formatter().format(mathSum); diff --git a/src/file/paragraph/math/n-ary/math-sum.ts b/src/file/paragraph/math/n-ary/math-sum.ts index a16603982d..af14730bbf 100644 --- a/src/file/paragraph/math/n-ary/math-sum.ts +++ b/src/file/paragraph/math/n-ary/math-sum.ts @@ -8,9 +8,9 @@ import { MathSubScriptElement } from "./math-sub-script"; import { MathSuperScriptElement } from "./math-super-script"; export interface IMathSumOptions { - readonly child: MathComponent; - readonly subScript?: MathComponent; - readonly superScript?: MathComponent; + readonly children: MathComponent[]; + readonly subScript?: MathComponent[]; + readonly superScript?: MathComponent[]; } export class MathSum extends XmlComponent { @@ -27,6 +27,6 @@ export class MathSum extends XmlComponent { this.root.push(new MathSuperScriptElement(options.superScript)); } - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/n-ary/math-super-script.spec.ts b/src/file/paragraph/math/n-ary/math-super-script.spec.ts index 85a5195c0f..10e037eba3 100644 --- a/src/file/paragraph/math/n-ary/math-super-script.spec.ts +++ b/src/file/paragraph/math/n-ary/math-super-script.spec.ts @@ -8,7 +8,7 @@ import { MathSuperScriptElement } from "./math-super-script"; describe("MathSuperScriptElement", () => { describe("#constructor()", () => { it("should create a MathSuperScriptElement with correct root key", () => { - const mathSuperScriptElement = new MathSuperScriptElement(new MathRun("2+2")); + const mathSuperScriptElement = new MathSuperScriptElement([new MathRun("2+2")]); const tree = new Formatter().format(mathSuperScriptElement); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/n-ary/math-super-script.ts b/src/file/paragraph/math/n-ary/math-super-script.ts index 1d29bda52b..8d8386addc 100644 --- a/src/file/paragraph/math/n-ary/math-super-script.ts +++ b/src/file/paragraph/math/n-ary/math-super-script.ts @@ -4,9 +4,11 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathSuperScriptElement extends XmlComponent { - constructor(child: MathComponent) { + constructor(children: MathComponent[]) { super("m:sup"); - this.root.push(child); + for (const child of children) { + this.root.push(child); + } } } diff --git a/src/file/paragraph/math/radical/math-degree.spec.ts b/src/file/paragraph/math/radical/math-degree.spec.ts index 6a1c28656b..3d1f17dfa8 100644 --- a/src/file/paragraph/math/radical/math-degree.spec.ts +++ b/src/file/paragraph/math/radical/math-degree.spec.ts @@ -17,7 +17,7 @@ describe("MathDegree", () => { }); it("should create a MathDegree with correct root key with child", () => { - const mathDegree = new MathDegree(new MathRun("2")); + const mathDegree = new MathDegree([new MathRun("2")]); const tree = new Formatter().format(mathDegree); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/math/radical/math-degree.ts b/src/file/paragraph/math/radical/math-degree.ts index 402ee8ffda..79923bbde8 100644 --- a/src/file/paragraph/math/radical/math-degree.ts +++ b/src/file/paragraph/math/radical/math-degree.ts @@ -3,11 +3,13 @@ import { XmlComponent } from "file/xml-components"; import { MathComponent } from "../math-component"; export class MathDegree extends XmlComponent { - constructor(child?: MathComponent) { + constructor(children?: MathComponent[]) { super("m:deg"); - if (!!child) { - this.root.push(child); + if (!!children) { + for (const child of children) { + this.root.push(child); + } } } } diff --git a/src/file/paragraph/math/radical/math-radical.spec.ts b/src/file/paragraph/math/radical/math-radical.spec.ts index 7d7d7c4225..e388edece4 100644 --- a/src/file/paragraph/math/radical/math-radical.spec.ts +++ b/src/file/paragraph/math/radical/math-radical.spec.ts @@ -9,8 +9,8 @@ describe("MathRadical", () => { describe("#constructor()", () => { it("should create a MathRadical with correct root key", () => { const mathRadical = new MathRadical({ - child: new MathRun("e"), - degree: new MathRun("2"), + children: [new MathRun("e")], + degree: [new MathRun("2")], }); const tree = new Formatter().format(mathRadical); diff --git a/src/file/paragraph/math/radical/math-radical.ts b/src/file/paragraph/math/radical/math-radical.ts index 76fc2dc7ca..1469867a5f 100644 --- a/src/file/paragraph/math/radical/math-radical.ts +++ b/src/file/paragraph/math/radical/math-radical.ts @@ -7,8 +7,8 @@ import { MathDegree } from "./math-degree"; import { MathRadicalProperties } from "./math-radical-properties"; export interface IMathRadicalOptions { - readonly child: MathComponent; - readonly degree?: MathComponent; + readonly children: MathComponent[]; + readonly degree?: MathComponent[]; } export class MathRadical extends XmlComponent { @@ -17,6 +17,6 @@ export class MathRadical extends XmlComponent { this.root.push(new MathRadicalProperties(!!options.degree)); this.root.push(new MathDegree(options.degree)); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); } } diff --git a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts index 956a2ff445..20d00a639d 100644 --- a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts +++ b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.spec.ts @@ -9,9 +9,9 @@ describe("MathPreSubScript", () => { describe("#constructor()", () => { it("should create a MathPreSubScript with correct root key", () => { const mathPreSubScript = new MathPreSubSuperScript({ - child: new MathRun("e"), - subScript: new MathRun("2"), - superScript: new MathRun("5"), + children: [new MathRun("e")], + subScript: [new MathRun("2")], + superScript: [new MathRun("5")], }); const tree = new Formatter().format(mathPreSubScript); diff --git a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts index a0bdc321a0..3a58675b0f 100644 --- a/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts +++ b/src/file/paragraph/math/script/pre-sub-super-script/math-pre-sub-super-script-function.ts @@ -6,9 +6,9 @@ import { MathBase, MathSubScriptElement, MathSuperScriptElement } from "../../n- import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties"; export interface IMathPreSubSuperScriptOptions { - readonly child: MathComponent; - readonly subScript: MathComponent; - readonly superScript: MathComponent; + readonly children: MathComponent[]; + readonly subScript: MathComponent[]; + readonly superScript: MathComponent[]; } export class MathPreSubSuperScript extends XmlComponent { @@ -16,7 +16,7 @@ export class MathPreSubSuperScript extends XmlComponent { super("m:sPre"); this.root.push(new MathPreSubSuperScriptProperties()); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); this.root.push(new MathSubScriptElement(options.subScript)); this.root.push(new MathSuperScriptElement(options.superScript)); } diff --git a/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts b/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts index dd33598d81..a3ea8d680c 100644 --- a/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts +++ b/src/file/paragraph/math/script/sub-script/math-sub-script-function.spec.ts @@ -9,8 +9,8 @@ describe("MathSubScript", () => { describe("#constructor()", () => { it("should create a MathSubScript with correct root key", () => { const mathSubScript = new MathSubScript({ - child: new MathRun("e"), - subScript: new MathRun("2"), + children: [new MathRun("e")], + subScript: [new MathRun("2")], }); const tree = new Formatter().format(mathSubScript); diff --git a/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts b/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts index a5c26cd06c..319d4d1f1a 100644 --- a/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts +++ b/src/file/paragraph/math/script/sub-script/math-sub-script-function.ts @@ -6,8 +6,8 @@ import { MathBase, MathSubScriptElement } from "../../n-ary"; import { MathSubScriptProperties } from "./math-sub-script-function-properties"; export interface IMathSubScriptOptions { - readonly child: MathComponent; - readonly subScript: MathComponent; + readonly children: MathComponent[]; + readonly subScript: MathComponent[]; } export class MathSubScript extends XmlComponent { @@ -15,7 +15,7 @@ export class MathSubScript extends XmlComponent { super("m:sSub"); this.root.push(new MathSubScriptProperties()); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); this.root.push(new MathSubScriptElement(options.subScript)); } } diff --git a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts index 5e7f976db7..68a86fb26b 100644 --- a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts +++ b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.spec.ts @@ -9,9 +9,9 @@ describe("MathSubScript", () => { describe("#constructor()", () => { it("should create a MathSubScript with correct root key", () => { const mathSubScript = new MathSubSuperScript({ - child: new MathRun("e"), - subScript: new MathRun("2"), - superScript: new MathRun("5"), + children: [new MathRun("e")], + subScript: [new MathRun("2")], + superScript: [new MathRun("5")], }); const tree = new Formatter().format(mathSubScript); diff --git a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts index 91bdfe6781..c382c9ff4c 100644 --- a/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts +++ b/src/file/paragraph/math/script/sub-super-script/math-sub-super-script-function.ts @@ -6,9 +6,9 @@ import { MathBase, MathSubScriptElement, MathSuperScriptElement } from "../../n- import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties"; export interface IMathSubSuperScriptOptions { - readonly child: MathComponent; - readonly subScript: MathComponent; - readonly superScript: MathComponent; + readonly children: MathComponent[]; + readonly subScript: MathComponent[]; + readonly superScript: MathComponent[]; } export class MathSubSuperScript extends XmlComponent { @@ -16,7 +16,7 @@ export class MathSubSuperScript extends XmlComponent { super("m:sSubSup"); this.root.push(new MathSubSuperScriptProperties()); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); this.root.push(new MathSubScriptElement(options.subScript)); this.root.push(new MathSuperScriptElement(options.superScript)); } diff --git a/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts b/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts index 6e6beb5e04..ae3740360b 100644 --- a/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts +++ b/src/file/paragraph/math/script/super-script/math-super-script-function.spec.ts @@ -9,8 +9,8 @@ describe("MathSuperScript", () => { describe("#constructor()", () => { it("should create a MathSuperScript with correct root key", () => { const mathSuperScript = new MathSuperScript({ - child: new MathRun("e"), - superScript: new MathRun("2"), + children: [new MathRun("e")], + superScript: [new MathRun("2")], }); const tree = new Formatter().format(mathSuperScript); diff --git a/src/file/paragraph/math/script/super-script/math-super-script-function.ts b/src/file/paragraph/math/script/super-script/math-super-script-function.ts index d48ece6985..eeffdf124a 100644 --- a/src/file/paragraph/math/script/super-script/math-super-script-function.ts +++ b/src/file/paragraph/math/script/super-script/math-super-script-function.ts @@ -6,8 +6,8 @@ import { MathBase, MathSuperScriptElement } from "../../n-ary"; import { MathSuperScriptProperties } from "./math-super-script-function-properties"; export interface IMathSuperScriptOptions { - readonly child: MathComponent; - readonly superScript: MathComponent; + readonly children: MathComponent[]; + readonly superScript: MathComponent[]; } export class MathSuperScript extends XmlComponent { @@ -15,7 +15,7 @@ export class MathSuperScript extends XmlComponent { super("m:sSup"); this.root.push(new MathSuperScriptProperties()); - this.root.push(new MathBase(options.child)); + this.root.push(new MathBase(options.children)); this.root.push(new MathSuperScriptElement(options.superScript)); } } From 19d9619785a7c9c40d2a75e22361d3c70620e6fd Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 13 Oct 2020 03:00:14 +0100 Subject: [PATCH 035/107] Add more math documentation --- demo/55-math.ts | 30 +++++---- docs/usage/math.md | 155 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 164 insertions(+), 21 deletions(-) diff --git a/demo/55-math.ts b/demo/55-math.ts index 3dc6c1a17c..2a240986d0 100644 --- a/demo/55-math.ts +++ b/demo/55-math.ts @@ -44,19 +44,23 @@ doc.addSection({ }), ], }), - // new Paragraph({ - // children: [ - // new MathFraction({ - // numerator: [ - // new MathRun("1"), - // new MathRadical({ - // children: [new MathRun("2")], - // }), - // ], - // denominator: [new MathRun("2")], - // }), - // ], - // }), + new Paragraph({ + children: [ + new Math({ + children: [ + new MathFraction({ + numerator: [ + new MathRun("1"), + new MathRadical({ + children: [new MathRun("2")], + }), + ], + denominator: [new MathRun("2")], + }), + ], + }), + ], + }), new Paragraph({ children: [ new Math({ diff --git a/docs/usage/math.md b/docs/usage/math.md index e38f393ac9..1e8ab4f894 100644 --- a/docs/usage/math.md +++ b/docs/usage/math.md @@ -4,9 +4,10 @@ ## Intro -- To add math, create a `Math` object -- Add `MathComponents` inside `Math` -- `MathComponents` can have nested `MathComponents` inside. e.g. A fraction where the numerator is a square root, and the demoninator as another fraction. More on `MathComponents` below +1. To add math, create a `Math` object +2. Add `MathComponents` inside `Math` +3. `MathComponents` can have nested `MathComponents` inside. e.g. A fraction where the numerator is a square root, and the demoninator as another fraction. More on `MathComponents` below +4. Make sure to add the `Math` object inside a `Paragraph` ## Example @@ -76,7 +77,7 @@ new MathFraction({ numerator: [ new MathRun("1"), new MathRadical({ - child: [new MathRun("2")], + children: [new MathRun("2")], }), ], denominator: [new MathRun("2")], @@ -108,19 +109,157 @@ A `MathComponent` for `Σ`. It can take a `superScript` and/or `subScript` as ar ```ts new MathSum({ - child: [new MathRun("i")], + children: [new MathRun("i")], }), ``` ```ts new MathSum({ - child: [ + children: [ new MathSuperScript({ - child: new MathRun("e"), - superScript: new MathRun("2"), + children: [new MathRun("e")], + superScript: [new MathRun("2")], }) ], subScript: [new MathRun("i")], superScript: [new MathRun("10")], }), ``` + +### Radicals + +A `MathComponent` for the `√` symbol. Examples include, square root, cube root etc. There is an optional `degree` parameter to specify the number of times the radicand is multiplied by itself. For example, `3` for cube root. + +```ts +new MathRadical({ + children: [new MathRun("2")], +}), +``` + +Cube root example: + +```ts +new MathRadical({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + new MathRun('+ 1'), + ], + degree: [new MathRun("3")], +}), +``` + +### Super Script + +`MathSuperScripts` are the little numbers written to the top right of numbers or variables. It means the exponent or power if written by itself with the number or variable. + +```ts +new MathSuperScript({ + children: [new MathRun("x")], + superScript: [new MathRun("2")], +}), +``` + +An example with cosine: + +```ts +new MathSuperScript({ + children: [new MathRun("cos")], + superScript: [new MathRun("-1")], +}), +``` + +### Sub Script + +`MathSubScripts` are similar to `MathSuperScripts`, except the little number is written below. + +```ts +new MathSubScript({ + children: [new MathRun("F")], + subScript: [new MathRun("n-1")], +}), +``` + +### Sub-Super Script + +`MathSubSuperScripts` are a combination of both `MathSuperScript` and `MathSubScript`. + +```ts +new MathSubSuperScript({ + children: [new MathRun("test")], + superScript: [new MathRun("hello")], + subScript: [new MathRun("world")], +}), +``` + +### Function + +`MathFunctions` are a way of describing what happens to an input variable, in order to get the output result. It takes a `name` parameter to specify the name of the function. + +```ts +new MathFunction({ + name: [ + new MathSuperScript({ + children: [new MathRun("cos")], + superScript: [new MathRun("-1")], + }), + ], + children: [new MathRun("100")], +}), +``` + +### Brackets + +#### Square brackets + +```ts +new MathSquareBrackets({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], +}), +``` + +#### Round brackets + +```ts +new MathRoundBrackets({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], +}), +``` + +#### Curly brackets + +```ts +new MathCurlyBrackets({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], +}), +``` + +#### Angled brackets + +```ts +new MathAngledBrackets({ + children: [ + new MathFraction({ + numerator: [new MathRun("1")], + denominator: [new MathRun("2")], + }), + ], +}), +``` From ae37b1980f7a5f8d6be3ec5d2e791c6f01605a97 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 16 Oct 2020 16:20:04 +0100 Subject: [PATCH 036/107] Update Prettier --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f9a27f0fcb..b5d29a3384 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "mocha-webpack": "^1.0.1", "nyc": "^15.1.0", "pre-commit": "^1.2.2", - "prettier": "^2.0.5", + "prettier": "^2.1.2", "prompt": "^1.0.0", "replace-in-file": "^3.1.0", "request": "^2.88.0", From 6db0449ed0d849cffaef108b8d0543eb8e668283 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:55:53 +0000 Subject: [PATCH 037/107] build(deps-dev): bump @types/webpack from 4.41.22 to 4.41.23 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.41.22 to 4.41.23. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7d28a68d7d..79614df1c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -661,18 +661,18 @@ "dev": true }, "@types/uglify-js": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.9.3.tgz", - "integrity": "sha512-KswB5C7Kwduwjj04Ykz+AjvPcfgv/37Za24O2EDzYNbwyzOo8+ydtvzUfZ5UMguiVu29Gx44l1A6VsPPcmYu9w==", + "version": "3.11.0", + "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.11.0.tgz", + "integrity": "sha512-I0Yd8TUELTbgRHq2K65j8rnDPAzAP+DiaF/syLem7yXwYLsHZhPd+AM2iXsWmf9P2F2NlFCgl5erZPQx9IbM9Q==", "dev": true, "requires": { "source-map": "^0.6.1" } }, "@types/webpack": { - "version": "4.41.22", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.22.tgz", - "integrity": "sha512-JQDJK6pj8OMV9gWOnN1dcLCyU9Hzs6lux0wBO4lr1+gyEhIBR9U3FMrz12t2GPkg110XAxEAw2WHF6g7nZIbRQ==", + "version": "4.41.23", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.23.tgz", + "integrity": "sha512-ojA4CupZg8RCzVJLugWlvqrHpT59GWhqFxbinlsnvk10MjQCWB+ot7XDACctbWhnhtdhYK7+HOH1JxkVLiZhMg==", "dev": true, "requires": { "@types/anymatch": "*", @@ -684,9 +684,9 @@ } }, "@types/webpack-sources": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-1.4.2.tgz", - "integrity": "sha512-77T++JyKow4BQB/m9O96n9d/UUHWLQHlcqXb9Vsf4F1+wKNrrlWNFPDLKNT92RJnCSL6CieTc+NDXtCVZswdTw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.0.0.tgz", + "integrity": "sha512-a5kPx98CNFRKQ+wqawroFunvFqv7GHm/3KOI52NY9xWADgc8smu4R6prt4EU/M4QfVjvgBkMqU4fBhw3QfMVkg==", "dev": true, "requires": { "@types/node": "*", @@ -4843,7 +4843,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, From dcf755e75639239d8b5501bacf7bd948c3dbf13e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Sat, 24 Oct 2020 00:40:43 +0000 Subject: [PATCH 038/107] build(deps): bump shortid from 2.2.15 to 2.2.16 Bumps [shortid](https://github.com/dylang/shortid) from 2.2.15 to 2.2.16. - [Release notes](https://github.com/dylang/shortid/releases) - [Changelog](https://github.com/dylang/shortid/blob/master/CHANGELOG.md) - [Commits](https://github.com/dylang/shortid/compare/2.2.15...2.2.16) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 79614df1c7..77132c4a3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5560,9 +5560,9 @@ "optional": true }, "nanoid": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.6.tgz", - "integrity": "sha512-2NDzpiuEy3+H0AVtdt8LoFi7PnqkOnIzYmJQp7xsEU6VexLluHQwKREuiz57XaQC5006seIadPrIZJhyS2n7aw==" + "version": "2.1.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", + "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" }, "nanomatch": { "version": "1.2.13", @@ -7289,9 +7289,9 @@ } }, "shortid": { - "version": "2.2.15", - "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.15.tgz", - "integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==", + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.16.tgz", + "integrity": "sha512-Ugt+GIZqvGXCIItnsL+lvFJOiN7RYqlGy7QE41O3YC1xbNSeDGIRO7xg2JJXIAj1cAGnOeC1r7/T9pgrtQbv4g==", "requires": { "nanoid": "^2.1.0" } From ea5f9a48ab16bdc20748e74c46052946f51f2fee Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 24 Oct 2020 20:24:10 +0100 Subject: [PATCH 039/107] Fix cantSplit documentation --- docs/usage/tables.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/usage/tables.md b/docs/usage/tables.md index 38a74f8ba7..8d10b55ca3 100644 --- a/docs/usage/tables.md +++ b/docs/usage/tables.md @@ -51,19 +51,6 @@ const table = new Table({ }); ``` -### Pagination - -#### Prevent row pagination - -To prevent breaking contents of a row across multiple pages, call `cantSplit`: - -```ts -const table = new Table({ - rows: [], - cantSplit: true, -}); -``` - ## Table Row A table consists of multiple `table rows`. Table rows have a list of `children` which accepts a list of `table cells` explained below. You can create a simple `table row` like so: @@ -116,6 +103,19 @@ const row = new TableRow({ }); ``` +### Pagination + +#### Prevent row pagination + +To prevent breaking contents of a row across multiple pages, call `cantSplit`: + +```ts +const row = new Row({ + ..., + cantSplit: true, +}); +``` + ## Table Cells Cells need to be added in the `table row`, you can create a table cell like: From 18a1677588bc2b331f73ba21e738b92b0d74218e Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 24 Oct 2020 21:38:20 +0100 Subject: [PATCH 040/107] Add documentation reference --- src/file/table/table-row/table-row-properties.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/file/table/table-row/table-row-properties.ts b/src/file/table/table-row/table-row-properties.ts index c9b60c13f4..8e4d518e6f 100644 --- a/src/file/table/table-row/table-row-properties.ts +++ b/src/file/table/table-row/table-row-properties.ts @@ -1,6 +1,8 @@ -import { HeightRule, TableRowHeight } from "file/table/table-row/table-row-height"; +// http://officeopenxml.com/WPtableRowProperties.php import { IgnoreIfEmptyXmlComponent, XmlAttributeComponent, XmlComponent } from "file/xml-components"; +import { HeightRule, TableRowHeight } from "./table-row-height"; + export class TableRowProperties extends IgnoreIfEmptyXmlComponent { constructor() { super("w:trPr"); From ed52ef358be1750508e5b632241dce5104bd0239 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 27 Oct 2020 01:54:40 +0000 Subject: [PATCH 041/107] Background color for document --- demo/56-background-color.ts | 33 ++++++++++++ docs/usage/document.md | 18 +++++++ src/file/core-properties/properties.ts | 2 + .../document-background.spec.ts | 53 +++++++++++++++++++ .../document-background.ts | 39 ++++++++++++++ .../document/document-background/index.ts | 1 + src/file/document/document.spec.ts | 9 +++- src/file/document/document.ts | 8 ++- src/file/document/index.ts | 1 + src/file/file.ts | 2 +- .../settings/display-background-shape.spec.ts | 17 ++++++ src/file/settings/display-background-shape.ts | 9 ++++ src/file/settings/settings.spec.ts | 21 ++++---- src/file/settings/settings.ts | 4 ++ 14 files changed, 203 insertions(+), 14 deletions(-) create mode 100644 demo/56-background-color.ts create mode 100644 src/file/document/document-background/document-background.spec.ts create mode 100644 src/file/document/document-background/document-background.ts create mode 100644 src/file/document/document-background/index.ts create mode 100644 src/file/settings/display-background-shape.spec.ts create mode 100644 src/file/settings/display-background-shape.ts diff --git a/demo/56-background-color.ts b/demo/56-background-color.ts new file mode 100644 index 0000000000..6e8658fd00 --- /dev/null +++ b/demo/56-background-color.ts @@ -0,0 +1,33 @@ +// Change background colour of whole document +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Packer, Paragraph, TextRun } from "../build"; + +const doc = new Document({ + background: { + color: "C45911", + }, +}); + +doc.addSection({ + properties: {}, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + new TextRun({ + text: "\tGithub is the best", + bold: true, + }), + ], + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/docs/usage/document.md b/docs/usage/document.md index bf06d30613..37c8eb1fdb 100644 --- a/docs/usage/document.md +++ b/docs/usage/document.md @@ -30,6 +30,24 @@ const doc = new docx.Document({ * keywords * lastModifiedBy * revision +* externalStyles +* styles +* numbering +* footnotes +* hyperlinks +* background + +### Change background color of Document + +Set the hax value in the document like so: + +```ts +const doc = new docx.Document({ + background: { + color: "C45911", + }, +}); +``` You can mix and match whatever properties you want, or provide no properties. diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index ceddff39e0..96e9785175 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -1,4 +1,5 @@ import { XmlComponent } from "file/xml-components"; +import { IDocumentBackgroundOptions } from "../document"; import { DocumentAttributes } from "../document/document-attributes"; import { INumberingOptions } from "../numbering"; @@ -32,6 +33,7 @@ export interface IPropertiesOptions { readonly hyperlinks?: { readonly [key: string]: IInternalHyperlinkDefinition | IExternalHyperlinkDefinition; }; + readonly background?: IDocumentBackgroundOptions; } export class CoreProperties extends XmlComponent { diff --git a/src/file/document/document-background/document-background.spec.ts b/src/file/document/document-background/document-background.spec.ts new file mode 100644 index 0000000000..fb7444feb2 --- /dev/null +++ b/src/file/document/document-background/document-background.spec.ts @@ -0,0 +1,53 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { DocumentBackground } from "./document-background"; + +describe("DocumentBackground", () => { + describe("#constructor()", () => { + it("should create a DocumentBackground with no options and set color to auto", () => { + const documentBackground = new DocumentBackground({}); + const tree = new Formatter().format(documentBackground); + expect(tree).to.deep.equal({ + "w:background": { + _attr: { + "w:color": "auto", + }, + }, + }); + }); + + it("should create a DocumentBackground with no options and set color to value", () => { + const documentBackground = new DocumentBackground({ color: "ffffff" }); + const tree = new Formatter().format(documentBackground); + expect(tree).to.deep.equal({ + "w:background": { + _attr: { + "w:color": "ffffff", + }, + }, + }); + }); + + it("should create a DocumentBackground with no options and set other values", () => { + const documentBackground = new DocumentBackground({ + color: "ffffff", + themeColor: "test", + themeShade: "test", + themeTint: "test", + }); + const tree = new Formatter().format(documentBackground); + expect(tree).to.deep.equal({ + "w:background": { + _attr: { + "w:color": "ffffff", + "w:themeColor": "test", + "w:themeShade": "test", + "w:themeTint": "test", + }, + }, + }); + }); + }); +}); diff --git a/src/file/document/document-background/document-background.ts b/src/file/document/document-background/document-background.ts new file mode 100644 index 0000000000..82814c573f --- /dev/null +++ b/src/file/document/document-background/document-background.ts @@ -0,0 +1,39 @@ +// http://officeopenxml.com/WPdocument.php +// http://www.datypic.com/sc/ooxml/e-w_background-1.html +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +export class DocumentBackgroundAttributes extends XmlAttributeComponent<{ + readonly color: string; + readonly themeColor?: string; + readonly themeShade?: string; + readonly themeTint?: string; +}> { + protected readonly xmlKeys = { + color: "w:color", + themeColor: "w:themeColor", + themeShade: "w:themeShade", + themeTint: "w:themeTint", + }; +} + +export interface IDocumentBackgroundOptions { + readonly color?: string; + readonly themeColor?: string; + readonly themeShade?: string; + readonly themeTint?: string; +} + +export class DocumentBackground extends XmlComponent { + constructor(options: IDocumentBackgroundOptions) { + super("w:background"); + + this.root.push( + new DocumentBackgroundAttributes({ + color: options.color ? options.color : "auto", + themeColor: options.themeColor, + themeShade: options.themeShade, + themeTint: options.themeTint, + }), + ); + } +} diff --git a/src/file/document/document-background/index.ts b/src/file/document/document-background/index.ts new file mode 100644 index 0000000000..604f3da1f2 --- /dev/null +++ b/src/file/document/document-background/index.ts @@ -0,0 +1 @@ +export * from "./document-background"; diff --git a/src/file/document/document.spec.ts b/src/file/document/document.spec.ts index dba489601e..429825cfa4 100644 --- a/src/file/document/document.spec.ts +++ b/src/file/document/document.spec.ts @@ -8,7 +8,7 @@ describe("Document", () => { let document: Document; beforeEach(() => { - document = new Document(); + document = new Document({ background: {} }); }); describe("#constructor()", () => { @@ -38,6 +38,13 @@ describe("Document", () => { "mc:Ignorable": "w14 w15 wp14", }, }, + { + "w:background": { + _attr: { + "w:color": "auto", + }, + }, + }, { "w:body": {} }, ], }); diff --git a/src/file/document/document.ts b/src/file/document/document.ts index 80b04a379c..fb0f579568 100644 --- a/src/file/document/document.ts +++ b/src/file/document/document.ts @@ -5,11 +5,16 @@ import { Table } from "../table"; import { TableOfContents } from "../table-of-contents"; import { Body } from "./body"; import { DocumentAttributes } from "./document-attributes"; +import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background"; + +interface IDocumentOptions { + readonly background: IDocumentBackgroundOptions; +} export class Document extends XmlComponent { private readonly body: Body; - constructor() { + constructor(options: IDocumentOptions) { super("w:document"); this.root.push( new DocumentAttributes({ @@ -33,6 +38,7 @@ export class Document extends XmlComponent { }), ); this.body = new Body(); + this.root.push(new DocumentBackground(options.background)); this.root.push(this.body); } diff --git a/src/file/document/index.ts b/src/file/document/index.ts index 3430666623..a93dd86f99 100644 --- a/src/file/document/index.ts +++ b/src/file/document/index.ts @@ -1,3 +1,4 @@ export * from "./document"; export * from "./document-attributes"; export * from "./body"; +export * from "./document-background"; diff --git a/src/file/file.ts b/src/file/file.ts index 270714ed17..15a4dc9739 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -85,7 +85,7 @@ export class File { this.appProperties = new AppProperties(); this.footNotes = new FootNotes(); this.contentTypes = new ContentTypes(); - this.document = new Document(); + this.document = new Document({ background: options.background || {} }); this.settings = new Settings(); this.media = fileProperties.template && fileProperties.template.media ? fileProperties.template.media : new Media(); diff --git a/src/file/settings/display-background-shape.spec.ts b/src/file/settings/display-background-shape.spec.ts new file mode 100644 index 0000000000..34c23b65db --- /dev/null +++ b/src/file/settings/display-background-shape.spec.ts @@ -0,0 +1,17 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; + +import { DisplayBackgroundShape } from "./display-background-shape"; + +describe("DisplayBackgroundShape", () => { + describe("#constructor()", () => { + it("should create", () => { + const displayBackgroundShape = new DisplayBackgroundShape(); + const tree = new Formatter().format(displayBackgroundShape); + expect(tree).to.deep.equal({ + "w:displayBackgroundShape": {}, + }); + }); + }); +}); diff --git a/src/file/settings/display-background-shape.ts b/src/file/settings/display-background-shape.ts new file mode 100644 index 0000000000..bd0cd15675 --- /dev/null +++ b/src/file/settings/display-background-shape.ts @@ -0,0 +1,9 @@ +// http://officeopenxml.com/WPdocument.php +// http://www.datypic.com/sc/ooxml/e-w_background-1.html +import { XmlComponent } from "file/xml-components"; + +export class DisplayBackgroundShape extends XmlComponent { + constructor() { + super("w:displayBackgroundShape"); + } +} diff --git a/src/file/settings/settings.spec.ts b/src/file/settings/settings.spec.ts index 9be90669aa..69c7c089d5 100644 --- a/src/file/settings/settings.spec.ts +++ b/src/file/settings/settings.spec.ts @@ -15,8 +15,7 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); keys = Object.keys(tree["w:settings"]); expect(keys).is.an.instanceof(Array); - expect(keys).has.length(1); - expect(keys[0]).to.be.equal("_attr"); + expect(keys).has.length(2); }); }); describe("#addUpdateFields", () => { @@ -28,16 +27,16 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(2); + expect(rootArray).has.length(3); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[1]); + keys = Object.keys(rootArray[2]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:updateFields"); - const updateFields = rootArray[1]["w:updateFields"]; + const updateFields = rootArray[2]["w:updateFields"]; keys = Object.keys(updateFields); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); @@ -68,12 +67,12 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(2); + expect(rootArray).has.length(3); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[1]); + keys = Object.keys(rootArray[2]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:compat"); @@ -89,12 +88,12 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(2); + expect(rootArray).has.length(3); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[1]); + keys = Object.keys(rootArray[2]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:trackRevisions"); @@ -111,12 +110,12 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(2); + expect(rootArray).has.length(3); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[1]); + keys = Object.keys(rootArray[2]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:trackRevisions"); diff --git a/src/file/settings/settings.ts b/src/file/settings/settings.ts index d828d21fb5..d838e8ccc7 100644 --- a/src/file/settings/settings.ts +++ b/src/file/settings/settings.ts @@ -1,5 +1,6 @@ import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { Compatibility } from "./compatibility"; +import { DisplayBackgroundShape } from "./display-background-shape"; import { TrackRevisions } from "./track-revisions"; import { UpdateFields } from "./update-fields"; @@ -72,8 +73,11 @@ export class Settings extends XmlComponent { Ignorable: "w14 w15 wp14", }), ); + this.compatibility = new Compatibility(); this.trackRevisions = new TrackRevisions(); + + this.root.push(new DisplayBackgroundShape()); } public addUpdateFields(): void { From 60eb686d05ee3cd0004ad5b2d405fd75d98588d3 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 28 Oct 2020 01:05:31 +0000 Subject: [PATCH 042/107] Add shading to paragraph --- demo/46-shading-text.ts | 12 ++++ docs/usage/paragraph.md | 15 +++++ docs/usage/text.md | 63 ++++++++++++++----- .../document-background.spec.ts | 10 +-- .../document-background.ts | 2 +- src/file/document/document.spec.ts | 2 +- src/file/paragraph/paragraph.spec.ts | 31 +++++++++ src/file/paragraph/properties.ts | 11 ++++ 8 files changed, 124 insertions(+), 22 deletions(-) diff --git a/demo/46-shading-text.ts b/demo/46-shading-text.ts index 61f3f3d984..e662e6dffe 100644 --- a/demo/46-shading-text.ts +++ b/demo/46-shading-text.ts @@ -28,6 +28,18 @@ doc.addSection({ }), ], }), + new Paragraph({ + shading: { + type: ShadingType.DIAGONAL_CROSS, + color: "00FFFF", + fill: "FF0000", + }, + children: [ + new TextRun({ + text: "Hello World for entire paragraph", + }), + ], + }), ], }), }, diff --git a/docs/usage/paragraph.md b/docs/usage/paragraph.md index f6da3ec963..ceb4e0aa34 100644 --- a/docs/usage/paragraph.md +++ b/docs/usage/paragraph.md @@ -142,6 +142,21 @@ const paragraph = new Paragraph({ }); ``` +## Shading + +Add color to an entire paragraph block + +```ts +const paragraph = new Paragraph({ + text: "shading", + shading: { + type: ShadingType.REVERSE_DIAGONAL_STRIPE, + color: "00FFFF", + fill: "FF0000", + }, +}); +``` + ## Spacing Adding spacing between paragraphs diff --git a/docs/usage/text.md b/docs/usage/text.md index 4816959eb6..3ae388f780 100644 --- a/docs/usage/text.md +++ b/docs/usage/text.md @@ -77,40 +77,78 @@ const text = new TextRun({ }); ``` +### Shading and Highlighting + +```ts +const text = new TextRun({ + text: "shading", + shading: { + type: ShadingType.REVERSE_DIAGONAL_STRIPE, + color: "00FFFF", + fill: "FF0000", + }, +}); +``` + +```ts +const text = new TextRun({ + text: "highlighting", + highlight: "yellow", +}); +``` + ### Strike through ```ts -text.strike(); +const text = new TextRun({ + text: "strike", + strike: true, +}); ``` ### Double strike through ```ts -text.doubleStrike(); +const text = new TextRun({ + text: "doubleStrike", + doubleStrike: true, +}); ``` ### Superscript ```ts -text.superScript(); +const text = new TextRun({ + text: "superScript", + superScript: true, +}); ``` ### Subscript ```ts -text.subScript(); +const text = new TextRun({ + text: "subScript", + subScript: true, +}); ``` ### All Capitals ```ts -text.allCaps(); +const text = new TextRun({ + text: "allCaps", + allCaps: true, +}); ``` ### Small Capitals ```ts -text.smallCaps(); +const text = new TextRun({ + text: "smallCaps", + smallCaps: true, +}); ``` ## Break @@ -118,13 +156,8 @@ text.smallCaps(); Sometimes you would want to put text underneath another line of text but inside the same paragraph. ```ts -text.break(); -``` - -## Chaining - -What if you want to create a paragraph which is **_bold_** and **_italic_**? - -```ts -paragraph.bold().italics(); +const text = new TextRun({ + text: "break", + break: true, +}); ``` diff --git a/src/file/document/document-background/document-background.spec.ts b/src/file/document/document-background/document-background.spec.ts index fb7444feb2..83d1fb36b1 100644 --- a/src/file/document/document-background/document-background.spec.ts +++ b/src/file/document/document-background/document-background.spec.ts @@ -12,19 +12,19 @@ describe("DocumentBackground", () => { expect(tree).to.deep.equal({ "w:background": { _attr: { - "w:color": "auto", + "w:color": "FFFFFF", }, }, }); }); it("should create a DocumentBackground with no options and set color to value", () => { - const documentBackground = new DocumentBackground({ color: "ffffff" }); + const documentBackground = new DocumentBackground({ color: "ffff00" }); const tree = new Formatter().format(documentBackground); expect(tree).to.deep.equal({ "w:background": { _attr: { - "w:color": "ffffff", + "w:color": "ffff00", }, }, }); @@ -32,7 +32,7 @@ describe("DocumentBackground", () => { it("should create a DocumentBackground with no options and set other values", () => { const documentBackground = new DocumentBackground({ - color: "ffffff", + color: "ffff00", themeColor: "test", themeShade: "test", themeTint: "test", @@ -41,7 +41,7 @@ describe("DocumentBackground", () => { expect(tree).to.deep.equal({ "w:background": { _attr: { - "w:color": "ffffff", + "w:color": "ffff00", "w:themeColor": "test", "w:themeShade": "test", "w:themeTint": "test", diff --git a/src/file/document/document-background/document-background.ts b/src/file/document/document-background/document-background.ts index 82814c573f..44b04aabe6 100644 --- a/src/file/document/document-background/document-background.ts +++ b/src/file/document/document-background/document-background.ts @@ -29,7 +29,7 @@ export class DocumentBackground extends XmlComponent { this.root.push( new DocumentBackgroundAttributes({ - color: options.color ? options.color : "auto", + color: options.color ? options.color : "FFFFFF", themeColor: options.themeColor, themeShade: options.themeShade, themeTint: options.themeTint, diff --git a/src/file/document/document.spec.ts b/src/file/document/document.spec.ts index 429825cfa4..d903ff78aa 100644 --- a/src/file/document/document.spec.ts +++ b/src/file/document/document.spec.ts @@ -41,7 +41,7 @@ describe("Document", () => { { "w:background": { _attr: { - "w:color": "auto", + "w:color": "FFFFFF", }, }, }, diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 0b8e9acd00..ced4355869 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -9,6 +9,7 @@ import { File } from "../file"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; import { Bookmark, HyperlinkRef } from "./links"; import { Paragraph } from "./paragraph"; +import { ShadingType } from "../table/shading"; describe("Paragraph", () => { describe("#constructor()", () => { @@ -761,6 +762,36 @@ describe("Paragraph", () => { }); }); + describe("#shading", () => { + it("should set paragraph outline level to the given value", () => { + const paragraph = new Paragraph({ + shading: { + type: ShadingType.REVERSE_DIAGONAL_STRIPE, + color: "00FFFF", + fill: "FF0000", + }, + }); + const tree = new Formatter().format(paragraph); + expect(tree).to.deep.equal({ + "w:p": [ + { + "w:pPr": [ + { + "w:shd": { + _attr: { + "w:color": "00FFFF", + "w:fill": "FF0000", + "w:val": "reverseDiagStripe", + }, + }, + }, + ], + }, + ], + }); + }); + }); + describe("#prepForXml", () => { it("should set paragraph outline level to the given value", () => { const paragraph = new Paragraph({ diff --git a/src/file/paragraph/properties.ts b/src/file/paragraph/properties.ts index af97e2c684..b12bfedd8e 100644 --- a/src/file/paragraph/properties.ts +++ b/src/file/paragraph/properties.ts @@ -1,5 +1,6 @@ // http://officeopenxml.com/WPparagraphProperties.php import { IgnoreIfEmptyXmlComponent, XmlComponent } from "file/xml-components"; +import { ShadingType } from "../table/shading"; import { Alignment, AlignmentType } from "./formatting/alignment"; import { Bidirectional } from "./formatting/bidirectional"; import { Border, IBorderOptions, ThematicBreak } from "./formatting/border"; @@ -11,6 +12,7 @@ import { HeadingLevel, Style } from "./formatting/style"; import { LeaderType, TabStop, TabStopPosition, TabStopType } from "./formatting/tab-stop"; import { NumberProperties } from "./formatting/unordered-list"; import { OutlineLevel } from "./links"; +import { Shading } from "./run/formatting"; export interface IParagraphStylePropertiesOptions { readonly alignment?: AlignmentType; @@ -44,6 +46,11 @@ export interface IParagraphPropertiesOptions extends IParagraphStylePropertiesOp readonly level: number; readonly custom?: boolean; }; + readonly shading?: { + readonly type: ShadingType; + readonly fill: string; + readonly color: string; + }; } export class ParagraphProperties extends IgnoreIfEmptyXmlComponent { @@ -131,6 +138,10 @@ export class ParagraphProperties extends IgnoreIfEmptyXmlComponent { if (options.leftTabStop) { this.push(new TabStop(TabStopType.LEFT, options.leftTabStop)); } + + if (options.shading) { + this.push(new Shading(options.shading.type, options.shading.fill, options.shading.color)); + } } public push(item: XmlComponent): void { From 0f3afd94f3907c852956563d520893cf076858d9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 28 Oct 2020 15:28:10 +0000 Subject: [PATCH 043/107] build(deps-dev): bump sinon from 9.2.0 to 9.2.1 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.2.0 to 9.2.1. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77132c4a3c..a3d87f539d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7303,9 +7303,9 @@ "dev": true }, "sinon": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.0.tgz", - "integrity": "sha512-eSNXz1XMcGEMHw08NJXSyTHIu6qTCOiN8x9ODACmZpNQpr0aXTBXBnI4xTzQzR+TEpOmLiKowGf9flCuKIzsbw==", + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.1.tgz", + "integrity": "sha512-naPfsamB5KEE1aiioaoqJ6MEhdUs/2vtI5w1hPAXX/UwvoPjXcwh1m5HiKx0HGgKR8lQSoFIgY5jM6KK8VrS9w==", "dev": true, "requires": { "@sinonjs/commons": "^1.8.1", From 610b2388bb2e10d844cebebf7cb84c988a164a25 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 29 Oct 2020 00:39:45 +0000 Subject: [PATCH 044/107] Fix linting --- src/file/paragraph/paragraph.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index ced4355869..a368684d40 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -6,10 +6,10 @@ import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; import { File } from "../file"; +import { ShadingType } from "../table/shading"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; import { Bookmark, HyperlinkRef } from "./links"; import { Paragraph } from "./paragraph"; -import { ShadingType } from "../table/shading"; describe("Paragraph", () => { describe("#constructor()", () => { From 1552ebde1116a8e2e020b09725d8a72a284241e0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2020 22:54:05 +0000 Subject: [PATCH 045/107] build(deps-dev): bump @types/webpack from 4.41.23 to 4.41.24 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.41.23 to 4.41.24. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index a3d87f539d..e0566ca4d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -661,18 +661,18 @@ "dev": true }, "@types/uglify-js": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.11.0.tgz", - "integrity": "sha512-I0Yd8TUELTbgRHq2K65j8rnDPAzAP+DiaF/syLem7yXwYLsHZhPd+AM2iXsWmf9P2F2NlFCgl5erZPQx9IbM9Q==", + "version": "3.11.1", + "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.11.1.tgz", + "integrity": "sha512-7npvPKV+jINLu1SpSYVWG8KvyJBhBa8tmzMMdDoVc2pWUYHN8KIXlPJhjJ4LT97c4dXJA2SHL/q6ADbDriZN+Q==", "dev": true, "requires": { "source-map": "^0.6.1" } }, "@types/webpack": { - "version": "4.41.23", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.23.tgz", - "integrity": "sha512-ojA4CupZg8RCzVJLugWlvqrHpT59GWhqFxbinlsnvk10MjQCWB+ot7XDACctbWhnhtdhYK7+HOH1JxkVLiZhMg==", + "version": "4.41.24", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.24.tgz", + "integrity": "sha512-1A0MXPwZiMOD3DPMuOKUKcpkdPo8Lq33UGggZ7xio6wJ/jV1dAu5cXDrOfGDnldUroPIRLsr/DT43/GqOA4RFQ==", "dev": true, "requires": { "@types/anymatch": "*", From 37e610d2b3beacef8d6f64f0890f74a4d387a4b9 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 30 Oct 2020 00:13:52 +0000 Subject: [PATCH 046/107] Fix typo --- docs/usage/document.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/document.md b/docs/usage/document.md index 37c8eb1fdb..0f1a12486a 100644 --- a/docs/usage/document.md +++ b/docs/usage/document.md @@ -39,7 +39,7 @@ const doc = new docx.Document({ ### Change background color of Document -Set the hax value in the document like so: +Set the hex value in the document like so: ```ts const doc = new docx.Document({ From 34b2029efeae9accc40f776f5b17a90cf7e1e62a Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 4 Nov 2020 00:00:16 +0000 Subject: [PATCH 047/107] Change API of track revisions to declarative --- demo/54-track-revisions.ts | 31 ++++++++++++++++++-------- docs/usage/change-tracking.md | 9 +++++--- src/file/core-properties/properties.ts | 3 +++ src/file/file.ts | 6 +++++ 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/demo/54-track-revisions.ts b/demo/54-track-revisions.ts index 01d96082b8..a0cc47a03b 100644 --- a/demo/54-track-revisions.ts +++ b/demo/54-track-revisions.ts @@ -1,7 +1,19 @@ // Track Revisions aka. "Track Changes" // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, Packer, Paragraph, TextRun, ShadingType, DeletedTextRun, InsertedTextRun, Footer, PageNumber, AlignmentType, FootnoteReferenceRun } from "../build"; +import { + AlignmentType, + DeletedTextRun, + Document, + Footer, + FootnoteReferenceRun, + InsertedTextRun, + Packer, + PageNumber, + Paragraph, + ShadingType, + TextRun, +} from "../build"; /* For reference, see @@ -17,7 +29,7 @@ import { Document, Packer, Paragraph, TextRun, ShadingType, DeletedTextRun, Inse const doc = new Document({ footnotes: [ new Paragraph({ - children:[ + children: [ new TextRun("This is a footnote"), new DeletedTextRun({ text: " with some extra text which was deleted", @@ -30,19 +42,20 @@ const doc = new Document({ id: 1, author: "Firstname Lastname", date: "2020-10-06T09:05:00Z", - }) - ] + }), + ], }), ], + features: { + trackRevisions: true, + }, }); -doc.Settings.addTrackRevisions() - const paragraph = new Paragraph({ children: [ new TextRun("This is a simple demo "), new TextRun({ - text: "on how to " + text: "on how to ", }), new InsertedTextRun({ text: "mark a text as an insertion ", @@ -55,7 +68,7 @@ const paragraph = new Paragraph({ id: 1, author: "Firstname Lastname", date: "2020-10-06T09:00:00Z", - }) + }), ], }); @@ -92,7 +105,7 @@ doc.addSection({ }), new TextRun({ bold: true, - children: [ "\tuse Inserted and Deleted TextRuns.", new FootnoteReferenceRun(1) ], + children: ["\tuse Inserted and Deleted TextRuns.", new FootnoteReferenceRun(1)], }), ], }), diff --git a/docs/usage/change-tracking.md b/docs/usage/change-tracking.md index 6f81e4d0d7..a5ca66ebb3 100644 --- a/docs/usage/change-tracking.md +++ b/docs/usage/change-tracking.md @@ -53,6 +53,9 @@ In addtion to marking text as inserted or deleted, change tracking can also be a ```ts import { Document } from "docx"; -const doc = new Document({}); -doc.Settings.addTrackRevisions() -``` \ No newline at end of file +const doc = new Document({ + features: { + trackRevisions: true, + }, +}); +``` diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index 96e9785175..ae9f227ad5 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -34,6 +34,9 @@ export interface IPropertiesOptions { readonly [key: string]: IInternalHyperlinkDefinition | IExternalHyperlinkDefinition; }; readonly background?: IDocumentBackgroundOptions; + readonly features?: { + readonly trackRevisions?: boolean; + }; } export class CoreProperties extends XmlComponent { diff --git a/src/file/file.ts b/src/file/file.ts index 15a4dc9739..1c655253de 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -170,6 +170,12 @@ export class File { this.hyperlinkCache = cache; } + + if (options.features) { + if (options.features.trackRevisions) { + this.settings.addTrackRevisions(); + } + } } public addSection({ From c7ea26e422ed41b51ff8366fde59f205e4ca88a1 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 4 Nov 2020 01:28:46 +0000 Subject: [PATCH 048/107] Add tests --- src/file/file.spec.ts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index 6ec30e1be9..9b93a63db1 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -5,7 +5,7 @@ import { Formatter } from "export/formatter"; import { File } from "./file"; import { Footer, Header } from "./header"; -import { HyperlinkRef, Paragraph } from "./paragraph"; +import { HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph"; import { Table, TableCell, TableRow } from "./table"; import { TableOfContents } from "./table-of-contents"; @@ -243,12 +243,40 @@ describe("File", () => { }); }); + describe("#addTrackRevisionsFeature", () => { + it("should call the underlying document's add", () => { + const file = new File({ + features: { + trackRevisions: true, + }, + }); + + // tslint:disable-next-line: no-unused-expression no-string-literal + expect(file.Settings["trackRevisions"]).to.exist; + }); + }); + describe("#HyperlinkCache", () => { it("should initially have empty hyperlink cache", () => { const file = new File(); expect(file.HyperlinkCache).to.deep.equal({}); }); + + it("should have hyperlink cache when option is added", () => { + const file = new File({ + hyperlinks: { + myCoolLink: { + link: "http://www.example.com", + text: "Hyperlink", + type: HyperlinkType.EXTERNAL, + }, + }, + }); + + // tslint:disable-next-line: no-unused-expression no-string-literal + expect(file.HyperlinkCache["myCoolLink"]).to.exist; + }); }); describe("#createFootnote", () => { From 82bdb301f9588d9e8f02de6b946e7a4b9453118a Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 4 Nov 2020 02:52:28 +0000 Subject: [PATCH 049/107] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5d29a3384..0e3a678600 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.3.0", + "version": "5.4.0", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From e0b2f59c2fcd28f3a340922f4f1b0051a04b8d43 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 4 Nov 2020 23:36:28 +0000 Subject: [PATCH 050/107] Add initial GitHub Actions workflow --- .github/workflows/default.yml | 99 +++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 .github/workflows/default.yml diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml new file mode 100644 index 0000000000..b3d4aab0a9 --- /dev/null +++ b/.github/workflows/default.yml @@ -0,0 +1,99 @@ +name: Default +on: + push: + branches: + - master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + - name: Install Dependencies + run: npm ci + - name: Build + run: npm run build + - name: Archive Production Artifact + uses: actions/upload-artifact@master + with: + name: build + path: build + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + - name: Install Dependencies + run: npm ci + - name: Test + run: npm run test.coverage + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + - name: Install Dependencies + run: npm ci + - name: Lint + run: npm run lint + prettier: + name: Prettier + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + - name: Install Dependencies + run: npm ci + - name: Prettier + run: npm run prettier + demos: + name: Run Demos + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@master + - name: Install Dependencies + run: npm ci + - name: Prettier + run: | + npm run ts-node -- ./demo/1-basic.ts + # - npm run e2e "My Document.docx" + npm run ts-node -- ./demo/2-declaritive-styles.ts + npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts + npm run ts-node -- ./demo/4-basic-table.ts + npm run ts-node -- ./demo/5-images.ts + npm run ts-node -- ./demo/6-page-borders.ts + npm run ts-node -- ./demo/7-landscape.ts + npm run ts-node -- ./demo/8-header-footer.ts + npm run ts-node -- ./demo/9-images-in-header-and-footer.ts + npm run ts-node -- ./demo/10-my-cv.ts + # - npm run e2e "My Document.docx" + npm run ts-node -- ./demo/11-declaritive-styles-2.ts + npm run ts-node -- ./demo/12-scaling-images.ts + npm run ts-node -- ./demo/13-xml-styles.ts + npm run ts-node -- ./demo/14-page-numbers.ts + npm run ts-node -- ./demo/15-page-break-before.ts + npm run ts-node -- ./demo/16-multiple-sections.ts + npm run ts-node -- ./demo/17-footnotes.ts + npm run ts-node -- ./demo/18-image-from-buffer.ts + npm run ts-node -- ./demo/19-export-to-base64.ts + npm run ts-node -- ./demo/20-table-cell-borders.ts + npm run ts-node -- ./demo/21-bookmarks.ts + npm run ts-node -- ./demo/22-right-to-left-text.ts + npm run ts-node -- ./demo/23-base64-images.ts + npm run ts-node -- ./demo/24-images-to-table-cell.ts + # - npm run ts-node -- ./demo/demo25.ts + npm run ts-node -- ./demo/26-paragraph-borders.ts + npm run ts-node -- ./demo/27-declaritive-styles-3.ts + npm run ts-node -- ./demo/28-table-of-contents.ts + npm run ts-node -- ./demo/29-numbered-lists.ts + npm run ts-node -- ./demo/30-template-document.ts + npm run ts-node -- ./demo/31-tables.ts + npm run ts-node -- ./demo/32-merge-and-shade-table-cells.ts + # - npm run e2e "My Document.docx" // Need to fix + npm run ts-node -- ./demo/33-sequential-captions.ts + npm run ts-node -- ./demo/34-floating-tables.ts From ef747486c006b8c3db429d686ad08e67dd76fd32 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 4 Nov 2020 23:40:59 +0000 Subject: [PATCH 051/107] Remove comments --- .github/workflows/default.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index b3d4aab0a9..794503ddc0 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -61,7 +61,6 @@ jobs: - name: Prettier run: | npm run ts-node -- ./demo/1-basic.ts - # - npm run e2e "My Document.docx" npm run ts-node -- ./demo/2-declaritive-styles.ts npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts npm run ts-node -- ./demo/4-basic-table.ts @@ -71,7 +70,6 @@ jobs: npm run ts-node -- ./demo/8-header-footer.ts npm run ts-node -- ./demo/9-images-in-header-and-footer.ts npm run ts-node -- ./demo/10-my-cv.ts - # - npm run e2e "My Document.docx" npm run ts-node -- ./demo/11-declaritive-styles-2.ts npm run ts-node -- ./demo/12-scaling-images.ts npm run ts-node -- ./demo/13-xml-styles.ts @@ -86,7 +84,6 @@ jobs: npm run ts-node -- ./demo/22-right-to-left-text.ts npm run ts-node -- ./demo/23-base64-images.ts npm run ts-node -- ./demo/24-images-to-table-cell.ts - # - npm run ts-node -- ./demo/demo25.ts npm run ts-node -- ./demo/26-paragraph-borders.ts npm run ts-node -- ./demo/27-declaritive-styles-3.ts npm run ts-node -- ./demo/28-table-of-contents.ts @@ -94,6 +91,5 @@ jobs: npm run ts-node -- ./demo/30-template-document.ts npm run ts-node -- ./demo/31-tables.ts npm run ts-node -- ./demo/32-merge-and-shade-table-cells.ts - # - npm run e2e "My Document.docx" // Need to fix npm run ts-node -- ./demo/33-sequential-captions.ts npm run ts-node -- ./demo/34-floating-tables.ts From 0165cfb3e5f1905984f4ad6f6be73ba62407857a Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 5 Nov 2020 00:11:02 +0000 Subject: [PATCH 052/107] Fix typo --- .github/workflows/default.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 794503ddc0..148cfcc4b7 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -49,7 +49,7 @@ jobs: - name: Install Dependencies run: npm ci - name: Prettier - run: npm run prettier + run: npm run style demos: name: Run Demos runs-on: ubuntu-latest From f72f7e751486b80d5136638db35cc68e6c065d74 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 5 Nov 2020 00:17:55 +0000 Subject: [PATCH 053/107] Add build files to demo workflow --- .github/workflows/default.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 148cfcc4b7..f2605597d6 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -52,13 +52,19 @@ jobs: run: npm run style demos: name: Run Demos + needs: [build] runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@master - name: Install Dependencies run: npm ci - - name: Prettier + - name: Download Artifact + uses: actions/download-artifact@master + with: + name: build + path: build + - name: Run demos run: | npm run ts-node -- ./demo/1-basic.ts npm run ts-node -- ./demo/2-declaritive-styles.ts From d1b45d416bd3ad492130280873f2a1bcbc90c03b Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 5 Nov 2020 00:33:54 +0000 Subject: [PATCH 054/107] Fix spacing issue --- .github/workflows/default.yml | 70 +++++++++++++++++------------------ 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index f2605597d6..77744603c6 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -62,40 +62,40 @@ jobs: - name: Download Artifact uses: actions/download-artifact@master with: - name: build - path: build + name: build + path: build - name: Run demos run: | - npm run ts-node -- ./demo/1-basic.ts - npm run ts-node -- ./demo/2-declaritive-styles.ts - npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts - npm run ts-node -- ./demo/4-basic-table.ts - npm run ts-node -- ./demo/5-images.ts - npm run ts-node -- ./demo/6-page-borders.ts - npm run ts-node -- ./demo/7-landscape.ts - npm run ts-node -- ./demo/8-header-footer.ts - npm run ts-node -- ./demo/9-images-in-header-and-footer.ts - npm run ts-node -- ./demo/10-my-cv.ts - npm run ts-node -- ./demo/11-declaritive-styles-2.ts - npm run ts-node -- ./demo/12-scaling-images.ts - npm run ts-node -- ./demo/13-xml-styles.ts - npm run ts-node -- ./demo/14-page-numbers.ts - npm run ts-node -- ./demo/15-page-break-before.ts - npm run ts-node -- ./demo/16-multiple-sections.ts - npm run ts-node -- ./demo/17-footnotes.ts - npm run ts-node -- ./demo/18-image-from-buffer.ts - npm run ts-node -- ./demo/19-export-to-base64.ts - npm run ts-node -- ./demo/20-table-cell-borders.ts - npm run ts-node -- ./demo/21-bookmarks.ts - npm run ts-node -- ./demo/22-right-to-left-text.ts - npm run ts-node -- ./demo/23-base64-images.ts - npm run ts-node -- ./demo/24-images-to-table-cell.ts - npm run ts-node -- ./demo/26-paragraph-borders.ts - npm run ts-node -- ./demo/27-declaritive-styles-3.ts - npm run ts-node -- ./demo/28-table-of-contents.ts - npm run ts-node -- ./demo/29-numbered-lists.ts - npm run ts-node -- ./demo/30-template-document.ts - npm run ts-node -- ./demo/31-tables.ts - npm run ts-node -- ./demo/32-merge-and-shade-table-cells.ts - npm run ts-node -- ./demo/33-sequential-captions.ts - npm run ts-node -- ./demo/34-floating-tables.ts + npm run ts-node -- ./demo/1-basic.ts + npm run ts-node -- ./demo/2-declaritive-styles.ts + npm run ts-node -- ./demo/3-numbering-and-bullet-points.ts + npm run ts-node -- ./demo/4-basic-table.ts + npm run ts-node -- ./demo/5-images.ts + npm run ts-node -- ./demo/6-page-borders.ts + npm run ts-node -- ./demo/7-landscape.ts + npm run ts-node -- ./demo/8-header-footer.ts + npm run ts-node -- ./demo/9-images-in-header-and-footer.ts + npm run ts-node -- ./demo/10-my-cv.ts + npm run ts-node -- ./demo/11-declaritive-styles-2.ts + npm run ts-node -- ./demo/12-scaling-images.ts + npm run ts-node -- ./demo/13-xml-styles.ts + npm run ts-node -- ./demo/14-page-numbers.ts + npm run ts-node -- ./demo/15-page-break-before.ts + npm run ts-node -- ./demo/16-multiple-sections.ts + npm run ts-node -- ./demo/17-footnotes.ts + npm run ts-node -- ./demo/18-image-from-buffer.ts + npm run ts-node -- ./demo/19-export-to-base64.ts + npm run ts-node -- ./demo/20-table-cell-borders.ts + npm run ts-node -- ./demo/21-bookmarks.ts + npm run ts-node -- ./demo/22-right-to-left-text.ts + npm run ts-node -- ./demo/23-base64-images.ts + npm run ts-node -- ./demo/24-images-to-table-cell.ts + npm run ts-node -- ./demo/26-paragraph-borders.ts + npm run ts-node -- ./demo/27-declaritive-styles-3.ts + npm run ts-node -- ./demo/28-table-of-contents.ts + npm run ts-node -- ./demo/29-numbered-lists.ts + npm run ts-node -- ./demo/30-template-document.ts + npm run ts-node -- ./demo/31-tables.ts + npm run ts-node -- ./demo/32-merge-and-shade-table-cells.ts + npm run ts-node -- ./demo/33-sequential-captions.ts + npm run ts-node -- ./demo/34-floating-tables.ts From 2213eb28cb10e181cc9f2c11f05239cdf95086ea Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 5 Nov 2020 02:44:05 +0000 Subject: [PATCH 055/107] Add Github Actions badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 84469fa454..8db7237c59 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ [![NPM version][npm-image]][npm-url] [![Downloads per month][downloads-image]][downloads-url] [![Build Status][travis-image]][travis-url] +[![GitHub Action Workflow Status][github-actions-workflow-image]][github-actions-workflow-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Known Vulnerabilities][snky-image]][snky-url] [![Chat on Gitter][gitter-image]][gitter-url] @@ -102,6 +103,8 @@ Made with 💖 [downloads-url]: https://npmjs.org/package/docx [travis-image]: https://travis-ci.org/dolanmiu/docx.svg?branch=master [travis-url]: https://travis-ci.org/dolanmiu/docx +[github-actions-workflow-image]: https://github.com/dolanmiu/docx/workflows/Default/badge.svg +[github-actions-workflow-url]: https://github.com/dolanmiu/docx/actions [daviddm-image]: https://david-dm.org/dolanmiu/docx.svg?theme=shields.io [daviddm-url]: https://david-dm.org/dolanmiu/docx [snky-image]: https://snyk.io/test/github/dolanmiu/docx/badge.svg From 74db67689fb42575dd573c39ec8892fa166db1bb Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 6 Nov 2020 00:27:57 +0000 Subject: [PATCH 056/107] Re-name paragraph styles --- src/file/styles/style/character-style.spec.ts | 52 +++++------ src/file/styles/style/character-style.ts | 2 +- src/file/styles/style/default-styles.ts | 16 ++-- src/file/styles/style/paragraph-style.spec.ts | 86 +++++++++---------- src/file/styles/style/paragraph-style.ts | 2 +- src/file/styles/styles.ts | 8 +- 6 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/file/styles/style/character-style.spec.ts b/src/file/styles/style/character-style.spec.ts index 2fddce1c1b..c7adf4ff97 100644 --- a/src/file/styles/style/character-style.spec.ts +++ b/src/file/styles/style/character-style.spec.ts @@ -6,12 +6,12 @@ import { UnderlineType } from "file/paragraph/run/underline"; import { ShadingType } from "file/table"; import { EMPTY_OBJECT } from "file/xml-components"; -import { CharacterStyle } from "./character-style"; +import { StyleForCharacter } from "./character-style"; describe("CharacterStyle", () => { describe("#constructor", () => { it("should set the style type to character and use the given style id", () => { - const style = new CharacterStyle({ id: "myStyleId" }); + const style = new StyleForCharacter({ id: "myStyleId" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -31,7 +31,7 @@ describe("CharacterStyle", () => { }); it("should set the name of the style, if given", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", name: "Style Name", }); @@ -55,7 +55,7 @@ describe("CharacterStyle", () => { }); it("should add smallCaps", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { smallCaps: true, @@ -83,7 +83,7 @@ describe("CharacterStyle", () => { }); it("should add allCaps", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { allCaps: true, @@ -111,7 +111,7 @@ describe("CharacterStyle", () => { }); it("should add strike", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { strike: true, @@ -139,7 +139,7 @@ describe("CharacterStyle", () => { }); it("should add double strike", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { doubleStrike: true, @@ -167,7 +167,7 @@ describe("CharacterStyle", () => { }); it("should add sub script", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { subScript: true, @@ -203,7 +203,7 @@ describe("CharacterStyle", () => { }); it("should add font by name", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { font: "test font", @@ -242,7 +242,7 @@ describe("CharacterStyle", () => { }); it("should add font for ascii and eastAsia", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { font: { @@ -282,7 +282,7 @@ describe("CharacterStyle", () => { }); it("should add character spacing", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { characterSpacing: 100, @@ -312,7 +312,7 @@ describe("CharacterStyle", () => { describe("formatting methods: style attributes", () => { it("#basedOn", () => { - const style = new CharacterStyle({ id: "myStyleId", basedOn: "otherId" }); + const style = new StyleForCharacter({ id: "myStyleId", basedOn: "otherId" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -357,7 +357,7 @@ describe("CharacterStyle", () => { ]; sizeTests.forEach(({ size, sizeComplexScript, expected }) => { it(`#size ${size} cs ${sizeComplexScript}`, () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { size, sizeComplexScript }, }); @@ -385,7 +385,7 @@ describe("CharacterStyle", () => { describe("#underline", () => { it("should set underline to 'single' if no arguments are given", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { underline: {}, @@ -413,7 +413,7 @@ describe("CharacterStyle", () => { }); it("should set the style if given", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { underline: { @@ -443,7 +443,7 @@ describe("CharacterStyle", () => { }); it("should set the style and color if given", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { underline: { @@ -476,7 +476,7 @@ describe("CharacterStyle", () => { describe("#emphasisMark", () => { it("should set emphasisMark to 'dot' if no arguments are given", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { emphasisMark: {}, @@ -504,7 +504,7 @@ describe("CharacterStyle", () => { }); it("should set the style if given", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { emphasisMark: { @@ -535,7 +535,7 @@ describe("CharacterStyle", () => { }); it("#superScript", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { superScript: true, @@ -571,7 +571,7 @@ describe("CharacterStyle", () => { }); it("#color", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { color: "123456", @@ -616,7 +616,7 @@ describe("CharacterStyle", () => { ]; boldTests.forEach(({ bold, boldComplexScript, expected }) => { it(`#bold ${bold} cs ${boldComplexScript}`, () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { bold, boldComplexScript }, }); @@ -660,7 +660,7 @@ describe("CharacterStyle", () => { ]; italicsTests.forEach(({ italics, italicsComplexScript, expected }) => { it(`#italics ${italics} cs ${italicsComplexScript}`, () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { italics, italicsComplexScript }, }); @@ -687,7 +687,7 @@ describe("CharacterStyle", () => { }); it("#link", () => { - const style = new CharacterStyle({ id: "myStyleId", link: "MyLink" }); + const style = new StyleForCharacter({ id: "myStyleId", link: "MyLink" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -708,7 +708,7 @@ describe("CharacterStyle", () => { }); it("#semiHidden", () => { - const style = new CharacterStyle({ id: "myStyleId", semiHidden: true }); + const style = new StyleForCharacter({ id: "myStyleId", semiHidden: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -749,7 +749,7 @@ describe("CharacterStyle", () => { ]; highlightTests.forEach(({ highlight, highlightComplexScript, expected }) => { it(`#highlight ${highlight} cs ${highlightComplexScript}`, () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { highlight, highlightComplexScript }, }); @@ -838,7 +838,7 @@ describe("CharacterStyle", () => { ]; shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => { it("#shadow correctly", () => { - const style = new CharacterStyle({ + const style = new StyleForCharacter({ id: "myStyleId", run: { shadow, shading, shadingComplexScript }, }); diff --git a/src/file/styles/style/character-style.ts b/src/file/styles/style/character-style.ts index 0191a0460e..63252bddd5 100644 --- a/src/file/styles/style/character-style.ts +++ b/src/file/styles/style/character-style.ts @@ -15,7 +15,7 @@ export interface ICharacterStyleOptions extends IBaseCharacterStyleOptions { readonly name?: string; } -export class CharacterStyle extends Style { +export class StyleForCharacter extends Style { private readonly runProperties: RunProperties; constructor(options: ICharacterStyleOptions) { diff --git a/src/file/styles/style/default-styles.ts b/src/file/styles/style/default-styles.ts index 8974435a95..b1de98e076 100644 --- a/src/file/styles/style/default-styles.ts +++ b/src/file/styles/style/default-styles.ts @@ -1,9 +1,9 @@ import { UnderlineType } from "file/paragraph/run/underline"; -import { CharacterStyle, IBaseCharacterStyleOptions } from "./character-style"; -import { IBaseParagraphStyleOptions, IParagraphStyleOptions, ParagraphStyle } from "./paragraph-style"; +import { IBaseCharacterStyleOptions, StyleForCharacter } from "./character-style"; +import { IBaseParagraphStyleOptions, IParagraphStyleOptions, StyleForParagraph } from "./paragraph-style"; -export class HeadingStyle extends ParagraphStyle { +export class HeadingStyle extends StyleForParagraph { constructor(options: IParagraphStyleOptions) { super({ ...options, @@ -84,7 +84,7 @@ export class Heading6Style extends HeadingStyle { } } -export class ListParagraph extends ParagraphStyle { +export class ListParagraph extends StyleForParagraph { constructor(options: IBaseParagraphStyleOptions) { super({ ...options, @@ -96,7 +96,7 @@ export class ListParagraph extends ParagraphStyle { } } -export class FootnoteText extends ParagraphStyle { +export class FootnoteText extends StyleForParagraph { constructor(options: IBaseParagraphStyleOptions) { super({ ...options, @@ -121,7 +121,7 @@ export class FootnoteText extends ParagraphStyle { } } -export class FootnoteReferenceStyle extends CharacterStyle { +export class FootnoteReferenceStyle extends StyleForCharacter { constructor(options: IBaseCharacterStyleOptions) { super({ ...options, @@ -136,7 +136,7 @@ export class FootnoteReferenceStyle extends CharacterStyle { } } -export class FootnoteTextChar extends CharacterStyle { +export class FootnoteTextChar extends StyleForCharacter { constructor(options: IBaseCharacterStyleOptions) { super({ ...options, @@ -152,7 +152,7 @@ export class FootnoteTextChar extends CharacterStyle { } } -export class HyperlinkStyle extends CharacterStyle { +export class HyperlinkStyle extends StyleForCharacter { constructor(options: IBaseCharacterStyleOptions) { super({ ...options, diff --git a/src/file/styles/style/paragraph-style.spec.ts b/src/file/styles/style/paragraph-style.spec.ts index 92b798f862..8683234793 100644 --- a/src/file/styles/style/paragraph-style.spec.ts +++ b/src/file/styles/style/paragraph-style.spec.ts @@ -6,12 +6,12 @@ import { UnderlineType } from "file/paragraph/run/underline"; import { ShadingType } from "file/table"; import { EMPTY_OBJECT } from "file/xml-components"; -import { ParagraphStyle } from "./paragraph-style"; +import { StyleForParagraph } from "./paragraph-style"; describe("ParagraphStyle", () => { describe("#constructor", () => { it("should set the style type to paragraph and use the given style id", () => { - const style = new ParagraphStyle({ id: "myStyleId" }); + const style = new StyleForParagraph({ id: "myStyleId" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": { _attr: { "w:type": "paragraph", "w:styleId": "myStyleId" } }, @@ -19,7 +19,7 @@ describe("ParagraphStyle", () => { }); it("should set the name of the style, if given", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", name: "Style Name", }); @@ -35,7 +35,7 @@ describe("ParagraphStyle", () => { describe("formatting methods: style attributes", () => { it("#basedOn", () => { - const style = new ParagraphStyle({ id: "myStyleId", basedOn: "otherId" }); + const style = new StyleForParagraph({ id: "myStyleId", basedOn: "otherId" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -46,7 +46,7 @@ describe("ParagraphStyle", () => { }); it("#quickFormat", () => { - const style = new ParagraphStyle({ id: "myStyleId", quickFormat: true }); + const style = new StyleForParagraph({ id: "myStyleId", quickFormat: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -62,7 +62,7 @@ describe("ParagraphStyle", () => { }); it("#next", () => { - const style = new ParagraphStyle({ id: "myStyleId", next: "otherId" }); + const style = new StyleForParagraph({ id: "myStyleId", next: "otherId" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -75,7 +75,7 @@ describe("ParagraphStyle", () => { describe("formatting methods: paragraph properties", () => { it("#indent", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { indent: { left: 720 }, @@ -93,7 +93,7 @@ describe("ParagraphStyle", () => { }); it("#spacing", () => { - const style = new ParagraphStyle({ id: "myStyleId", paragraph: { spacing: { before: 50, after: 150 } } }); + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { spacing: { before: 50, after: 150 } } }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -106,7 +106,7 @@ describe("ParagraphStyle", () => { }); it("#center", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { alignment: AlignmentType.CENTER, @@ -124,7 +124,7 @@ describe("ParagraphStyle", () => { }); it("#character spacing", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { characterSpacing: 24, @@ -142,7 +142,7 @@ describe("ParagraphStyle", () => { }); it("#left", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { alignment: AlignmentType.LEFT, @@ -160,7 +160,7 @@ describe("ParagraphStyle", () => { }); it("#right", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { alignment: AlignmentType.RIGHT, @@ -178,7 +178,7 @@ describe("ParagraphStyle", () => { }); it("#justified", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { alignment: AlignmentType.JUSTIFIED, @@ -196,7 +196,7 @@ describe("ParagraphStyle", () => { }); it("#thematicBreak", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { thematicBreak: true, @@ -229,7 +229,7 @@ describe("ParagraphStyle", () => { }); it("#contextualSpacing", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { contextualSpacing: true, @@ -255,7 +255,7 @@ describe("ParagraphStyle", () => { }); it("#leftTabStop", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { leftTabStop: 1200, @@ -277,7 +277,7 @@ describe("ParagraphStyle", () => { }); it("#maxRightTabStop", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { rightTabStop: TabStopPosition.MAX, @@ -299,7 +299,7 @@ describe("ParagraphStyle", () => { }); it("#keepLines", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { keepLines: true, @@ -320,7 +320,7 @@ describe("ParagraphStyle", () => { }); it("#keepNext", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { keepNext: true, @@ -341,7 +341,7 @@ describe("ParagraphStyle", () => { }); it("#outlineLevel", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", paragraph: { outlineLevel: 1, @@ -381,7 +381,7 @@ describe("ParagraphStyle", () => { ]; sizeTests.forEach(({ size, sizeComplexScript, expected }) => { it(`#size ${size} cs ${sizeComplexScript}`, () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { size, sizeComplexScript }, }); @@ -393,7 +393,7 @@ describe("ParagraphStyle", () => { }); it("#smallCaps", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { smallCaps: true, @@ -411,7 +411,7 @@ describe("ParagraphStyle", () => { }); it("#allCaps", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { allCaps: true, @@ -429,7 +429,7 @@ describe("ParagraphStyle", () => { }); it("#strike", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { strike: true, @@ -447,7 +447,7 @@ describe("ParagraphStyle", () => { }); it("#doubleStrike", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { doubleStrike: true, @@ -465,7 +465,7 @@ describe("ParagraphStyle", () => { }); it("#subScript", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { subScript: true, @@ -483,7 +483,7 @@ describe("ParagraphStyle", () => { }); it("#superScript", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { superScript: true, @@ -501,7 +501,7 @@ describe("ParagraphStyle", () => { }); it("#font by name", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { font: "Times", @@ -530,7 +530,7 @@ describe("ParagraphStyle", () => { }); it("#font for ascii and eastAsia", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { font: { @@ -577,7 +577,7 @@ describe("ParagraphStyle", () => { ]; boldTests.forEach(({ bold, boldComplexScript, expected }) => { it(`#bold ${bold} cs ${boldComplexScript}`, () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { bold, boldComplexScript }, }); @@ -606,7 +606,7 @@ describe("ParagraphStyle", () => { ]; italicsTests.forEach(({ italics, italicsComplexScript, expected }) => { it(`#italics ${italics} cs ${italicsComplexScript}`, () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { italics, italicsComplexScript }, }); @@ -640,7 +640,7 @@ describe("ParagraphStyle", () => { ]; highlightTests.forEach(({ highlight, highlightComplexScript, expected }) => { it(`#highlight ${highlight} cs ${highlightComplexScript}`, () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { highlight, highlightComplexScript }, }); @@ -714,7 +714,7 @@ describe("ParagraphStyle", () => { ]; shadingTests.forEach(({ shadow, shading, shadingComplexScript, expected }) => { it("#shadow correctly", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { shadow, shading, shadingComplexScript }, }); @@ -727,7 +727,7 @@ describe("ParagraphStyle", () => { describe("#underline", () => { it("should set underline to 'single' if no arguments are given", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { underline: {}, @@ -745,7 +745,7 @@ describe("ParagraphStyle", () => { }); it("should set the style if given", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { underline: { @@ -765,7 +765,7 @@ describe("ParagraphStyle", () => { }); it("should set the style and color if given", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { underline: { @@ -788,7 +788,7 @@ describe("ParagraphStyle", () => { describe("#emphasisMark", () => { it("should set emphasisMark to 'dot' if no arguments are given", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { emphasisMark: {}, @@ -806,7 +806,7 @@ describe("ParagraphStyle", () => { }); it("should set the style if given", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { emphasisMark: { @@ -827,7 +827,7 @@ describe("ParagraphStyle", () => { }); it("#color", () => { - const style = new ParagraphStyle({ + const style = new StyleForParagraph({ id: "myStyleId", run: { color: "123456", @@ -845,7 +845,7 @@ describe("ParagraphStyle", () => { }); it("#link", () => { - const style = new ParagraphStyle({ id: "myStyleId", link: "MyLink" }); + const style = new StyleForParagraph({ id: "myStyleId", link: "MyLink" }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -861,7 +861,7 @@ describe("ParagraphStyle", () => { }); it("#semiHidden", () => { - const style = new ParagraphStyle({ id: "myStyleId", semiHidden: true }); + const style = new StyleForParagraph({ id: "myStyleId", semiHidden: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -877,7 +877,7 @@ describe("ParagraphStyle", () => { }); it("#uiPriority", () => { - const style = new ParagraphStyle({ id: "myStyleId", uiPriority: 99 }); + const style = new StyleForParagraph({ id: "myStyleId", uiPriority: 99 }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ @@ -894,7 +894,7 @@ describe("ParagraphStyle", () => { }); it("#unhideWhenUsed", () => { - const style = new ParagraphStyle({ id: "myStyleId", unhideWhenUsed: true }); + const style = new StyleForParagraph({ id: "myStyleId", unhideWhenUsed: true }); const tree = new Formatter().format(style); expect(tree).to.deep.equal({ "w:style": [ diff --git a/src/file/styles/style/paragraph-style.ts b/src/file/styles/style/paragraph-style.ts index 635e7b7e2f..25c035e514 100644 --- a/src/file/styles/style/paragraph-style.ts +++ b/src/file/styles/style/paragraph-style.ts @@ -21,7 +21,7 @@ export interface IParagraphStyleOptions extends IBaseParagraphStyleOptions { readonly name?: string; } -export class ParagraphStyle extends Style { +export class StyleForParagraph extends Style { private readonly paragraphProperties: ParagraphProperties; private readonly runProperties: RunProperties; diff --git a/src/file/styles/styles.ts b/src/file/styles/styles.ts index 45efe9f784..1fbc4b5e50 100644 --- a/src/file/styles/styles.ts +++ b/src/file/styles/styles.ts @@ -1,6 +1,6 @@ import { BaseXmlComponent, ImportedXmlComponent, XmlComponent } from "file/xml-components"; -import { CharacterStyle, ParagraphStyle } from "./style"; +import { StyleForCharacter, StyleForParagraph } from "./style"; import { ICharacterStyleOptions } from "./style/character-style"; import { IParagraphStyleOptions } from "./style/paragraph-style"; export * from "./border"; @@ -9,7 +9,7 @@ export interface IStylesOptions { readonly initialStyles?: BaseXmlComponent; readonly paragraphStyles?: IParagraphStyleOptions[]; readonly characterStyles?: ICharacterStyleOptions[]; - readonly importedStyles?: (XmlComponent | ParagraphStyle | CharacterStyle | ImportedXmlComponent)[]; + readonly importedStyles?: (XmlComponent | StyleForParagraph | StyleForCharacter | ImportedXmlComponent)[]; } export class Styles extends XmlComponent { @@ -28,13 +28,13 @@ export class Styles extends XmlComponent { if (options.paragraphStyles) { for (const style of options.paragraphStyles) { - this.root.push(new ParagraphStyle(style)); + this.root.push(new StyleForParagraph(style)); } } if (options.characterStyles) { for (const style of options.characterStyles) { - this.root.push(new CharacterStyle(style)); + this.root.push(new StyleForCharacter(style)); } } } From f6a4d78ab77c38792711ada866caaa0defb33481 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 6 Nov 2020 01:51:59 +0000 Subject: [PATCH 057/107] Add checks when submitting PR --- .github/workflows/default.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 77744603c6..a063d1ee1d 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -3,6 +3,9 @@ on: push: branches: - master + pull_request: + branches: + - master jobs: build: From 27638063c854dab5cf7cee5c5b1dbb6c3d15baf7 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 6 Nov 2020 02:08:09 +0000 Subject: [PATCH 058/107] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8db7237c59..2460a5d498 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ Read the contribution guidelines [here](https://docx.js.org/#/contribution-guide [drawing](https://www.beekast.com/) [drawing](https://herraizsoto.com/) [drawing](http://www.ativer.com.br/) +[drawing](https://www.arity.co/) ...and many more! From 5d6bc039d0053a58c5d43daee37637aa22ac64fe Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 11 Nov 2020 07:56:26 +0000 Subject: [PATCH 059/107] build(deps-dev): bump @types/mocha from 8.0.3 to 8.0.4 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.3 to 8.0.4. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0566ca4d6..4d034e41eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.3.0", + "version": "5.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.3.tgz", - "integrity": "sha512-vyxR57nv8NfcU0GZu8EUXZLTbCMupIUwy95LJ6lllN+JRPG25CwMHoB1q5xKh8YKhQnHYRAn4yW2yuHbf/5xgg==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.4.tgz", + "integrity": "sha512-M4BwiTJjHmLq6kjON7ZoI2JMlBvpY3BYSdiP6s/qCT3jb1s9/DeJF0JELpAxiVSIxXDzfNKe+r7yedMIoLbknQ==", "dev": true }, "@types/node": { From e9adb8b0edf68c358b326abec22c8999f0e2c281 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 12 Nov 2020 08:27:51 +0000 Subject: [PATCH 060/107] build(deps-dev): bump @types/webpack from 4.41.24 to 4.41.25 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.41.24 to 4.41.25. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index e0566ca4d6..152f922515 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.3.0", + "version": "5.4.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -670,9 +670,9 @@ } }, "@types/webpack": { - "version": "4.41.24", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.24.tgz", - "integrity": "sha512-1A0MXPwZiMOD3DPMuOKUKcpkdPo8Lq33UGggZ7xio6wJ/jV1dAu5cXDrOfGDnldUroPIRLsr/DT43/GqOA4RFQ==", + "version": "4.41.25", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.25.tgz", + "integrity": "sha512-cr6kZ+4m9lp86ytQc1jPOJXgINQyz3kLLunZ57jznW+WIAL0JqZbGubQk4GlD42MuQL5JGOABrxdpqqWeovlVQ==", "dev": true, "requires": { "@types/anymatch": "*", From b2fea471f181b9b1de5f09330c3c25d9158275e7 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 15 Nov 2020 23:03:44 +0000 Subject: [PATCH 061/107] Add workaround to include file in build --- src/file/paragraph/math/math-component.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/file/paragraph/math/math-component.ts b/src/file/paragraph/math/math-component.ts index afe83235f4..8251235455 100644 --- a/src/file/paragraph/math/math-component.ts +++ b/src/file/paragraph/math/math-component.ts @@ -19,3 +19,9 @@ export type MathComponent = | MathCurlyBrackets | MathAngledBrackets | MathSquareBrackets; + +// Needed because of: https://github.com/s-panferov/awesome-typescript-loader/issues/432 +/** + * @ignore + */ +export const WORKAROUND4 = ""; From 825136d1c9a9348936f4ac4faf124e09bcb10af0 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Sun, 15 Nov 2020 23:04:27 +0000 Subject: [PATCH 062/107] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e3a678600..be21f2a5f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.4.0", + "version": "5.4.1", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From ffba276f0d1440520807ab21cac8161090c84306 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2020 11:13:13 +0000 Subject: [PATCH 063/107] build(deps-dev): bump docsify-cli from 4.4.1 to 4.4.2 Bumps [docsify-cli](https://github.com/docsifyjs/docsify-cli) from 4.4.1 to 4.4.2. - [Release notes](https://github.com/docsifyjs/docsify-cli/releases) - [Changelog](https://github.com/docsifyjs/docsify-cli/blob/master/CHANGELOG.md) - [Commits](https://github.com/docsifyjs/docsify-cli/compare/v4.4.1...v4.4.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 542 ++++++++++++++++++++++++++++------------------ 1 file changed, 336 insertions(+), 206 deletions(-) diff --git a/package-lock.json b/package-lock.json index f8f284fd13..8f152543c2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.4.0", + "version": "5.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -812,6 +812,12 @@ } } }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -1360,51 +1366,112 @@ "dev": true }, "boxen": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-3.2.0.tgz", - "integrity": "sha512-cU4J/+NodM3IHdSL2yN8bqYqnmlBTidDR4RC7nJs61ZmtGz8VZzM3HLQX0zY5mrSmPtR3xWwsq2jOUQqFZN8+A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-4.2.0.tgz", + "integrity": "sha512-eB4uT9RGzg2odpER62bBwSLvUeGC+WbRjjyyFhGsKnc8wp/m0+hQsMUvUe3H2V0D5vw0nBdO1hCJoZo5mKeuIQ==", "dev": true, "requires": { "ansi-align": "^3.0.0", "camelcase": "^5.3.1", - "chalk": "^2.4.2", + "chalk": "^3.0.0", "cli-boxes": "^2.2.0", - "string-width": "^3.0.0", - "term-size": "^1.2.0", - "type-fest": "^0.3.0", - "widest-line": "^2.0.0" + "string-width": "^4.1.0", + "term-size": "^2.1.0", + "type-fest": "^0.8.1", + "widest-line": "^3.1.0" }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "dev": true }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" } }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } } } @@ -1599,9 +1666,9 @@ }, "dependencies": { "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, "requires": { "pump": "^3.0.0" @@ -1768,9 +1835,9 @@ "dev": true }, "cli-boxes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", - "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, "clipboard": { @@ -1916,34 +1983,17 @@ } }, "configstore": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-4.0.0.tgz", - "integrity": "sha512-CmquAXFBocrzaSM8mtGPMM/HiWmyIpr4CcJl/rgY2uCObZ/S7cKU0silxslqJejl+t/T9HS8E0PUNQD81JGUEQ==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", "dev": true, "requires": { - "dot-prop": "^4.1.0", + "dot-prop": "^5.2.0", "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" - }, - "dependencies": { - "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" } }, "connect": { @@ -2085,9 +2135,9 @@ } }, "crypto-random-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", - "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, "cycle": { @@ -2306,25 +2356,25 @@ } }, "docsify": { - "version": "4.11.4", - "resolved": "https://registry.npmjs.org/docsify/-/docsify-4.11.4.tgz", - "integrity": "sha512-Qwt98y6ddM2Wb46gRH/zQpEAvw70AlIpzVlB9Wi2u2T2REg9O+bXMpJ27F5TaRTn2bD6SF1VyZYNUfimpihZwQ==", + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/docsify/-/docsify-4.11.6.tgz", + "integrity": "sha512-6h3hB2Ni7gpOeu1fl1sDOmufuplIDmeFHsps17Qbg9VOS3h2tJ63FiW2w5oAydGyzaLrqu58FV7Mg4b6p0z9mg==", "dev": true, "requires": { "dompurify": "^2.0.8", - "marked": "^0.7.0", - "medium-zoom": "^1.0.5", + "marked": "^1.1.1", + "medium-zoom": "^1.0.6", "opencollective-postinstall": "^2.0.2", "prismjs": "^1.19.0", "strip-indent": "^3.0.0", - "tinydate": "^1.0.0", + "tinydate": "^1.3.0", "tweezer.js": "^1.4.0" } }, "docsify-cli": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/docsify-cli/-/docsify-cli-4.4.1.tgz", - "integrity": "sha512-M5VU/8UCILz87D519KnURH3LA+A3RAAqj7ifDv4xOUf4c32QDkWSETS3yLmXlTNdxhATVi5P1fVklnvVW4uOyw==", + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/docsify-cli/-/docsify-cli-4.4.2.tgz", + "integrity": "sha512-iCTRyKjjNiSroo5cgVkb/C86PsUEEsVV30PXp5GkzbcMG+mMxzBPmJ/8xukTLoeaQddEsSeSWW376eC2t4KQJw==", "dev": true, "requires": { "chalk": "^2.4.2", @@ -2333,13 +2383,14 @@ "cp-file": "^7.0.0", "docsify": "^4.10.2", "docsify-server-renderer": ">=4", + "enquirer": "^2.3.6", "fs-extra": "^8.1.0", "get-port": "^5.0.0", "livereload": "^0.9.1", "lru-cache": "^5.1.1", "open": "^6.4.0", "serve-static": "^1.12.1", - "update-notifier": "^3.0.1", + "update-notifier": "^4.1.0", "yargonaut": "^1.1.2", "yargs": "^14.2.0" }, @@ -2376,17 +2427,6 @@ "locate-path": "^3.0.0" } }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -2489,25 +2529,25 @@ } }, "docsify-server-renderer": { - "version": "4.11.4", - "resolved": "https://registry.npmjs.org/docsify-server-renderer/-/docsify-server-renderer-4.11.4.tgz", - "integrity": "sha512-TxOxqX/fwBFLHz788PtB0OeVis1EDWCVK8CEE/fvxTzQqsgZNTw2UO1wEg1qt/uuldJps3G+DPv/FN9xIeQgcg==", + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/docsify-server-renderer/-/docsify-server-renderer-4.11.6.tgz", + "integrity": "sha512-IAEM+kKsDfo1qnrEdaBH5pCQFjAWA7B7jWWmfCKzDA/BPcHO+zCR4++Mw/NPR/huJKU58AzuGtEJ/NhF/l0Y6Q==", "dev": true, "requires": { "debug": "^4.1.1", - "docsify": "^4.11.2", + "docsify": "^4.11.4", "dompurify": "^2.0.8", "node-fetch": "^2.6.0", "resolve-pathname": "^3.0.0" }, "dependencies": { "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", + "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", "dev": true, "requires": { - "ms": "^2.1.1" + "ms": "2.1.2" } }, "ms": { @@ -2525,18 +2565,18 @@ "dev": true }, "dompurify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.12.tgz", - "integrity": "sha512-Fl8KseK1imyhErHypFPA8qpq9gPzlsJ/EukA6yk9o0gX23p1TzC+rh9LqNg1qvErRTc0UNMYlKxEGSfSh43NDg==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.2.2.tgz", + "integrity": "sha512-BsGR4nDLaC5CNBnyT5I+d5pOeaoWvgVeg6Gq/aqmKYWMPR07131u60I80BvExLAJ0FQEIBQ1BTicw+C5+jOyrg==", "dev": true }, "dot-prop": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.1.tgz", - "integrity": "sha512-l0p4+mIuJIua0mhxGoh4a+iNL9bmeK5DvnSVQa6T0OhrVmaEa1XScX5Etc673FePCJOArq/4Pa2cLGODUWTPOQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", "dev": true, "requires": { - "is-obj": "^1.0.0" + "is-obj": "^2.0.0" } }, "duplexer3": { @@ -2615,6 +2655,15 @@ "tapable": "^0.2.5" } }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, "errno": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", @@ -2710,6 +2759,12 @@ "es6-symbol": "^3.1.1" } }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -3953,12 +4008,12 @@ } }, "global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-2.0.1.tgz", + "integrity": "sha512-5HqUqdhkEovj2Of/ms3IeS/EekcO54ytHRLV4PEY2rhRwrHXLQjeVEES0Lhka0xwNDtGYn58wyC4s5+MHsOO6A==", "dev": true, "requires": { - "ini": "^1.3.4" + "ini": "^1.3.5" } }, "globals": { @@ -4484,19 +4539,19 @@ } }, "is-installed-globally": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", - "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.3.2.tgz", + "integrity": "sha512-wZ8x1js7Ia0kecP/CHM/3ABkAmujX7WPvQk6uu3Fly/Mk44pySulQpnHG46OMjHGXApINnV4QhY3SWnECO2z5g==", "dev": true, "requires": { - "global-dirs": "^0.1.0", - "is-path-inside": "^1.0.0" + "global-dirs": "^2.0.1", + "is-path-inside": "^3.0.1" } }, "is-npm": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-3.0.0.tgz", - "integrity": "sha512-wsigDr1Kkschp2opC4G3yA6r9EgVA6NjRpWzIi9axXqeIaAATPRJc4uLujXe3Nd9uO8KoDyA4MD6aZSeXTADhA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-4.0.0.tgz", + "integrity": "sha512-96ECIfh9xtDDlPylNPXhzjsykHsMJZ18ASpaWzQyBr4YRTcVjUvzaHayDAES2oU/3KpljhHUjtSRNiDwi0F0ig==", "dev": true }, "is-number": { @@ -4520,19 +4575,16 @@ } }, "is-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", - "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "dev": true }, "is-path-inside": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", - "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", + "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", + "dev": true }, "is-plain-object": { "version": "2.0.4", @@ -5009,9 +5061,9 @@ } }, "chokidar": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.1.tgz", - "integrity": "sha512-TQTJyr2stihpC4Sya9hs2Xh+O2wf+igjL36Y75xx2WdHuiICcn/XJza46Jwt0eT5hVpQOzo3FpY3cj3RVYLX0g==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -5021,7 +5073,7 @@ "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.5.0" } }, "fill-range": { @@ -5071,9 +5123,9 @@ "dev": true }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dev": true, "requires": { "picomatch": "^2.2.1" @@ -5091,9 +5143,9 @@ } }, "livereload-js": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-3.2.4.tgz", - "integrity": "sha512-kgTCrrYAfwnb5469+7bB2hxIct8Giq0RemDnxOESIzyRwRqYGGMZh5VIveYqJiDvpglH0dpd074BU1zJj4NaNw==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/livereload-js/-/livereload-js-3.3.1.tgz", + "integrity": "sha512-CBu1gTEfzVhlOK1WASKAAJ9Qx1fHECTq0SUB67sfxwQssopTyvzqTlgl+c0h9pZ6V+Fzd2rc510ppuNusg9teQ==", "dev": true }, "load-json-file": { @@ -5253,9 +5305,9 @@ } }, "marked": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.7.0.tgz", - "integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.4.tgz", + "integrity": "sha512-6x5TFGCTKSQBLTZtOburGxCxFEBJEGYVLwCMTBCxzvyuisGcC20UNzDSJhCr/cJ/Kmh6ulfJm10g6WWEAJ3kvg==", "dev": true }, "math-random": { @@ -6090,9 +6142,9 @@ "dev": true }, "opts": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/opts/-/opts-2.0.0.tgz", - "integrity": "sha512-rPleeyX48sBEc4aj7rAok5dCbvRdYpdbIdSRR4gnIK98a7Rvd4l3wlv4YHQr2mwPQTpKQiw8uipi/WoyItDINg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opts/-/opts-2.0.2.tgz", + "integrity": "sha512-k41FwbcLnlgnFh69f4qdUfvDQ+5vaSDnVPFI/y5XuhKRq97EnVVneO9F1ESVCdiVu4fCS2L8usX3mU331hB7pg==", "dev": true }, "os-browserify": { @@ -6319,12 +6371,6 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", @@ -6498,9 +6544,9 @@ "dev": true }, "prismjs": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.21.0.tgz", - "integrity": "sha512-uGdSIu1nk3kej2iZsLyDoJ7e9bnPzIgY0naW/HdknGj61zScaprVEVGHrPoXqI+M9sP0NDnTK2jpkvmldpuqDw==", + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz", + "integrity": "sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==", "dev": true, "requires": { "clipboard": "^2.0.0" @@ -6594,6 +6640,15 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", @@ -6752,9 +6807,9 @@ } }, "registry-auth-token": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz", - "integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", "dev": true, "requires": { "rc": "^1.2.8" @@ -7157,12 +7212,20 @@ "dev": true }, "semver-diff": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", - "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", "dev": true, "requires": { - "semver": "^5.0.3" + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } } }, "send": { @@ -7754,36 +7817,10 @@ "dev": true }, "term-size": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", - "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", - "dev": true, - "requires": { - "execa": "^0.7.0" - }, - "dependencies": { - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - } - } + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", + "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", + "dev": true }, "test-exclude": { "version": "6.0.0", @@ -8053,9 +8090,9 @@ "dev": true }, "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "typedarray": { @@ -8252,12 +8289,12 @@ } }, "unique-string": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", - "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", "dev": true, "requires": { - "crypto-random-string": "^1.0.0" + "crypto-random-string": "^2.0.0" } }, "universalify": { @@ -8319,23 +8356,75 @@ "dev": true }, "update-notifier": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-3.0.1.tgz", - "integrity": "sha512-grrmrB6Zb8DUiyDIaeRTBCkgISYUgETNe7NglEbVsrLWXeESnlCSP50WfRSj/GmzMPl6Uchj24S/p80nP/ZQrQ==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", + "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", "dev": true, "requires": { - "boxen": "^3.0.0", - "chalk": "^2.0.1", - "configstore": "^4.0.0", + "boxen": "^4.2.0", + "chalk": "^3.0.0", + "configstore": "^5.0.1", "has-yarn": "^2.1.0", "import-lazy": "^2.1.0", "is-ci": "^2.0.0", - "is-installed-globally": "^0.1.0", - "is-npm": "^3.0.0", + "is-installed-globally": "^0.3.1", + "is-npm": "^4.0.0", "is-yarn-global": "^0.3.0", "latest-version": "^5.0.0", - "semver-diff": "^2.0.0", - "xdg-basedir": "^3.0.0" + "pupa": "^2.0.1", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } } }, "uri-js": { @@ -8842,12 +8931,52 @@ "dev": true }, "widest-line": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.1.tgz", - "integrity": "sha512-Ba5m9/Fa4Xt9eb2ELXt77JxVDV8w7qQrH0zS/TWSJdLyAwQjWoOzpzj5lwVftDz6n/EOu3tNACS84v509qwnJA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", "dev": true, "requires": { - "string-width": "^2.1.1" + "string-width": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", + "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } } }, "window-size": { @@ -8930,14 +9059,15 @@ "dev": true }, "write-file-atomic": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", - "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, "requires": { - "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" } }, "ws": { @@ -8950,9 +9080,9 @@ } }, "xdg-basedir": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", - "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "dev": true }, "xml": { From d50423112477978f4733a4727b25aecd9e80a7a7 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2020 11:14:03 +0000 Subject: [PATCH 064/107] build(deps-dev): bump prettier from 2.1.2 to 2.2.0 Bumps [prettier](https://github.com/prettier/prettier) from 2.1.2 to 2.2.0. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.1.2...2.2.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f152543c2..e9b6f3eebf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6538,9 +6538,9 @@ "dev": true }, "prettier": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", - "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz", + "integrity": "sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==", "dev": true }, "prismjs": { From 8d4a07302b57dd21f424864b09c2cb72f6317b6e Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Tue, 24 Nov 2020 13:30:26 -0600 Subject: [PATCH 065/107] Add defaultStyles option to overwrite the core default styles (Heading 1-6, document, hyperlinks, etc) --- demo/11-declaritive-styles-2.ts | 120 ++++++++++--------------- demo/2-declaritive-styles.ts | 81 ++++++++--------- src/file/core-properties/properties.ts | 2 + src/file/file.ts | 4 +- src/file/styles/factory.ts | 41 +++++++-- 5 files changed, 121 insertions(+), 127 deletions(-) diff --git a/demo/11-declaritive-styles-2.ts b/demo/11-declaritive-styles-2.ts index 3a0154a0fb..10bc93c17e 100644 --- a/demo/11-declaritive-styles-2.ts +++ b/demo/11-declaritive-styles-2.ts @@ -17,74 +17,56 @@ import { } from "../build"; const doc = new Document({ + defaultStyles: { + heading1: { + run: { + font: "Calibri", + size: 52, + bold: true, + color: "000000", + underline: { + type: UnderlineType.SINGLE, + color: "000000", + }, + }, + paragraph: { + alignment: AlignmentType.CENTER, + spacing: { line: 340 }, + }, + }, + heading2: { + run: { + font: "Calibri", + size: 26, + bold: true, + }, + paragraph: { + spacing: { line: 340 }, + }, + }, + heading3: { + run: { + font: "Calibri", + size: 26, + bold: true, + }, + paragraph: { + spacing: { line: 276 }, + }, + }, + heading4: { + run: { + font: "Calibri", + size: 26, + bold: true, + }, + paragraph: { + alignment: AlignmentType.JUSTIFIED, + }, + }, + }, styles: { paragraphStyles: [ - { - id: "Heading1", - name: "Heading 1", - basedOn: "Normal", - next: "Normal", - quickFormat: true, - run: { - font: "Calibri", - size: 52, - bold: true, - color: "000000", - underline: { - type: UnderlineType.SINGLE, - color: "000000", - }, - }, - paragraph: { - alignment: AlignmentType.CENTER, - spacing: { line: 340 }, - }, - }, - { - id: "Heading2", - name: "Heading 2", - basedOn: "Normal", - next: "Normal", - quickFormat: true, - run: { - font: "Calibri", - size: 26, - bold: true, - }, - paragraph: { - spacing: { line: 340 }, - }, - }, - { - id: "Heading3", - name: "Heading 3", - basedOn: "Normal", - next: "Normal", - quickFormat: true, - run: { - font: "Calibri", - size: 26, - bold: true, - }, - paragraph: { - spacing: { line: 276 }, - }, - }, - { - id: "Heading4", - name: "Heading 4", - basedOn: "Normal", - next: "Normal", - quickFormat: true, - run: { - font: "Calibri", - size: 26, - bold: true, - }, - paragraph: { - alignment: AlignmentType.JUSTIFIED, - }, - }, { id: "normalPara", name: "Normal Para", @@ -139,12 +121,6 @@ const doc = new Document({ spacing: { line: 276, before: 20 * 72 * 0.1, after: 20 * 72 * 0.05 }, }, }, - { - id: "ListParagraph", - name: "List Paragraph", - basedOn: "Normal", - quickFormat: true, - }, ], }, }); diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index c34eae9628..f01877a8d5 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -7,47 +7,44 @@ const doc = new Document({ creator: "Clippy", title: "Sample Document", description: "A brief example of using docx", + defaultStyles: { + heading1: { + run: { + size: 28, + bold: true, + italics: true, + color: "red", + }, + paragraph: { + spacing: { + after: 120, + }, + }, + }, + heading2: { + run: { + size: 26, + bold: true, + underline: { + type: UnderlineType.DOUBLE, + color: "FF0000", + }, + }, + paragraph: { + spacing: { + before: 240, + after: 120, + }, + }, + }, + listParagraph: { + run: { + color: '#FF0000' + } + } + }, styles: { paragraphStyles: [ - { - id: "Heading1", - name: "Heading 1", - basedOn: "Normal", - next: "Normal", - quickFormat: true, - run: { - size: 28, - bold: true, - italics: true, - color: "red", - }, - paragraph: { - spacing: { - after: 120, - }, - }, - }, - { - id: "Heading2", - name: "Heading 2", - basedOn: "Normal", - next: "Normal", - quickFormat: true, - run: { - size: 26, - bold: true, - underline: { - type: UnderlineType.DOUBLE, - color: "FF0000", - }, - }, - paragraph: { - spacing: { - before: 240, - after: 120, - }, - }, - }, { id: "aside", name: "Aside", @@ -75,12 +72,6 @@ const doc = new Document({ spacing: { line: 276, before: 20 * 72 * 0.1, after: 20 * 72 * 0.05 }, }, }, - { - id: "ListParagraph", - name: "List Paragraph", - basedOn: "Normal", - quickFormat: true, - }, ], }, numbering: { diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index ae9f227ad5..3fb3dbdc7c 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -1,3 +1,4 @@ +import { IDefaultStylesOptions } from "docx/src/file/styles/factory"; import { XmlComponent } from "file/xml-components"; import { IDocumentBackgroundOptions } from "../document"; @@ -28,6 +29,7 @@ export interface IPropertiesOptions { readonly revision?: string; readonly externalStyles?: string; readonly styles?: IStylesOptions; + readonly defaultStyles?: IDefaultStylesOptions; readonly numbering?: INumberingOptions; readonly footnotes?: Paragraph[]; readonly hyperlinks?: { diff --git a/src/file/file.ts b/src/file/file.ts index 1c655253de..2c351f3df3 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -106,14 +106,14 @@ export class File { this.styles = stylesFactory.newInstance(options.externalStyles); } else if (options.styles) { const stylesFactory = new DefaultStylesFactory(); - const defaultStyles = stylesFactory.newInstance(); + const defaultStyles = stylesFactory.newInstance(options.defaultStyles); this.styles = new Styles({ ...defaultStyles, ...options.styles, }); } else { const stylesFactory = new DefaultStylesFactory(); - this.styles = new Styles(stylesFactory.newInstance()); + this.styles = new Styles(stylesFactory.newInstance(options.defaultStyles)); } this.addDefaultRelationships(); diff --git a/src/file/styles/factory.ts b/src/file/styles/factory.ts index f5bca8248d..da4c268447 100644 --- a/src/file/styles/factory.ts +++ b/src/file/styles/factory.ts @@ -1,7 +1,7 @@ import { DocumentAttributes } from "../document/document-attributes"; import { IStylesOptions } from "./styles"; -import { DocumentDefaults } from "./defaults"; +import { DocumentDefaults, IDocumentDefaultsOptions } from "./defaults"; import { FootnoteReferenceStyle, FootnoteText, @@ -13,12 +13,30 @@ import { Heading5Style, Heading6Style, HyperlinkStyle, + IBaseCharacterStyleOptions, + IBaseParagraphStyleOptions, ListParagraph, TitleStyle, } from "./style"; +export interface IDefaultStylesOptions { + readonly document?: IDocumentDefaultsOptions; + readonly title?: IBaseParagraphStyleOptions; + readonly heading1?: IBaseParagraphStyleOptions; + readonly heading2?: IBaseParagraphStyleOptions; + readonly heading3?: IBaseParagraphStyleOptions; + readonly heading4?: IBaseParagraphStyleOptions; + readonly heading5?: IBaseParagraphStyleOptions; + readonly heading6?: IBaseParagraphStyleOptions; + readonly listParagraph?: IBaseParagraphStyleOptions; + readonly hyperlink?: IBaseCharacterStyleOptions; + readonly footnoteReference?: IBaseCharacterStyleOptions; + readonly footnoteText?: IBaseParagraphStyleOptions; + readonly footnoteTextChar?: IBaseCharacterStyleOptions; +} + export class DefaultStylesFactory { - public newInstance(): IStylesOptions { + public newInstance(options: IDefaultStylesOptions = {}): IStylesOptions { const documentAttributes = new DocumentAttributes({ mc: "http://schemas.openxmlformats.org/markup-compatibility/2006", r: "http://schemas.openxmlformats.org/officeDocument/2006/relationships", @@ -30,51 +48,58 @@ export class DefaultStylesFactory { return { initialStyles: documentAttributes, importedStyles: [ - new DocumentDefaults(), + new DocumentDefaults(options.document), new TitleStyle({ run: { size: 56, }, + ...options.title, }), new Heading1Style({ run: { color: "2E74B5", size: 32, }, + ...options.heading1, }), new Heading2Style({ run: { color: "2E74B5", size: 26, }, + ...options.heading2, }), new Heading3Style({ run: { color: "1F4D78", size: 24, }, + ...options.heading3, }), new Heading4Style({ run: { color: "2E74B5", italics: true, }, + ...options.heading4, }), new Heading5Style({ run: { color: "2E74B5", }, + ...options.heading5, }), new Heading6Style({ run: { color: "1F4D78", }, + ...options.heading6, }), - new ListParagraph({}), - new HyperlinkStyle({}), - new FootnoteReferenceStyle({}), - new FootnoteText({}), - new FootnoteTextChar({}), + new ListParagraph(options.listParagraph || {}), + new HyperlinkStyle(options.hyperlink || {}), + new FootnoteReferenceStyle(options.footnoteReference || {}), + new FootnoteText(options.footnoteText || {}), + new FootnoteTextChar(options.footnoteTextChar || {}), ], }; } From f3ba62fd881fb84a4c9d3b7a201538f489fa7030 Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Tue, 24 Nov 2020 13:36:43 -0600 Subject: [PATCH 066/107] bugfix path --- src/file/core-properties/properties.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index 3fb3dbdc7c..a36828aca6 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -1,4 +1,4 @@ -import { IDefaultStylesOptions } from "docx/src/file/styles/factory"; +import { IDefaultStylesOptions } from "file/styles/factory"; import { XmlComponent } from "file/xml-components"; import { IDocumentBackgroundOptions } from "../document"; From f54192809fdc134498ee9dd7523e1a074ca37b1d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2020 23:10:41 +0000 Subject: [PATCH 067/107] build(deps): [security] bump highlight.js from 9.18.1 to 9.18.5 Bumps [highlight.js](https://github.com/highlightjs/highlight.js) from 9.18.1 to 9.18.5. **This update includes a security fix.** - [Release notes](https://github.com/highlightjs/highlight.js/releases) - [Changelog](https://github.com/highlightjs/highlight.js/blob/9.18.5/CHANGES.md) - [Commits](https://github.com/highlightjs/highlight.js/compare/9.18.1...9.18.5) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8f152543c2..b7900a9a69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4249,9 +4249,9 @@ "dev": true }, "highlight.js": { - "version": "9.18.1", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz", - "integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg==", + "version": "9.18.5", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.5.tgz", + "integrity": "sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA==", "dev": true }, "hmac-drbg": { From 277845626c3ddd8f4dca35aae9d9068f2b5abff9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Nov 2020 08:29:40 +0000 Subject: [PATCH 068/107] build(deps-dev): bump prettier from 2.2.0 to 2.2.1 Bumps [prettier](https://github.com/prettier/prettier) from 2.2.0 to 2.2.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.2.0...2.2.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 59c0aabad3..9ceb87e4ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6538,9 +6538,9 @@ "dev": true }, "prettier": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.0.tgz", - "integrity": "sha512-yYerpkvseM4iKD/BXLYUkQV5aKt4tQPqaGW6EsZjzyu0r7sVZZNPJW4Y8MyKmicp6t42XUPcBVA+H6sB3gqndw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "dev": true }, "prismjs": { From 30ab92652c6b32a93587e6cac0d020bb37b158e6 Mon Sep 17 00:00:00 2001 From: Tom Hunkapiller Date: Mon, 30 Nov 2020 10:25:58 -0600 Subject: [PATCH 069/107] move file options.defaultStyles to options.styles.default --- demo/11-declaritive-styles-2.ts | 88 +++++++++++++------------- demo/2-declaritive-styles.ts | 72 ++++++++++----------- src/file/core-properties/properties.ts | 2 - src/file/file.ts | 4 +- src/file/styles/styles.ts | 3 +- 5 files changed, 84 insertions(+), 85 deletions(-) diff --git a/demo/11-declaritive-styles-2.ts b/demo/11-declaritive-styles-2.ts index 10bc93c17e..5fe9e16ae6 100644 --- a/demo/11-declaritive-styles-2.ts +++ b/demo/11-declaritive-styles-2.ts @@ -17,55 +17,55 @@ import { } from "../build"; const doc = new Document({ - defaultStyles: { - heading1: { - run: { - font: "Calibri", - size: 52, - bold: true, - color: "000000", - underline: { - type: UnderlineType.SINGLE, + styles: { + default: { + heading1: { + run: { + font: "Calibri", + size: 52, + bold: true, color: "000000", + underline: { + type: UnderlineType.SINGLE, + color: "000000", + }, + }, + paragraph: { + alignment: AlignmentType.CENTER, + spacing: { line: 340 }, }, }, - paragraph: { - alignment: AlignmentType.CENTER, - spacing: { line: 340 }, + heading2: { + run: { + font: "Calibri", + size: 26, + bold: true, + }, + paragraph: { + spacing: { line: 340 }, + }, + }, + heading3: { + run: { + font: "Calibri", + size: 26, + bold: true, + }, + paragraph: { + spacing: { line: 276 }, + }, + }, + heading4: { + run: { + font: "Calibri", + size: 26, + bold: true, + }, + paragraph: { + alignment: AlignmentType.JUSTIFIED, + }, }, }, - heading2: { - run: { - font: "Calibri", - size: 26, - bold: true, - }, - paragraph: { - spacing: { line: 340 }, - }, - }, - heading3: { - run: { - font: "Calibri", - size: 26, - bold: true, - }, - paragraph: { - spacing: { line: 276 }, - }, - }, - heading4: { - run: { - font: "Calibri", - size: 26, - bold: true, - }, - paragraph: { - alignment: AlignmentType.JUSTIFIED, - }, - }, - }, - styles: { paragraphStyles: [ { id: "normalPara", diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index f01877a8d5..6f3add1f19 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -7,43 +7,43 @@ const doc = new Document({ creator: "Clippy", title: "Sample Document", description: "A brief example of using docx", - defaultStyles: { - heading1: { - run: { - size: 28, - bold: true, - italics: true, - color: "red", - }, - paragraph: { - spacing: { - after: 120, - }, - }, - }, - heading2: { - run: { - size: 26, - bold: true, - underline: { - type: UnderlineType.DOUBLE, - color: "FF0000", - }, - }, - paragraph: { - spacing: { - before: 240, - after: 120, - }, - }, - }, - listParagraph: { - run: { - color: '#FF0000' - } - } - }, styles: { + default: { + heading1: { + run: { + size: 28, + bold: true, + italics: true, + color: "red", + }, + paragraph: { + spacing: { + after: 120, + }, + }, + }, + heading2: { + run: { + size: 26, + bold: true, + underline: { + type: UnderlineType.DOUBLE, + color: "FF0000", + }, + }, + paragraph: { + spacing: { + before: 240, + after: 120, + }, + }, + }, + listParagraph: { + run: { + color: '#FF0000' + } + } + }, paragraphStyles: [ { id: "aside", diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index a36828aca6..ae9f227ad5 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -1,4 +1,3 @@ -import { IDefaultStylesOptions } from "file/styles/factory"; import { XmlComponent } from "file/xml-components"; import { IDocumentBackgroundOptions } from "../document"; @@ -29,7 +28,6 @@ export interface IPropertiesOptions { readonly revision?: string; readonly externalStyles?: string; readonly styles?: IStylesOptions; - readonly defaultStyles?: IDefaultStylesOptions; readonly numbering?: INumberingOptions; readonly footnotes?: Paragraph[]; readonly hyperlinks?: { diff --git a/src/file/file.ts b/src/file/file.ts index 2c351f3df3..90986d16d7 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -106,14 +106,14 @@ export class File { this.styles = stylesFactory.newInstance(options.externalStyles); } else if (options.styles) { const stylesFactory = new DefaultStylesFactory(); - const defaultStyles = stylesFactory.newInstance(options.defaultStyles); + const defaultStyles = stylesFactory.newInstance(options.styles.default); this.styles = new Styles({ ...defaultStyles, ...options.styles, }); } else { const stylesFactory = new DefaultStylesFactory(); - this.styles = new Styles(stylesFactory.newInstance(options.defaultStyles)); + this.styles = new Styles(stylesFactory.newInstance()); } this.addDefaultRelationships(); diff --git a/src/file/styles/styles.ts b/src/file/styles/styles.ts index 1fbc4b5e50..1906b45ba0 100644 --- a/src/file/styles/styles.ts +++ b/src/file/styles/styles.ts @@ -1,11 +1,12 @@ +import { IDefaultStylesOptions } from "file/styles/factory"; import { BaseXmlComponent, ImportedXmlComponent, XmlComponent } from "file/xml-components"; - import { StyleForCharacter, StyleForParagraph } from "./style"; import { ICharacterStyleOptions } from "./style/character-style"; import { IParagraphStyleOptions } from "./style/paragraph-style"; export * from "./border"; export interface IStylesOptions { + readonly default?: IDefaultStylesOptions; readonly initialStyles?: BaseXmlComponent; readonly paragraphStyles?: IParagraphStyleOptions[]; readonly characterStyles?: ICharacterStyleOptions[]; From feb121707d03c17a318002928c7192956edf79d4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 3 Dec 2020 08:01:46 +0000 Subject: [PATCH 070/107] build(deps-dev): bump ts-node from 9.0.0 to 9.1.0 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 9.0.0 to 9.1.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v9.0.0...v9.1.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9ceb87e4ad..5a33ceeb66 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2104,6 +2104,12 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -7952,12 +7958,13 @@ "dev": true }, "ts-node": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", - "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.0.tgz", + "integrity": "sha512-0yqcL4sgruCvM+w64LiAfNJo6+lHfCYc5Ajj4yiLNkJ9oZ2HWaa+Kso7htYOOxVQ7+csAjdUjffOe9PIqC4pMg==", "dev": true, "requires": { "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", "source-map-support": "^0.5.17", From 3ee3e95410e9bf3f9f8da8922202812901afdb54 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 8 Dec 2020 08:49:26 +0000 Subject: [PATCH 071/107] build(deps-dev): bump ts-node from 9.1.0 to 9.1.1 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 9.1.0 to 9.1.1. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v9.1.0...v9.1.1) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a33ceeb66..6e58c62fa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7958,9 +7958,9 @@ "dev": true }, "ts-node": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.0.tgz", - "integrity": "sha512-0yqcL4sgruCvM+w64LiAfNJo6+lHfCYc5Ajj4yiLNkJ9oZ2HWaa+Kso7htYOOxVQ7+csAjdUjffOe9PIqC4pMg==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", + "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", "dev": true, "requires": { "arg": "^4.1.0", From 4c8829df28447625d2fd561bbf8aaa83cc7f222f Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 9 Dec 2020 08:04:12 +0000 Subject: [PATCH 072/107] build(deps-dev): bump @types/mocha from 8.0.4 to 8.2.0 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.0.4 to 8.2.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a33ceeb66..c1c2bc20e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -576,9 +576,9 @@ "dev": true }, "@types/mocha": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.0.4.tgz", - "integrity": "sha512-M4BwiTJjHmLq6kjON7ZoI2JMlBvpY3BYSdiP6s/qCT3jb1s9/DeJF0JELpAxiVSIxXDzfNKe+r7yedMIoLbknQ==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.0.tgz", + "integrity": "sha512-/Sge3BymXo4lKc31C8OINJgXLaw+7vL1/L1pGiBNpGrBiT8FQiaFpSYV0uhTaG4y78vcMBTMFsWaHDvuD+xGzQ==", "dev": true }, "@types/node": { From a0c13214e69aa1ad45a1a125cb6f35ce0d1414fc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 11 Dec 2020 08:22:49 +0000 Subject: [PATCH 073/107] build(deps-dev): bump @types/request-promise from 4.1.46 to 4.1.47 Bumps [@types/request-promise](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/request-promise) from 4.1.46 to 4.1.47. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/request-promise) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a33ceeb66..e665f2adf7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -538,9 +538,9 @@ "dev": true }, "@types/bluebird": { - "version": "3.5.32", - "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.32.tgz", - "integrity": "sha512-dIOxFfI0C+jz89g6lQ+TqhGgPQ0MxSnh/E4xuC0blhFtyW269+mPG5QeLgbdwst/LvdP8o1y0o/Gz5EHXLec/g==", + "version": "3.5.33", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.33.tgz", + "integrity": "sha512-ndEo1xvnYeHxm7I/5sF6tBvnsA4Tdi3zj1keRKRs12SP+2ye2A27NDJ1B6PqkfMbGAcT+mqQVqbZRIrhfOp5PQ==", "dev": true }, "@types/caseless": { @@ -612,9 +612,9 @@ } }, "@types/request-promise": { - "version": "4.1.46", - "resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.46.tgz", - "integrity": "sha512-3Thpj2Va5m0ji3spaCk8YKrjkZyZc6RqUVOphA0n/Xet66AW/AiOAs5vfXhQIL5NmkaO7Jnun7Nl9NEjJ2zBaw==", + "version": "4.1.47", + "resolved": "https://registry.npmjs.org/@types/request-promise/-/request-promise-4.1.47.tgz", + "integrity": "sha512-eRSZhAS8SMsrWOM8vbhxFGVZhTbWSJvaRKyufJTdIf4gscUouQvOBlfotPSPHbMR3S7kfkyKbhb1SWPmQdy3KQ==", "dev": true, "requires": { "@types/bluebird": "*", From 69ba312a9670a184213a34ee699250500b632043 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Dec 2020 22:47:35 +0000 Subject: [PATCH 074/107] build(deps): bump ini from 1.3.5 to 1.3.8 Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8. - [Release notes](https://github.com/isaacs/ini/releases) - [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8) Signed-off-by: dependabot[bot] --- package-lock.json | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a33ceeb66..fb03dc9344 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3501,13 +3501,6 @@ "dev": true, "optional": true }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true, - "optional": true - }, "is-fullwidth-code-point": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", @@ -4370,9 +4363,9 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, "interpret": { From 8bdde98db129684cec80ce94bebad8471d60dc7e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 15 Dec 2020 08:16:05 +0000 Subject: [PATCH 075/107] build(deps-dev): bump sinon from 9.2.1 to 9.2.2 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.2.1 to 9.2.2. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/commits/v9.2.2) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index d514c55a55..c0e33b855d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -498,9 +498,9 @@ } }, "@sinonjs/samsam": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.2.0.tgz", - "integrity": "sha512-CaIcyX5cDsjcW/ab7HposFWzV1kC++4HNsfnEdFJa7cP1QIuILAKV+BgfeqRXhcnSAc76r/Rh/O5C+300BwUIw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.0.tgz", + "integrity": "sha512-hXpcfx3aq+ETVBwPlRFICld5EnrkexXuXDwqUNhDdr5L8VjvMeSRwyOa0qL7XFmR+jVWR4rUZtnxlG7RX72sBg==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -7365,15 +7365,15 @@ "dev": true }, "sinon": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.1.tgz", - "integrity": "sha512-naPfsamB5KEE1aiioaoqJ6MEhdUs/2vtI5w1hPAXX/UwvoPjXcwh1m5HiKx0HGgKR8lQSoFIgY5jM6KK8VrS9w==", + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.2.tgz", + "integrity": "sha512-9Owi+RisvCZpB0bdOVFfL314I6I4YoRlz6Isi4+fr8q8YQsDPoCe5UnmNtKHRThX3negz2bXHWIuiPa42vM8EQ==", "dev": true, "requires": { "@sinonjs/commons": "^1.8.1", "@sinonjs/fake-timers": "^6.0.1", "@sinonjs/formatio": "^5.0.1", - "@sinonjs/samsam": "^5.2.0", + "@sinonjs/samsam": "^5.3.0", "diff": "^4.0.2", "nise": "^4.0.4", "supports-color": "^7.1.0" From 52f0a6958ae1e11a3a47ea15ece19f2727a52d5c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 22 Dec 2020 08:14:29 +0000 Subject: [PATCH 076/107] build(deps-dev): bump prompt from 1.0.0 to 1.1.0 Bumps [prompt](https://github.com/flatiron/prompt) from 1.0.0 to 1.1.0. - [Release notes](https://github.com/flatiron/prompt/releases) - [Changelog](https://github.com/flatiron/prompt/blob/master/CHANGELOG.md) - [Commits](https://github.com/flatiron/prompt/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/package-lock.json b/package-lock.json index d514c55a55..57c78507cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1932,9 +1932,9 @@ "dev": true }, "colors": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", - "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "dev": true }, "combined-stream": { @@ -5598,9 +5598,9 @@ "dev": true }, "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, "nan": { @@ -6501,12 +6501,6 @@ } } }, - "pkginfo": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.4.1.tgz", - "integrity": "sha1-tUGO8EOd5UJfxJlQQtztFPsqhP8=", - "dev": true - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -6578,17 +6572,16 @@ "dev": true }, "prompt": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prompt/-/prompt-1.0.0.tgz", - "integrity": "sha1-jlcSPDlquYiJf7Mn/Trtw+c15P4=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/prompt/-/prompt-1.1.0.tgz", + "integrity": "sha512-ec1vUPXCplDBDUVD8uPa3XGA+OzLrO40Vxv3F1uxoiZGkZhdctlK2JotcHq5X6ExjocDOGwGdCSXloGNyU5L1Q==", "dev": true, "requires": { "colors": "^1.1.2", - "pkginfo": "0.x.x", "read": "1.0.x", "revalidator": "0.1.x", "utile": "0.3.x", - "winston": "2.1.x" + "winston": "2.x" } }, "prr": { @@ -8986,9 +8979,9 @@ "dev": true }, "winston": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz", - "integrity": "sha1-PJNJ0ZYgf9G9/51LxD73JRDjoS4=", + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/winston/-/winston-2.4.5.tgz", + "integrity": "sha512-TWoamHt5yYvsMarGlGEQE59SbJHqGsZV8/lwC+iCcGeAe0vUaOh+Lv6SYM17ouzC/a/LB1/hz/7sxFBtlu1l4A==", "dev": true, "requires": { "async": "~1.0.0", @@ -8996,7 +8989,6 @@ "cycle": "1.0.x", "eyes": "0.1.x", "isstream": "0.1.x", - "pkginfo": "0.3.x", "stack-trace": "0.0.x" }, "dependencies": { @@ -9011,12 +9003,6 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true - }, - "pkginfo": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", - "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=", - "dev": true } } }, From a14a1fbd10560920cd15339d79a7e39c4f0f6927 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 22 Dec 2020 20:56:06 +0000 Subject: [PATCH 077/107] Update character style demo --- demo/51-character-styles.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/demo/51-character-styles.ts b/demo/51-character-styles.ts index 3230a7c86f..a6064a4ddc 100644 --- a/demo/51-character-styles.ts +++ b/demo/51-character-styles.ts @@ -15,6 +15,14 @@ const doc = new Document({ italics: true, }, }, + { + id: "strong", + name: "Strong", + basedOn: "Normal", + run: { + bold: true, + }, + }, ], }, }); @@ -29,6 +37,18 @@ doc.addSection({ }), ], }), + new Paragraph({ + children: [ + new TextRun({ + text: "First Word", + style: "strong", + }), + new TextRun({ + text: + " - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", + }), + ], + }), ], }); From 0afe0929a371c1e144253fb368054f3baf381c93 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 22 Dec 2020 21:08:10 +0000 Subject: [PATCH 078/107] Add strong default style --- demo/2-declaritive-styles.ts | 18 +++++++++++++++--- src/file/styles/factory.ts | 8 ++++++++ src/file/styles/style/default-styles.spec.ts | 14 ++++++++++++++ src/file/styles/style/default-styles.ts | 10 ++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index 6f3add1f19..b96056166e 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -40,9 +40,9 @@ const doc = new Document({ }, listParagraph: { run: { - color: '#FF0000' - } - } + color: "#FF0000", + }, + }, }, paragraphStyles: [ { @@ -161,6 +161,18 @@ doc.addSection({ }), ], }), + new Paragraph({ + style: "Strong", + children: [ + new TextRun({ + text: "Strong Style", + }), + new TextRun({ + text: + " - Very strong.", + }), + ], + }), ], }); diff --git a/src/file/styles/factory.ts b/src/file/styles/factory.ts index da4c268447..097c812433 100644 --- a/src/file/styles/factory.ts +++ b/src/file/styles/factory.ts @@ -16,6 +16,7 @@ import { IBaseCharacterStyleOptions, IBaseParagraphStyleOptions, ListParagraph, + StrongStyle, TitleStyle, } from "./style"; @@ -28,6 +29,7 @@ export interface IDefaultStylesOptions { readonly heading4?: IBaseParagraphStyleOptions; readonly heading5?: IBaseParagraphStyleOptions; readonly heading6?: IBaseParagraphStyleOptions; + readonly strong?: IBaseParagraphStyleOptions; readonly listParagraph?: IBaseParagraphStyleOptions; readonly hyperlink?: IBaseCharacterStyleOptions; readonly footnoteReference?: IBaseCharacterStyleOptions; @@ -95,6 +97,12 @@ export class DefaultStylesFactory { }, ...options.heading6, }), + new StrongStyle({ + run: { + bold: true, + }, + ...options.strong, + }), new ListParagraph(options.listParagraph || {}), new HyperlinkStyle(options.hyperlink || {}), new FootnoteReferenceStyle(options.footnoteReference || {}), diff --git a/src/file/styles/style/default-styles.spec.ts b/src/file/styles/style/default-styles.spec.ts index 1cf26ba482..962f47d9c0 100644 --- a/src/file/styles/style/default-styles.spec.ts +++ b/src/file/styles/style/default-styles.spec.ts @@ -120,6 +120,20 @@ describe("Default Styles", () => { }); }); + it("StrongStyle#constructor", () => { + const style = new defaultStyles.StrongStyle({}); + const tree = new Formatter().format(style); + expect(tree).to.deep.equal({ + "w:style": [ + { _attr: { "w:type": "paragraph", "w:styleId": "Strong" } }, + { "w:name": { _attr: { "w:val": "Strong" } } }, + { "w:basedOn": { _attr: { "w:val": "Normal" } } }, + { "w:next": { _attr: { "w:val": "Normal" } } }, + { "w:qFormat": EMPTY_OBJECT }, + ], + }); + }); + it("ListParagraph#constructor", () => { const style = new defaultStyles.ListParagraph({}); const tree = new Formatter().format(style); diff --git a/src/file/styles/style/default-styles.ts b/src/file/styles/style/default-styles.ts index b1de98e076..f8be7572ee 100644 --- a/src/file/styles/style/default-styles.ts +++ b/src/file/styles/style/default-styles.ts @@ -84,6 +84,16 @@ export class Heading6Style extends HeadingStyle { } } +export class StrongStyle extends HeadingStyle { + constructor(options: IBaseParagraphStyleOptions) { + super({ + ...options, + id: "Strong", + name: "Strong", + }); + } +} + export class ListParagraph extends StyleForParagraph { constructor(options: IBaseParagraphStyleOptions) { super({ From d6cce4ae156d49540b56b597895127b062f61e79 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 22 Dec 2020 23:42:02 +0000 Subject: [PATCH 079/107] Adding TableBorders.NONE convenience object --- demo/49-table-borders.ts | 136 +++++++++++++++++- .../table-properties/table-borders.spec.ts | 72 ++++++++++ .../table/table-properties/table-borders.ts | 33 +++++ 3 files changed, 238 insertions(+), 3 deletions(-) diff --git a/demo/49-table-borders.ts b/demo/49-table-borders.ts index 2aebf1feb1..75dd89c49f 100644 --- a/demo/49-table-borders.ts +++ b/demo/49-table-borders.ts @@ -1,7 +1,19 @@ -// Add custom borders to the table itself +// Add custom borders and no-borders to the table itself // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { BorderStyle, Document, Packer, Paragraph, Table, TableCell, TableRow } from "../build"; +import { + BorderStyle, + Document, + HeadingLevel, + Packer, + Paragraph, + Table, + TableBorders, + TableCell, + TableRow, + TextDirection, + VerticalAlign, +} from "../build"; const doc = new Document(); @@ -10,6 +22,28 @@ const table = new Table({ new TableRow({ children: [ new TableCell({ + borders: { + top: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + bottom: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + left: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + right: { + style: BorderStyle.DASH_SMALL_GAP, + size: 1, + color: "red", + }, + }, children: [new Paragraph("Hello")], }), new TableCell({ @@ -30,7 +64,103 @@ const table = new Table({ ], }); -doc.addSection({ children: [table] }); +// Using the no-border convenience object. It is the same as writing this manually: +// const borders = { +// top: { +// style: BorderStyle.NONE, +// size: 0, +// color: "auto", +// }, +// bottom: { +// style: BorderStyle.NONE, +// size: 0, +// color: "auto", +// }, +// left: { +// style: BorderStyle.NONE, +// size: 0, +// color: "auto", +// }, +// right: { +// style: BorderStyle.NONE, +// size: 0, +// color: "auto", +// }, +// insideHorizontal: { +// style: BorderStyle.NONE, +// size: 0, +// color: "auto", +// }, +// insideVertical: { +// style: BorderStyle.NONE, +// size: 0, +// color: "auto", +// }, +// }; +const noBorderTable = new Table({ + borders: TableBorders.NONE, + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph({}), new Paragraph({})], + verticalAlign: VerticalAlign.CENTER, + }), + new TableCell({ + children: [new Paragraph({}), new Paragraph({})], + verticalAlign: VerticalAlign.CENTER, + }), + new TableCell({ + children: [new Paragraph({ text: "bottom to top" }), new Paragraph({})], + textDirection: TextDirection.BOTTOM_TO_TOP_LEFT_TO_RIGHT, + }), + new TableCell({ + children: [new Paragraph({ text: "top to bottom" }), new Paragraph({})], + textDirection: TextDirection.TOP_TO_BOTTOM_RIGHT_TO_LEFT, + }), + ], + }), + new TableRow({ + children: [ + new TableCell({ + children: [ + new Paragraph({ + text: + "Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah", + heading: HeadingLevel.HEADING_1, + }), + ], + }), + new TableCell({ + children: [ + new Paragraph({ + text: "This text should be in the middle of the cell", + }), + ], + verticalAlign: VerticalAlign.CENTER, + }), + new TableCell({ + children: [ + new Paragraph({ + text: "Text above should be vertical from bottom to top", + }), + ], + verticalAlign: VerticalAlign.CENTER, + }), + new TableCell({ + children: [ + new Paragraph({ + text: "Text above should be vertical from top to bottom", + }), + ], + verticalAlign: VerticalAlign.CENTER, + }), + ], + }), + ], +}); + +doc.addSection({ children: [table, new Paragraph("Hello"), noBorderTable] }); Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer); diff --git a/src/file/table/table-properties/table-borders.spec.ts b/src/file/table/table-properties/table-borders.spec.ts index 679192f120..4a3212feb1 100644 --- a/src/file/table/table-properties/table-borders.spec.ts +++ b/src/file/table/table-properties/table-borders.spec.ts @@ -546,5 +546,77 @@ describe("TableBorders", () => { }); }); }); + + describe("TableBorders.NONE convenience object", () => { + it("should add no borders", () => { + const tableBorders = new TableBorders(TableBorders.NONE); + const tree = new Formatter().format(tableBorders); + + expect(tree).to.deep.equal({ + "w:tblBorders": [ + { + "w:top": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 0, + "w:val": "none", + }, + }, + }, + { + "w:left": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 0, + "w:val": "none", + }, + }, + }, + { + "w:bottom": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 0, + "w:val": "none", + }, + }, + }, + { + "w:right": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 0, + "w:val": "none", + }, + }, + }, + { + "w:insideH": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 0, + "w:val": "none", + }, + }, + }, + { + "w:insideV": { + _attr: { + "w:color": "auto", + "w:space": 0, + "w:sz": 0, + "w:val": "none", + }, + }, + }, + ], + }); + }); + }); }); }); diff --git a/src/file/table/table-properties/table-borders.ts b/src/file/table/table-properties/table-borders.ts index 7c7ac96ca9..8de354fc36 100644 --- a/src/file/table/table-properties/table-borders.ts +++ b/src/file/table/table-properties/table-borders.ts @@ -36,6 +36,39 @@ export interface ITableBordersOptions { } export class TableBorders extends XmlComponent { + public static readonly NONE = { + top: { + style: BorderStyle.NONE, + size: 0, + color: "auto", + }, + bottom: { + style: BorderStyle.NONE, + size: 0, + color: "auto", + }, + left: { + style: BorderStyle.NONE, + size: 0, + color: "auto", + }, + right: { + style: BorderStyle.NONE, + size: 0, + color: "auto", + }, + insideHorizontal: { + style: BorderStyle.NONE, + size: 0, + color: "auto", + }, + insideVertical: { + style: BorderStyle.NONE, + size: 0, + color: "auto", + }, + }; + constructor(options: ITableBordersOptions) { super("w:tblBorders"); From 6100ff4c4e9dd3a7362c31e7e7292cede8c67f24 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Wed, 23 Dec 2020 23:31:28 +0000 Subject: [PATCH 080/107] Add declarative break() --- docs/usage/text.md | 11 ++++++++++- src/file/paragraph/run/run.spec.ts | 20 ++++++++++++++++++-- src/file/paragraph/run/run.ts | 10 ++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/docs/usage/text.md b/docs/usage/text.md index 3ae388f780..0b7b88686b 100644 --- a/docs/usage/text.md +++ b/docs/usage/text.md @@ -158,6 +158,15 @@ Sometimes you would want to put text underneath another line of text but inside ```ts const text = new TextRun({ text: "break", - break: true, + break: 1, +}); +``` + +Adding two breaks: + +```ts +const text = new TextRun({ + text: "break", + break: 2, }); ``` diff --git a/src/file/paragraph/run/run.spec.ts b/src/file/paragraph/run/run.spec.ts index 40cc7055cd..017c616938 100644 --- a/src/file/paragraph/run/run.spec.ts +++ b/src/file/paragraph/run/run.spec.ts @@ -239,13 +239,29 @@ describe("Run", () => { describe("#break()", () => { it("it should add break to the run", () => { - const run = new Run({}); - run.break(); + const run = new Run({ + break: 1, + }); const tree = new Formatter().format(run); expect(tree).to.deep.equal({ "w:r": [{ "w:br": {} }], }); }); + + it("it should add two breaks to the run", () => { + const run = new Run({ + break: 2, + }); + const tree = new Formatter().format(run); + expect(tree).to.deep.equal({ + "w:r": [ + { "w:br": {} }, + { + "w:br": {}, + }, + ], + }); + }); }); describe("#font()", () => { diff --git a/src/file/paragraph/run/run.ts b/src/file/paragraph/run/run.ts index bf7903e35e..461fd9da29 100644 --- a/src/file/paragraph/run/run.ts +++ b/src/file/paragraph/run/run.ts @@ -11,6 +11,7 @@ import { Text } from "./run-components/text"; export interface IRunOptions extends IRunPropertiesOptions { readonly children?: (Begin | FieldInstruction | Separate | End | PageNumber | FootnoteReferenceRun | string)[]; + readonly break?: number; readonly text?: string; } @@ -62,10 +63,11 @@ export class Run extends XmlComponent { } else if (options.text) { this.root.push(new Text(options.text)); } - } - public break(): Run { - this.root.splice(1, 0, new Break()); - return this; + if (options.break) { + for (let i = 0; i < options.break; i++) { + this.root.splice(1, 0, new Break()); + } + } } } From 17d02a3d1c6d7f9d056a07d855276359192a464c Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Thu, 24 Dec 2020 00:00:24 +0000 Subject: [PATCH 081/107] Fix demos --- demo/10-my-cv.ts | 5 ++++- demo/54-track-revisions.ts | 3 ++- .../deleted-text-run.spec.ts | 3 ++- .../deleted-text-run.ts | 22 +++++++------------ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/demo/10-my-cv.ts b/demo/10-my-cv.ts index b91ca318bb..484a9c249c 100644 --- a/demo/10-my-cv.ts +++ b/demo/10-my-cv.ts @@ -204,7 +204,10 @@ class DocumentCreator { alignment: AlignmentType.CENTER, children: [ new TextRun(`Mobile: ${phoneNumber} | LinkedIn: ${profileUrl} | Email: ${email}`), - new TextRun("Address: 58 Elm Avenue, Kent ME4 6ER, UK").break(), + new TextRun({ + text: "Address: 58 Elm Avenue, Kent ME4 6ER, UK", + break: 1, + }), ], }); } diff --git a/demo/54-track-revisions.ts b/demo/54-track-revisions.ts index a0cc47a03b..e035fbb18a 100644 --- a/demo/54-track-revisions.ts +++ b/demo/54-track-revisions.ts @@ -80,6 +80,7 @@ doc.addSection({ children: [ new TextRun("This is a demo "), new DeletedTextRun({ + break: 1, text: "in order", color: "red", bold: true, @@ -95,7 +96,7 @@ doc.addSection({ id: 2, author: "Firstname Lastname", date: "2020-10-06T09:00:00Z", - }).break(), + }), new InsertedTextRun({ text: "to show how to ", bold: false, diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts b/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts index 0a6877fdd5..6bd11c24d7 100644 --- a/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts +++ b/src/file/track-revision/track-revision-components/deleted-text-run.spec.ts @@ -89,11 +89,12 @@ describe("DeletedTextRun", () => { describe("#break()", () => { it("should add a break", () => { const deletedTextRun = new DeletedTextRun({ + break: 1, children: ["some text"], id: 0, date: "123", author: "Author", - }).break(); + }); const tree = new Formatter().format(deletedTextRun); expect(tree).to.deep.equal({ "w:del": [ diff --git a/src/file/track-revision/track-revision-components/deleted-text-run.ts b/src/file/track-revision/track-revision-components/deleted-text-run.ts index 56d384b31b..7830d3d63c 100644 --- a/src/file/track-revision/track-revision-components/deleted-text-run.ts +++ b/src/file/track-revision/track-revision-components/deleted-text-run.ts @@ -1,6 +1,6 @@ import { XmlComponent } from "file/xml-components"; -import { FootnoteReferenceRun, IRunOptions, IRunPropertiesOptions, RunProperties } from "../../index"; +import { IRunOptions, RunProperties } from "../../index"; import { Break } from "../../paragraph/run/break"; import { Begin, End, Separate } from "../../paragraph/run/field"; import { PageNumber } from "../../paragraph/run/run"; @@ -8,10 +8,7 @@ import { ChangeAttributes, IChangedAttributesProperties } from "../track-revisio import { DeletedNumberOfPages, DeletedNumberOfPagesSection, DeletedPage } from "./deleted-page-number"; import { DeletedText } from "./deleted-text"; -interface IDeletedRunOptions extends IRunPropertiesOptions, IChangedAttributesProperties { - readonly children?: (Begin | Separate | End | PageNumber | FootnoteReferenceRun | string)[]; - readonly text?: string; -} +interface IDeletedRunOptions extends IRunOptions, IChangedAttributesProperties {} export class DeletedTextRun extends XmlComponent { protected readonly deletedTextRunWrapper: DeletedTextRunWrapper; @@ -25,14 +22,9 @@ export class DeletedTextRun extends XmlComponent { date: options.date, }), ); - this.deletedTextRunWrapper = new DeletedTextRunWrapper(options as IRunOptions); + this.deletedTextRunWrapper = new DeletedTextRunWrapper(options); this.addChildElement(this.deletedTextRunWrapper); } - - public break(): DeletedTextRun { - this.deletedTextRunWrapper.break(); - return this; - } } class DeletedTextRunWrapper extends XmlComponent { @@ -74,9 +66,11 @@ class DeletedTextRunWrapper extends XmlComponent { } else if (options.text) { this.root.push(new DeletedText(options.text)); } - } - public break(): void { - this.root.splice(1, 0, new Break()); + if (options.break) { + for (let i = 0; i < options.break; i++) { + this.root.splice(1, 0, new Break()); + } + } } } From ef12ada5d7dd4e45f0956ef7070d677c17966662 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 24 Dec 2020 01:50:05 +0000 Subject: [PATCH 082/107] Add parent to numbered list --- demo/57-add-parent-numbered-lists.ts | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 demo/57-add-parent-numbered-lists.ts diff --git a/demo/57-add-parent-numbered-lists.ts b/demo/57-add-parent-numbered-lists.ts new file mode 100644 index 0000000000..1e12ebc75c --- /dev/null +++ b/demo/57-add-parent-numbered-lists.ts @@ -0,0 +1,88 @@ +// Numbered lists - Add parent number in sub number +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { AlignmentType, Document, HeadingLevel, Packer, Paragraph } from "../build"; + +const doc = new Document({ + numbering: { + config: [ + { + levels: [ + { + level: 0, + format: "decimal", + text: "%1", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 720, hanging: 260 }, + }, + }, + }, + { + level: 1, + format: "decimal", + text: "%1.%2", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: 1.25 * 720, hanging: 1.25 * 260 }, + }, + run: { + bold: true, + size: 18, + font: "Times New Roman", + }, + }, + }, + ], + reference: "my-number-numbering-reference", + }, + ], + }, +}); + +doc.addSection({ + children: [ + new Paragraph({ + text: "How to make cake", + heading: HeadingLevel.HEADING_1, + }), + new Paragraph({ + text: "Step 1 - Add sugar", + numbering: { + reference: "my-number-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "Step 2 - Add wheat", + numbering: { + reference: "my-number-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "Step 2a - Stir the wheat in a circle", + numbering: { + reference: "my-number-numbering-reference", + level: 1, + }, + }), + new Paragraph({ + text: "Step 3 - Put in oven", + numbering: { + reference: "my-number-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "How to make cake", + heading: HeadingLevel.HEADING_1, + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); From 502db14bba87291ed0dabd05c4300a296a1b369a Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 24 Dec 2020 03:37:43 +0000 Subject: [PATCH 083/107] Add Convenience functions --- demo/11-declaritive-styles-2.ts | 3 +- demo/2-declaritive-styles.ts | 7 ++-- demo/27-declaritive-styles-3.ts | 4 +- demo/29-numbered-lists.ts | 6 +-- demo/3-numbering-and-bullet-points.ts | 8 ++-- demo/32-merge-and-shade-table-cells.ts | 39 ++++++++++++------- demo/57-add-parent-numbered-lists.ts | 6 +-- docs/_sidebar.md | 3 ++ docs/usage/convenience-functions.md | 22 +++++++++++ src/convenience-functions.spec.ts | 18 +++++++++ src/convenience-functions.ts | 8 ++++ .../section-properties.spec.ts | 11 +++--- .../section-properties/section-properties.ts | 9 +++-- src/file/numbering/numbering.ts | 19 ++++----- src/index.ts | 1 + 15 files changed, 115 insertions(+), 49 deletions(-) create mode 100644 docs/usage/convenience-functions.md create mode 100644 src/convenience-functions.spec.ts create mode 100644 src/convenience-functions.ts diff --git a/demo/11-declaritive-styles-2.ts b/demo/11-declaritive-styles-2.ts index 5fe9e16ae6..2f4ed78098 100644 --- a/demo/11-declaritive-styles-2.ts +++ b/demo/11-declaritive-styles-2.ts @@ -3,6 +3,7 @@ import * as fs from "fs"; import { AlignmentType, + convertInchesToTwip, Document, Footer, HeadingLevel, @@ -110,7 +111,7 @@ const doc = new Document({ }, paragraph: { spacing: { line: 276 }, - indent: { left: 720 }, + indent: { left: convertInchesToTwip(0.5) }, }, }, { diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index b96056166e..a7b7c4953b 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -1,7 +1,7 @@ // Example on how to customise the look at feel using Styles // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build"; const doc = new Document({ creator: "Clippy", @@ -56,7 +56,7 @@ const doc = new Document({ }, paragraph: { indent: { - left: 720, + left: convertInchesToTwip(0.5), }, spacing: { line: 276, @@ -168,8 +168,7 @@ doc.addSection({ text: "Strong Style", }), new TextRun({ - text: - " - Very strong.", + text: " - Very strong.", }), ], }), diff --git a/demo/27-declaritive-styles-3.ts b/demo/27-declaritive-styles-3.ts index 8419467799..8737c69101 100644 --- a/demo/27-declaritive-styles-3.ts +++ b/demo/27-declaritive-styles-3.ts @@ -1,7 +1,7 @@ // Custom styles using JavaScript configuration // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HeadingLevel, Packer, Paragraph, UnderlineType } from "../build"; +import { Document, convertInchesToTwip, HeadingLevel, Packer, Paragraph, UnderlineType } from "../build"; const doc = new Document({ styles: { @@ -17,7 +17,7 @@ const doc = new Document({ }, paragraph: { indent: { - left: 720, + left: convertInchesToTwip(0.5), }, spacing: { line: 276, diff --git a/demo/29-numbered-lists.ts b/demo/29-numbered-lists.ts index 5cd3966015..5337db4438 100644 --- a/demo/29-numbered-lists.ts +++ b/demo/29-numbered-lists.ts @@ -1,7 +1,7 @@ // Numbered lists // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, Packer, Paragraph } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, Packer, Paragraph } from "../build"; const doc = new Document({ numbering: { @@ -15,7 +15,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 720, hanging: 260 }, + indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.18) }, }, }, }, @@ -31,7 +31,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 720, hanging: 260 }, + indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.18) }, }, }, }, diff --git a/demo/3-numbering-and-bullet-points.ts b/demo/3-numbering-and-bullet-points.ts index 58c0a4f5a6..6a4155452d 100644 --- a/demo/3-numbering-and-bullet-points.ts +++ b/demo/3-numbering-and-bullet-points.ts @@ -1,7 +1,7 @@ // Numbering and bullet points example // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, Packer, Paragraph } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, Packer, Paragraph } from "../build"; const doc = new Document({ numbering: { @@ -16,7 +16,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 720, hanging: 260 }, + indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.18) }, }, }, }, @@ -27,7 +27,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 1440, hanging: 980 }, + indent: { left: convertInchesToTwip(1), hanging: convertInchesToTwip(0.68) }, }, }, }, @@ -38,7 +38,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 2160, hanging: 1700 }, + indent: { left: convertInchesToTwip(1.5), hanging: convertInchesToTwip(1.18) }, }, }, }, diff --git a/demo/32-merge-and-shade-table-cells.ts b/demo/32-merge-and-shade-table-cells.ts index f12350988e..284b456e05 100644 --- a/demo/32-merge-and-shade-table-cells.ts +++ b/demo/32-merge-and-shade-table-cells.ts @@ -2,7 +2,20 @@ // Also includes an example on how to center tables // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, BorderStyle, Document, HeadingLevel, Packer, Paragraph, ShadingType, Table, TableCell, TableRow, WidthType } from "../build"; +import { + AlignmentType, + BorderStyle, + convertInchesToTwip, + Document, + HeadingLevel, + Packer, + Paragraph, + ShadingType, + Table, + TableCell, + TableRow, + WidthType, +} from "../build"; const doc = new Document(); @@ -37,10 +50,10 @@ const table2 = new Table({ new TableCell({ children: [new Paragraph("World")], margins: { - top: 1000, - bottom: 1000, - left: 1000, - right: 1000, + top: convertInchesToTwip(0.69), + bottom: convertInchesToTwip(0.69), + left: convertInchesToTwip(0.69), + right: convertInchesToTwip(0.69), }, columnSpan: 3, }), @@ -64,7 +77,7 @@ const table2 = new Table({ size: 100, type: WidthType.AUTO, }, - columnWidths: [1000, 1000, 1000], + columnWidths: [convertInchesToTwip(0.69), convertInchesToTwip(0.69), convertInchesToTwip(0.69)], }); const table3 = new Table({ @@ -119,14 +132,14 @@ const table3 = new Table({ }), ], width: { - size: 7000, + size: convertInchesToTwip(4.86), type: WidthType.DXA, }, margins: { - top: 400, - bottom: 400, - right: 400, - left: 400, + top: convertInchesToTwip(0.27), + bottom: convertInchesToTwip(0.27), + right: convertInchesToTwip(0.27), + left: convertInchesToTwip(0.27), }, }); @@ -355,9 +368,7 @@ const table8 = new Table({ ], }), new TableRow({ - children: [ - new TableCell({ children: [new Paragraph("4,1")] }), - ], + children: [new TableCell({ children: [new Paragraph("4,1")] })], }), ], width: { diff --git a/demo/57-add-parent-numbered-lists.ts b/demo/57-add-parent-numbered-lists.ts index 1e12ebc75c..2cf31a9e6b 100644 --- a/demo/57-add-parent-numbered-lists.ts +++ b/demo/57-add-parent-numbered-lists.ts @@ -1,7 +1,7 @@ // Numbered lists - Add parent number in sub number // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, Document, HeadingLevel, Packer, Paragraph } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph } from "../build"; const doc = new Document({ numbering: { @@ -15,7 +15,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 720, hanging: 260 }, + indent: { left: convertInchesToTwip(0.5), hanging: 260 }, }, }, }, @@ -26,7 +26,7 @@ const doc = new Document({ alignment: AlignmentType.START, style: { paragraph: { - indent: { left: 1.25 * 720, hanging: 1.25 * 260 }, + indent: { left: 1.25 * convertInchesToTwip(0.5), hanging: 1.25 * 260 }, }, run: { bold: true, diff --git a/docs/_sidebar.md b/docs/_sidebar.md index bcdb03c55f..2538e975c7 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -28,5 +28,8 @@ * Exporting * [Packers](usage/packers.md) +* Utility + + * [Convenience functions](usage/convenience-functions.md) * [Contribution Guidelines](contribution-guidelines.md) diff --git a/docs/usage/convenience-functions.md b/docs/usage/convenience-functions.md new file mode 100644 index 0000000000..76236ca6c4 --- /dev/null +++ b/docs/usage/convenience-functions.md @@ -0,0 +1,22 @@ +# Convenience functions + +OOXML and this library mainly uses a unit called twentieths of a point or `twip` for short. a twip is a typographical measurement, defined as 1/20 of a typographical point. One twip is 1/1440 inch, or 17.64 μm. This unit is not intuitive for many users, so some functions were created to help + +More info here: https://en.wikipedia.org/wiki/Twip + +## Convert Inches to Twip + +```ts +import { convertInchesToTwip } from "docx"; + +const twip = convertInchesToTwip(1); // returns 1440 +const twip = convertInchesToTwip(0.5); // returns 720 +``` + +## Convert Millimeters to Twip + +```ts +import { convertMillimetersToTwip } from "docx"; + +const twip = convertMillimetersToTwip(50); // returns 2834 +``` diff --git a/src/convenience-functions.spec.ts b/src/convenience-functions.spec.ts new file mode 100644 index 0000000000..3333fdd2d0 --- /dev/null +++ b/src/convenience-functions.spec.ts @@ -0,0 +1,18 @@ +import { expect } from "chai"; +import { convertInchesToTwip, convertMillimetersToTwip } from "./convenience-functions"; + +describe("Utility", () => { + describe("#convertMillimetersToTwip", () => { + it("should call the underlying header's addChildElement for Paragraph", () => { + expect(convertMillimetersToTwip(1000)).to.equal(56692); + }); + }); + + describe("#convertInchesToTwip", () => { + it("should call the underlying header's addChildElement", () => { + expect(convertInchesToTwip(1)).to.equal(1440); + expect(convertInchesToTwip(0.5)).to.equal(720); + expect(convertInchesToTwip(0.25)).to.equal(360); + }); + }); +}); diff --git a/src/convenience-functions.ts b/src/convenience-functions.ts new file mode 100644 index 0000000000..6fe110b72b --- /dev/null +++ b/src/convenience-functions.ts @@ -0,0 +1,8 @@ +// Twip - twentieths of a point +export const convertMillimetersToTwip = (millimeters: number): number => { + return Math.floor((millimeters / 25.4) * 72 * 20); +}; + +export const convertInchesToTwip = (inches: number): number => { + return Math.floor(inches * 72 * 20); +}; diff --git a/src/file/document/body/section-properties/section-properties.spec.ts b/src/file/document/body/section-properties/section-properties.spec.ts index 70fc567b83..8a55699eb5 100644 --- a/src/file/document/body/section-properties/section-properties.spec.ts +++ b/src/file/document/body/section-properties/section-properties.spec.ts @@ -1,5 +1,6 @@ import { expect } from "chai"; +import { convertInchesToTwip } from "convenience-functions"; import { Formatter } from "export/formatter"; import { FooterWrapper } from "file/footer-wrapper"; import { HeaderWrapper } from "file/header-wrapper"; @@ -18,10 +19,10 @@ describe("SectionProperties", () => { const properties = new SectionProperties({ width: 11906, height: 16838, - top: 1440, - right: 1440, - bottom: 1440, - left: 1440, + top: convertInchesToTwip(1), + right: convertInchesToTwip(1), + bottom: convertInchesToTwip(1), + left: convertInchesToTwip(1), header: 708, footer: 708, gutter: 0, @@ -30,7 +31,7 @@ describe("SectionProperties", () => { space: 708, count: 1, }, - linePitch: 360, + linePitch: convertInchesToTwip(0.25), headers: { default: new HeaderWrapper(media, 100), }, diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index 37e09e4498..d497bb9131 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -1,4 +1,5 @@ // http://officeopenxml.com/WPsection.php +import { convertInchesToTwip } from "convenience-functions"; import { FooterWrapper } from "file/footer-wrapper"; import { HeaderWrapper } from "file/header-wrapper"; import { XmlComponent } from "file/xml-components"; @@ -64,10 +65,10 @@ export class SectionProperties extends XmlComponent { const { width = 11906, height = 16838, - top = 1440, - right = 1440, - bottom = 1440, - left = 1440, + top = convertInchesToTwip(1), + right = convertInchesToTwip(1), + bottom = convertInchesToTwip(1), + left = convertInchesToTwip(1), header = 708, footer = 708, gutter = 0, diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index a02caf6bef..99c5b4ea93 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -1,4 +1,5 @@ // http://officeopenxml.com/WPnumbering.php +import { convertInchesToTwip } from "convenience-functions"; import { AlignmentType } from "file/paragraph"; import { IXmlableObject, XmlComponent } from "file/xml-components"; @@ -55,7 +56,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 720, hanging: 360 }, + indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -66,7 +67,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 1440, hanging: 360 }, + indent: { left: convertInchesToTwip(1), hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -77,7 +78,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 2160, hanging: 360 }, + indent: { left: 2160, hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -88,7 +89,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 2880, hanging: 360 }, + indent: { left: 2880, hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -99,7 +100,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 3600, hanging: 360 }, + indent: { left: 3600, hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -110,7 +111,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 4320, hanging: 360 }, + indent: { left: 4320, hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -121,7 +122,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 5040, hanging: 360 }, + indent: { left: 5040, hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -132,7 +133,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 5760, hanging: 360 }, + indent: { left: 5760, hanging: convertInchesToTwip(0.25) }, }, }, }, @@ -143,7 +144,7 @@ export class Numbering extends XmlComponent { alignment: AlignmentType.LEFT, style: { paragraph: { - indent: { left: 6480, hanging: 360 }, + indent: { left: 6480, hanging: convertInchesToTwip(0.25) }, }, }, }, diff --git a/src/index.ts b/src/index.ts index 1e35c87d30..a319e4dcfe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,3 +4,4 @@ export { File as Document } from "./file"; export * from "./file"; export * from "./export"; export * from "./import-dotx"; +export * from "./convenience-functions"; From 38c8220e9e4ee86df86f24c5e74e989352756891 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 24 Dec 2020 04:26:45 +0000 Subject: [PATCH 084/107] Use LevelFormat string enum rather than strings --- demo/2-declaritive-styles.ts | 14 +- demo/29-numbered-lists.ts | 155 +++++++++++++++++- demo/3-numbering-and-bullet-points.ts | 10 +- demo/57-add-parent-numbered-lists.ts | 6 +- docs/usage/bullet-points.md | 2 +- src/file/numbering/abstract-numbering.spec.ts | 72 ++++---- src/file/numbering/level.ts | 20 ++- src/file/numbering/numbering.ts | 20 +-- 8 files changed, 238 insertions(+), 61 deletions(-) diff --git a/demo/2-declaritive-styles.ts b/demo/2-declaritive-styles.ts index a7b7c4953b..deada8198a 100644 --- a/demo/2-declaritive-styles.ts +++ b/demo/2-declaritive-styles.ts @@ -1,7 +1,17 @@ // Example on how to customise the look at feel using Styles // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph, TextRun, UnderlineType } from "../build"; +import { + AlignmentType, + convertInchesToTwip, + Document, + HeadingLevel, + LevelFormat, + Packer, + Paragraph, + TextRun, + UnderlineType, +} from "../build"; const doc = new Document({ creator: "Clippy", @@ -81,7 +91,7 @@ const doc = new Document({ levels: [ { level: 0, - format: "lowerLetter", + format: LevelFormat.LOWER_LETTER, text: "%1)", alignment: AlignmentType.LEFT, }, diff --git a/demo/29-numbered-lists.ts b/demo/29-numbered-lists.ts index 5337db4438..77f50381d1 100644 --- a/demo/29-numbered-lists.ts +++ b/demo/29-numbered-lists.ts @@ -1,7 +1,7 @@ // Numbered lists // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, convertInchesToTwip, Document, Packer, Paragraph } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, LevelFormat, Packer, Paragraph } from "../build"; const doc = new Document({ numbering: { @@ -10,7 +10,7 @@ const doc = new Document({ levels: [ { level: 0, - format: "upperRoman", + format: LevelFormat.UPPER_ROMAN, text: "%1", alignment: AlignmentType.START, style: { @@ -26,7 +26,7 @@ const doc = new Document({ levels: [ { level: 0, - format: "decimal", + format: LevelFormat.DECIMAL, text: "%1", alignment: AlignmentType.START, style: { @@ -38,6 +38,22 @@ const doc = new Document({ ], reference: "my-number-numbering-reference", }, + { + levels: [ + { + level: 0, + format: LevelFormat.DECIMAL_ZERO, + text: "[%1]", + alignment: AlignmentType.START, + style: { + paragraph: { + indent: { left: convertInchesToTwip(0.5), hanging: convertInchesToTwip(0.18) }, + }, + }, + }, + ], + reference: "padded-numbering-reference", + }, ], }, }); @@ -109,6 +125,139 @@ doc.addSection({ level: 0, }, }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), + new Paragraph({ + text: "test", + numbering: { + reference: "padded-numbering-reference", + level: 0, + }, + }), ], }); diff --git a/demo/3-numbering-and-bullet-points.ts b/demo/3-numbering-and-bullet-points.ts index 6a4155452d..375c1439a7 100644 --- a/demo/3-numbering-and-bullet-points.ts +++ b/demo/3-numbering-and-bullet-points.ts @@ -1,7 +1,7 @@ // Numbering and bullet points example // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, convertInchesToTwip, Document, Packer, Paragraph } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, LevelFormat, Packer, Paragraph } from "../build"; const doc = new Document({ numbering: { @@ -11,7 +11,7 @@ const doc = new Document({ levels: [ { level: 0, - format: "upperRoman", + format: LevelFormat.UPPER_ROMAN, text: "%1", alignment: AlignmentType.START, style: { @@ -22,7 +22,7 @@ const doc = new Document({ }, { level: 1, - format: "decimal", + format: LevelFormat.DECIMAL, text: "%2.", alignment: AlignmentType.START, style: { @@ -33,7 +33,7 @@ const doc = new Document({ }, { level: 2, - format: "lowerLetter", + format: LevelFormat.LOWER_LETTER, text: "%3)", alignment: AlignmentType.START, style: { @@ -44,7 +44,7 @@ const doc = new Document({ }, { level: 3, - format: "upperLetter", + format: LevelFormat.UPPER_LETTER, text: "%4)", alignment: AlignmentType.START, style: { diff --git a/demo/57-add-parent-numbered-lists.ts b/demo/57-add-parent-numbered-lists.ts index 2cf31a9e6b..e35cd06a27 100644 --- a/demo/57-add-parent-numbered-lists.ts +++ b/demo/57-add-parent-numbered-lists.ts @@ -1,7 +1,7 @@ // Numbered lists - Add parent number in sub number // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, Packer, Paragraph } from "../build"; +import { AlignmentType, convertInchesToTwip, Document, HeadingLevel, LevelFormat, Packer, Paragraph } from "../build"; const doc = new Document({ numbering: { @@ -10,7 +10,7 @@ const doc = new Document({ levels: [ { level: 0, - format: "decimal", + format: LevelFormat.DECIMAL, text: "%1", alignment: AlignmentType.START, style: { @@ -21,7 +21,7 @@ const doc = new Document({ }, { level: 1, - format: "decimal", + format: LevelFormat.DECIMAL, text: "%1.%2", alignment: AlignmentType.START, style: { diff --git a/docs/usage/bullet-points.md b/docs/usage/bullet-points.md index 045ec61d1a..7ffcf6f241 100644 --- a/docs/usage/bullet-points.md +++ b/docs/usage/bullet-points.md @@ -9,7 +9,7 @@ const text = new TextRun("Bullet points"); const paragraph = new Paragraph({ text: "Bullet points", bullet: { - level: 0, // How deep you want the bullet to me + level: 0, //How deep you want the bullet to be }, }); ``` diff --git a/src/file/numbering/abstract-numbering.spec.ts b/src/file/numbering/abstract-numbering.spec.ts index ef1df0de4c..df5416f453 100644 --- a/src/file/numbering/abstract-numbering.spec.ts +++ b/src/file/numbering/abstract-numbering.spec.ts @@ -7,7 +7,7 @@ import { AlignmentType, EmphasisMarkType, TabStopPosition } from "../paragraph"; import { UnderlineType } from "../paragraph/run/underline"; import { ShadingType } from "../table"; import { AbstractNumbering } from "./abstract-numbering"; -import { LevelSuffix } from "./level"; +import { LevelFormat, LevelSuffix } from "./level"; describe("AbstractNumbering", () => { it("stores its ID at its .id property", () => { @@ -20,7 +20,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 3, - format: "lowerLetter", + format: LevelFormat.LOWER_LETTER, text: "%1)", alignment: AlignmentType.END, }, @@ -29,7 +29,7 @@ describe("AbstractNumbering", () => { expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "end" } } }); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": LevelFormat.LOWER_LETTER } } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); }); @@ -37,7 +37,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 3, - format: "lowerLetter", + format: LevelFormat.LOWER_LETTER, text: "%1)", }, ]); @@ -45,7 +45,7 @@ describe("AbstractNumbering", () => { expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ _attr: { "w:ilvl": 3, "w15:tentative": 1 } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:start": { _attr: { "w:val": 1 } } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlJc": { _attr: { "w:val": "start" } } }); - expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": "lowerLetter" } } }); + expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:numFmt": { _attr: { "w:val": LevelFormat.LOWER_LETTER } } }); expect(tree["w:abstractNum"][2]["w:lvl"]).to.include({ "w:lvlText": { _attr: { "w:val": "%1)" } } }); }); @@ -53,7 +53,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 3, - format: "lowerLetter", + format: LevelFormat.LOWER_LETTER, text: "%1)", alignment: AlignmentType.END, suffix: LevelSuffix.SPACE, @@ -68,7 +68,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -87,7 +87,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -106,7 +106,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -125,7 +125,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -144,7 +144,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -163,7 +163,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -182,7 +182,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -216,7 +216,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -239,7 +239,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -262,7 +262,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -281,7 +281,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { paragraph: { @@ -324,7 +324,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { size, sizeComplexScript }, @@ -340,7 +340,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -359,7 +359,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -378,7 +378,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -398,7 +398,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -417,7 +417,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -436,7 +436,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -455,7 +455,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -485,7 +485,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -533,7 +533,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { bold, boldComplexScript }, @@ -566,7 +566,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { italics, italicsComplexScript }, @@ -604,7 +604,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { highlight, highlightComplexScript }, @@ -682,7 +682,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { shadow, shading, shadingComplexScript }, @@ -699,7 +699,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -718,7 +718,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -739,7 +739,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -763,7 +763,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -782,7 +782,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { @@ -804,7 +804,7 @@ describe("AbstractNumbering", () => { const abstractNumbering = new AbstractNumbering(1, [ { level: 0, - format: "lowerRoman", + format: LevelFormat.LOWER_ROMAN, text: "%0.", style: { run: { diff --git a/src/file/numbering/level.ts b/src/file/numbering/level.ts index 6a68f0712f..22ff07acf3 100644 --- a/src/file/numbering/level.ts +++ b/src/file/numbering/level.ts @@ -1,8 +1,26 @@ +// http://officeopenxml.com/WPnumbering-numFmt.php import { Attributes, XmlAttributeComponent, XmlComponent } from "file/xml-components"; import { AlignmentType } from "../paragraph/formatting"; import { IParagraphStylePropertiesOptions, ParagraphProperties } from "../paragraph/properties"; import { IRunStylePropertiesOptions, RunProperties } from "../paragraph/run/properties"; +export enum LevelFormat { + BULLET = "bullet", + CARDINAL_TEXT = "cardinalText", + CHICAGO = "chicago", + DECIMAL = "decimal", + DECIMAL_ENCLOSED_CIRCLE = "decimalEnclosedCircle", + DECIMAL_ENCLOSED_FULLSTOP = "decimalEnclosedFullstop", + DECIMAL_ENCLOSED_PARENTHESES = "decimalEnclosedParen", + DECIMAL_ZERO = "decimalZero", + LOWER_LETTER = "lowerLetter", + LOWER_ROMAN = "lowerRoman", + NONE = "none", + ORDINAL_TEXT = "ordinalText", + UPPER_LETTER = "upperLetter", + UPPER_ROMAN = "upperRoman", +} + interface ILevelAttributesProperties { readonly ilvl?: number; readonly tentative?: number; @@ -67,7 +85,7 @@ export enum LevelSuffix { export interface ILevelsOptions { readonly level: number; - readonly format?: string; + readonly format?: LevelFormat; readonly text?: string; readonly alignment?: AlignmentType; readonly start?: number; diff --git a/src/file/numbering/numbering.ts b/src/file/numbering/numbering.ts index 99c5b4ea93..901f13f4bb 100644 --- a/src/file/numbering/numbering.ts +++ b/src/file/numbering/numbering.ts @@ -5,7 +5,7 @@ import { IXmlableObject, XmlComponent } from "file/xml-components"; import { DocumentAttributes } from "../document/document-attributes"; import { AbstractNumbering } from "./abstract-numbering"; -import { ILevelsOptions } from "./level"; +import { ILevelsOptions, LevelFormat } from "./level"; import { ConcreteNumbering } from "./num"; export interface INumberingOptions { @@ -51,7 +51,7 @@ export class Numbering extends XmlComponent { const abstractNumbering = this.createAbstractNumbering([ { level: 0, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CF", alignment: AlignmentType.LEFT, style: { @@ -62,7 +62,7 @@ export class Numbering extends XmlComponent { }, { level: 1, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CB", alignment: AlignmentType.LEFT, style: { @@ -73,7 +73,7 @@ export class Numbering extends XmlComponent { }, { level: 2, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25A0", alignment: AlignmentType.LEFT, style: { @@ -84,7 +84,7 @@ export class Numbering extends XmlComponent { }, { level: 3, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CF", alignment: AlignmentType.LEFT, style: { @@ -95,7 +95,7 @@ export class Numbering extends XmlComponent { }, { level: 4, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CB", alignment: AlignmentType.LEFT, style: { @@ -106,7 +106,7 @@ export class Numbering extends XmlComponent { }, { level: 5, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25A0", alignment: AlignmentType.LEFT, style: { @@ -117,7 +117,7 @@ export class Numbering extends XmlComponent { }, { level: 6, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CF", alignment: AlignmentType.LEFT, style: { @@ -128,7 +128,7 @@ export class Numbering extends XmlComponent { }, { level: 7, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CF", alignment: AlignmentType.LEFT, style: { @@ -139,7 +139,7 @@ export class Numbering extends XmlComponent { }, { level: 8, - format: "bullet", + format: LevelFormat.BULLET, text: "\u25CF", alignment: AlignmentType.LEFT, style: { From d74db948ba61189ac9087846b0145fa830f50d41 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 25 Dec 2020 00:07:57 +0000 Subject: [PATCH 085/107] Add zIndex property to floating --- demo/5-images.ts | 2 ++ src/file/drawing/anchor/anchor.ts | 28 ++++++++----------- .../drawing/floating/floating-position.ts | 2 ++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/demo/5-images.ts b/demo/5-images.ts index 260fd25f15..3c752d9a58 100644 --- a/demo/5-images.ts +++ b/demo/5-images.ts @@ -22,6 +22,7 @@ const image4 = Media.addImage(doc, fs.readFileSync("./demo/images/parrots.bmp")) const image5 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif")); const image6 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 200, 200, { floating: { + zIndex: 10, horizontalPosition: { offset: 1014400, }, @@ -33,6 +34,7 @@ const image6 = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 2 const image7 = Media.addImage(doc, fs.readFileSync("./demo/images/cat.jpg"), 200, 200, { floating: { + zIndex: 5, horizontalPosition: { relative: HorizontalPositionRelativeFrom.PAGE, align: HorizontalPositionAlign.RIGHT, diff --git a/src/file/drawing/anchor/anchor.ts b/src/file/drawing/anchor/anchor.ts index d52c349ebb..25890aae9c 100644 --- a/src/file/drawing/anchor/anchor.ts +++ b/src/file/drawing/anchor/anchor.ts @@ -11,42 +11,38 @@ import { Extent } from "./../extent/extent"; import { GraphicFrameProperties } from "./../graphic-frame/graphic-frame-properties"; import { AnchorAttributes } from "./anchor-attributes"; -const defaultOptions: IFloating = { - allowOverlap: true, - behindDocument: false, - lockAnchor: false, - layoutInCell: true, - verticalPosition: {}, - horizontalPosition: {}, -}; - export class Anchor extends XmlComponent { constructor(mediaData: IMediaData, dimensions: IMediaDataDimensions, drawingOptions: IDrawingOptions) { super("wp:anchor"); - const floating = { + const floating: IFloating = { margins: { top: 0, bottom: 0, left: 0, right: 0, }, - ...defaultOptions, + allowOverlap: true, + behindDocument: false, + lockAnchor: false, + layoutInCell: true, + verticalPosition: {}, + horizontalPosition: {}, ...drawingOptions.floating, }; this.root.push( new AnchorAttributes({ - distT: floating.margins.top || 0, - distB: floating.margins.bottom || 0, - distL: floating.margins.left || 0, - distR: floating.margins.right || 0, + distT: floating.margins ? floating.margins.top || 0 : 0, + distB: floating.margins ? floating.margins.bottom || 0 : 0, + distL: floating.margins ? floating.margins.left || 0 : 0, + distR: floating.margins ? floating.margins.right || 0 : 0, simplePos: "0", // note: word doesn't fully support - so we use 0 allowOverlap: floating.allowOverlap === true ? "1" : "0", behindDoc: floating.behindDocument === true ? "1" : "0", locked: floating.lockAnchor === true ? "1" : "0", layoutInCell: floating.layoutInCell === true ? "1" : "0", - relativeHeight: dimensions.emus.y, + relativeHeight: floating.zIndex ? floating.zIndex : dimensions.emus.y, }), ); diff --git a/src/file/drawing/floating/floating-position.ts b/src/file/drawing/floating/floating-position.ts index 9191ef1e1b..6c5ad7f332 100644 --- a/src/file/drawing/floating/floating-position.ts +++ b/src/file/drawing/floating/floating-position.ts @@ -1,4 +1,5 @@ // http://officeopenxml.com/drwPicFloating-position.php +// http://officeopenxml.com/drwPicFloating.php import { ITextWrapping } from "../text-wrap"; export enum HorizontalPositionRelativeFrom { @@ -67,4 +68,5 @@ export interface IFloating { readonly layoutInCell?: boolean; readonly margins?: IMargins; readonly wrap?: ITextWrapping; + readonly zIndex?: number; } From d894bfa1672ea055755376947076043122ed8a99 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 25 Dec 2020 00:29:27 +0000 Subject: [PATCH 086/107] Add test --- src/file/drawing/anchor/anchor.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/file/drawing/anchor/anchor.spec.ts b/src/file/drawing/anchor/anchor.spec.ts index 6b86a31346..99fe0fb7b9 100644 --- a/src/file/drawing/anchor/anchor.spec.ts +++ b/src/file/drawing/anchor/anchor.spec.ts @@ -218,5 +218,25 @@ describe("Anchor", () => { const textWrap = newJson.root[6]; assert.equal(textWrap.rootKey, "wp:wrapTopAndBottom"); }); + + it("should create a Drawing with a certain z-index", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + zIndex: 120, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + + assert.include(anchorAttributes, { + relativeHeight: 120, + }); + }); }); }); From b4cd3a319c2e7aab21f20d40904c5a343337e92b Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 25 Dec 2020 00:30:58 +0000 Subject: [PATCH 087/107] Add documentation --- docs/usage/images.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/usage/images.md b/docs/usage/images.md index 4893348cc0..94e75e75a7 100644 --- a/docs/usage/images.md +++ b/docs/usage/images.md @@ -125,6 +125,7 @@ Full options you can pass into `floating` are: | lockAnchor | `boolean` | Optional | | behindDocument | `boolean` | Optional | | layoutInCell | `boolean` | Optional | +| zIndex | `number` | Optional | `HorizontalPositionOptions` are: From 5ec18d6e01523eb78ecfe7f198a00eef0acc33c2 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 25 Dec 2020 02:15:40 +0000 Subject: [PATCH 088/107] Add tests and simplify --- src/file/drawing/anchor/anchor.spec.ts | 125 +++++++++++++++++++++++++ src/file/drawing/anchor/anchor.ts | 6 -- 2 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/file/drawing/anchor/anchor.spec.ts b/src/file/drawing/anchor/anchor.spec.ts index 99fe0fb7b9..10d4b08d13 100644 --- a/src/file/drawing/anchor/anchor.spec.ts +++ b/src/file/drawing/anchor/anchor.spec.ts @@ -219,6 +219,131 @@ describe("Anchor", () => { assert.equal(textWrap.rootKey, "wp:wrapTopAndBottom"); }); + it("should create a Drawing with a margin", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + margins: { + top: 10, + left: 10, + bottom: 10, + right: 10, + }, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + assert.include(anchorAttributes, { + distT: 10, + distB: 10, + distL: 10, + distR: 10, + }); + }); + + it("should create a Drawing with a default margin", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + margins: {}, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + assert.include(anchorAttributes, { + distT: 0, + distB: 0, + distL: 0, + distR: 0, + }); + }); + + it("should create a Drawing with allowOverlap being false", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + allowOverlap: false, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + assert.include(anchorAttributes, { + allowOverlap: "0", + }); + }); + + it("should create a Drawing with behindDocument being true", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + behindDocument: true, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + assert.include(anchorAttributes, { + behindDoc: "1", + }); + }); + + it("should create a Drawing with locked being true", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + lockAnchor: true, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + assert.include(anchorAttributes, { + locked: "1", + }); + }); + + it("should create a Drawing with locked being false", () => { + anchor = createAnchor({ + floating: { + verticalPosition: { + offset: 0, + }, + horizontalPosition: { + offset: 0, + }, + layoutInCell: false, + }, + }); + const newJson = Utility.jsonify(anchor); + const anchorAttributes = newJson.root[0].root; + assert.include(anchorAttributes, { + layoutInCell: "0", + }); + }); + it("should create a Drawing with a certain z-index", () => { anchor = createAnchor({ floating: { diff --git a/src/file/drawing/anchor/anchor.ts b/src/file/drawing/anchor/anchor.ts index 25890aae9c..7eb4487a89 100644 --- a/src/file/drawing/anchor/anchor.ts +++ b/src/file/drawing/anchor/anchor.ts @@ -16,12 +16,6 @@ export class Anchor extends XmlComponent { super("wp:anchor"); const floating: IFloating = { - margins: { - top: 0, - bottom: 0, - left: 0, - right: 0, - }, allowOverlap: true, behindDocument: false, lockAnchor: false, From e355fd3d2ec554f6b0a5a4ad3a246c17cdcb32bc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 12 Jan 2021 08:20:34 +0000 Subject: [PATCH 089/107] build(deps-dev): bump @types/webpack from 4.41.25 to 4.41.26 Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.41.25 to 4.41.26. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32414b26c7..07a4a9af15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -670,9 +670,9 @@ } }, "@types/webpack": { - "version": "4.41.25", - "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.25.tgz", - "integrity": "sha512-cr6kZ+4m9lp86ytQc1jPOJXgINQyz3kLLunZ57jznW+WIAL0JqZbGubQk4GlD42MuQL5JGOABrxdpqqWeovlVQ==", + "version": "4.41.26", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.26.tgz", + "integrity": "sha512-7ZyTfxjCRwexh+EJFwRUM+CDB2XvgHl4vfuqf1ZKrgGvcS5BrNvPQqJh3tsZ0P6h6Aa1qClVHaJZszLPzpqHeA==", "dev": true, "requires": { "@types/anymatch": "*", @@ -684,9 +684,9 @@ } }, "@types/webpack-sources": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.0.0.tgz", - "integrity": "sha512-a5kPx98CNFRKQ+wqawroFunvFqv7GHm/3KOI52NY9xWADgc8smu4R6prt4EU/M4QfVjvgBkMqU4fBhw3QfMVkg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.1.0.tgz", + "integrity": "sha512-LXn/oYIpBeucgP1EIJbKQ2/4ZmpvRl+dlrFdX7+94SKRUV3Evy3FsfMZY318vGhkWUS5MPhtOM3w1/hCOAOXcg==", "dev": true, "requires": { "@types/node": "*", From 5de2d8c7fb291b8aad1bc9aa18544d514762d578 Mon Sep 17 00:00:00 2001 From: arran Date: Fri, 22 Jan 2021 16:45:39 +1100 Subject: [PATCH 090/107] Minor change --- src/import-dotx/import-dotx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/import-dotx/import-dotx.ts b/src/import-dotx/import-dotx.ts index d8d5d1190c..6c509c6383 100644 --- a/src/import-dotx/import-dotx.ts +++ b/src/import-dotx/import-dotx.ts @@ -46,7 +46,7 @@ export interface IDocumentTemplate { } export class ImportDotx { - public async extract(data: Buffer): Promise { + public async extract(data: string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream): Promise { const zipContent = await JSZip.loadAsync(data); const documentContent = await zipContent.files["word/document.xml"].async("text"); From e93b8032d8b5f8def31e2153dc0e6d125084a70c Mon Sep 17 00:00:00 2001 From: arran Date: Fri, 22 Jan 2021 16:48:41 +1100 Subject: [PATCH 091/107] Buffer is required as it was originally there too --- src/import-dotx/import-dotx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/import-dotx/import-dotx.ts b/src/import-dotx/import-dotx.ts index 6c509c6383..80cd0666dd 100644 --- a/src/import-dotx/import-dotx.ts +++ b/src/import-dotx/import-dotx.ts @@ -46,7 +46,7 @@ export interface IDocumentTemplate { } export class ImportDotx { - public async extract(data: string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream): Promise { + public async extract(data: Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream): Promise { const zipContent = await JSZip.loadAsync(data); const documentContent = await zipContent.files["word/document.xml"].async("text"); From f2480673ec150e13c6d2dc4976c8e813f52f50a4 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 25 Jan 2021 08:20:27 +0000 Subject: [PATCH 092/107] build(deps-dev): bump sinon from 9.2.2 to 9.2.4 Bumps [sinon](https://github.com/sinonjs/sinon) from 9.2.2 to 9.2.4. - [Release notes](https://github.com/sinonjs/sinon/releases) - [Changelog](https://github.com/sinonjs/sinon/blob/master/CHANGELOG.md) - [Commits](https://github.com/sinonjs/sinon/compare/v9.2.2...v9.2.4) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32414b26c7..04ba9d02b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -462,9 +462,9 @@ "dev": true }, "@sinonjs/commons": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.1.tgz", - "integrity": "sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.2.tgz", + "integrity": "sha512-sruwd86RJHdsVf/AtBoijDmUqJp3B6hF/DGC23C+JaegnDHaZyewCjoVGTdg3J0uz3Zs7NnIT05OBOmML72lQw==", "dev": true, "requires": { "type-detect": "4.0.8" @@ -487,20 +487,10 @@ "@sinonjs/commons": "^1.7.0" } }, - "@sinonjs/formatio": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz", - "integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==", - "dev": true, - "requires": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^5.0.2" - } - }, "@sinonjs/samsam": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.0.tgz", - "integrity": "sha512-hXpcfx3aq+ETVBwPlRFICld5EnrkexXuXDwqUNhDdr5L8VjvMeSRwyOa0qL7XFmR+jVWR4rUZtnxlG7RX72sBg==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.1.tgz", + "integrity": "sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg==", "dev": true, "requires": { "@sinonjs/commons": "^1.6.0", @@ -7358,15 +7348,14 @@ "dev": true }, "sinon": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.2.tgz", - "integrity": "sha512-9Owi+RisvCZpB0bdOVFfL314I6I4YoRlz6Isi4+fr8q8YQsDPoCe5UnmNtKHRThX3negz2bXHWIuiPa42vM8EQ==", + "version": "9.2.4", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz", + "integrity": "sha512-zljcULZQsJxVra28qIAL6ow1Z9tpattkCTEJR4RBP3TGc00FcttsP5pK284Nas5WjMZU5Yzy3kAIp3B3KRf5Yg==", "dev": true, "requires": { "@sinonjs/commons": "^1.8.1", "@sinonjs/fake-timers": "^6.0.1", - "@sinonjs/formatio": "^5.0.1", - "@sinonjs/samsam": "^5.3.0", + "@sinonjs/samsam": "^5.3.1", "diff": "^4.0.2", "nise": "^4.0.4", "supports-color": "^7.1.0" From 3ccf4bdfe32deb23f2691497bc17aec33e5437b6 Mon Sep 17 00:00:00 2001 From: arran Date: Tue, 26 Jan 2021 15:09:12 +1100 Subject: [PATCH 093/107] Ran npm run style.fix added "line_ending" configuration to .editorconfig to match the results --- .editorconfig | 1 + src/import-dotx/import-dotx.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 9b7352176a..46c1eafce3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,7 @@ indent_style = space indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true +end_of_line = lf [*.md] max_line_length = off diff --git a/src/import-dotx/import-dotx.ts b/src/import-dotx/import-dotx.ts index 80cd0666dd..4c77ea75be 100644 --- a/src/import-dotx/import-dotx.ts +++ b/src/import-dotx/import-dotx.ts @@ -46,7 +46,9 @@ export interface IDocumentTemplate { } export class ImportDotx { - public async extract(data: Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream): Promise { + public async extract( + data: Buffer | string | number[] | Uint8Array | ArrayBuffer | Blob | NodeJS.ReadableStream, + ): Promise { const zipContent = await JSZip.loadAsync(data); const documentContent = await zipContent.files["word/document.xml"].async("text"); From d6f363b275f8d08c34263e4e732122099e7c9c75 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 31 Jan 2021 04:54:26 +0000 Subject: [PATCH 094/107] Version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index be21f2a5f5..562c48b57c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.4.1", + "version": "5.5.0", "description": "Easily generate .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.", "main": "build/index.js", "scripts": { From 4dafa62e171ef76625d16f9b2fa017e6d47c385a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 10 Feb 2021 07:52:30 +0000 Subject: [PATCH 095/107] build(deps): bump jszip from 3.5.0 to 3.6.0 Bumps [jszip](https://github.com/Stuk/jszip) from 3.5.0 to 3.6.0. - [Release notes](https://github.com/Stuk/jszip/releases) - [Changelog](https://github.com/Stuk/jszip/blob/master/CHANGES.md) - [Commits](https://github.com/Stuk/jszip/commits) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a18508ba4c..0e600045af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "docx", - "version": "5.4.1", + "version": "5.5.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4949,9 +4949,9 @@ } }, "jszip": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.5.0.tgz", - "integrity": "sha512-WRtu7TPCmYePR1nazfrtuF216cIVon/3GWOvHS9QR5bIwSbnxtdpma6un3jyGGNhHsKCSzn5Ypk+EkDRvTGiFA==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.6.0.tgz", + "integrity": "sha512-jgnQoG9LKnWO3mnVNBnfhkh0QknICd1FGSrXcgrl67zioyJ4wgx25o9ZqwNtrROSflGBCGYnJfjrIyRIby1OoQ==", "requires": { "lie": "~3.3.0", "pako": "~1.0.2", From 48c1559a775f996580d02a059b7b4cf882068208 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 18 Feb 2021 07:58:12 +0000 Subject: [PATCH 096/107] build(deps-dev): bump @types/mocha from 8.2.0 to 8.2.1 Bumps [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/mocha) from 8.2.0 to 8.2.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/mocha) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0e600045af..51c6df7417 100644 --- a/package-lock.json +++ b/package-lock.json @@ -566,9 +566,9 @@ "dev": true }, "@types/mocha": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.0.tgz", - "integrity": "sha512-/Sge3BymXo4lKc31C8OINJgXLaw+7vL1/L1pGiBNpGrBiT8FQiaFpSYV0uhTaG4y78vcMBTMFsWaHDvuD+xGzQ==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.1.tgz", + "integrity": "sha512-NysN+bNqj6E0Hv4CTGWSlPzMW6vTKjDpOteycDkV4IWBsO+PU48JonrPzV9ODjiI2XrjmA05KInLgF5ivZ/YGQ==", "dev": true }, "@types/node": { From 858a994d134d1bd81c4881d5fc48a0b9977a0d2f Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 22 Feb 2021 21:04:02 +0000 Subject: [PATCH 097/107] #339 Add Section Type --- demo/58-section-types.ts | 93 +++++++++++++++++++ docs/usage/sections.md | 27 ++++++ .../document/body/section-properties/index.ts | 1 + .../section-properties.spec.ts | 13 +++ .../section-properties/section-properties.ts | 8 ++ .../body/section-properties/type/index.ts | 2 + .../type/section-type-attributes.ts | 17 ++++ .../type/section-type.spec.ts | 35 +++++++ .../section-properties/type/section-type.ts | 10 ++ 9 files changed, 206 insertions(+) create mode 100644 demo/58-section-types.ts create mode 100644 src/file/document/body/section-properties/type/index.ts create mode 100644 src/file/document/body/section-properties/type/section-type-attributes.ts create mode 100644 src/file/document/body/section-properties/type/section-type.spec.ts create mode 100644 src/file/document/body/section-properties/type/section-type.ts diff --git a/demo/58-section-types.ts b/demo/58-section-types.ts new file mode 100644 index 0000000000..6c16b44600 --- /dev/null +++ b/demo/58-section-types.ts @@ -0,0 +1,93 @@ +// Usage of different Section Types +// Import from 'docx' rather than '../build' if you install from npm +import * as fs from "fs"; +import { Document, Packer, Paragraph, TextRun, SectionType } from "../build"; + +const doc = new Document(); + +doc.addSection({ + properties: {}, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + ], +}); + +doc.addSection({ + properties: { + type: SectionType.CONTINUOUS, + }, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + ], +}); + +doc.addSection({ + properties: { + type: SectionType.ODD_PAGE, + }, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + ], +}); + +doc.addSection({ + properties: { + type: SectionType.EVEN_PAGE, + }, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + ], +}); + +doc.addSection({ + properties: { + type: SectionType.NEXT_PAGE, + }, + children: [ + new Paragraph({ + children: [ + new TextRun("Hello World"), + new TextRun({ + text: "Foo Bar", + bold: true, + }), + ], + }), + ], +}); + +Packer.toBuffer(doc).then((buffer) => { + fs.writeFileSync("My Document.docx", buffer); +}); diff --git a/docs/usage/sections.md b/docs/usage/sections.md index 5b6d4e9c74..daabb02294 100644 --- a/docs/usage/sections.md +++ b/docs/usage/sections.md @@ -19,3 +19,30 @@ doc.addSection({ ], }); ``` + +## Properties + +You can specify additional properties to the section, by providing a `properties` attribute. + +### Section Type + +Setting the section type determines how the contents of the section will be placed relative to the previous section. E.g., There are five different types: + +- `CONTINUOUS` +- `EVEN_PAGE` +- `NEXT_COLUMN` +- `NEXT_PAGE` +- `ODD_PAGE` + +```ts +doc.addSection({ + properties: { + type: SectionType.CONTINUOUS, + } + children: [ + new Paragraph({ + children: [new TextRun("Hello World")], + }), + ], +}); +``` diff --git a/src/file/document/body/section-properties/index.ts b/src/file/document/body/section-properties/index.ts index 47e56ec172..ee0820c640 100644 --- a/src/file/document/body/section-properties/index.ts +++ b/src/file/document/body/section-properties/index.ts @@ -6,3 +6,4 @@ export * from "./page-number"; export * from "./page-border"; export * from "./line-number"; export * from "./vertical-align"; +export * from "./type"; diff --git a/src/file/document/body/section-properties/section-properties.spec.ts b/src/file/document/body/section-properties/section-properties.spec.ts index 8a55699eb5..7fca1ae265 100644 --- a/src/file/document/body/section-properties/section-properties.spec.ts +++ b/src/file/document/body/section-properties/section-properties.spec.ts @@ -9,6 +9,7 @@ import { Media } from "file/media"; import { PageBorderOffsetFrom } from "./page-border"; import { PageNumberFormat } from "./page-number"; import { SectionProperties } from "./section-properties"; +import { SectionType } from "./type/section-type-attributes"; import { SectionVerticalAlignValue } from "./vertical-align"; describe("SectionProperties", () => { @@ -199,5 +200,17 @@ describe("SectionProperties", () => { const pgNumType = tree["w:sectPr"].find((item) => item["w:pgNumType"] !== undefined); expect(pgNumType).to.equal(undefined); }); + + it("should create section properties with section type", () => { + const properties = new SectionProperties({ + type: SectionType.CONTINUOUS, + }); + const tree = new Formatter().format(properties); + expect(Object.keys(tree)).to.deep.equal(["w:sectPr"]); + const type = tree["w:sectPr"].find((item) => item["w:type"] !== undefined); + expect(type).to.deep.equal({ + "w:type": { _attr: { "w:val": "continuous" } }, + }); + }); }); }); diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index d497bb9131..4b6df3252e 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -18,6 +18,8 @@ import { IPageMarginAttributes } from "./page-margin/page-margin-attributes"; import { IPageNumberTypeAttributes, PageNumberType } from "./page-number"; import { PageSize } from "./page-size/page-size"; import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes"; +import { Type } from "./type/section-type"; +import { SectionType } from "./type/section-type-attributes"; import { TitlePage } from "./title-page/title-page"; import { ISectionVerticalAlignAttributes, SectionVerticalAlign } from "./vertical-align"; @@ -53,6 +55,7 @@ export type SectionPropertiesOptions = IPageSizeAttributes & readonly space?: number; readonly count?: number; }; + readonly type?: SectionType; }; // Need to decouple this from the attributes @@ -91,6 +94,7 @@ export class SectionProperties extends XmlComponent { pageBorderLeft, titlePage = false, verticalAlign, + type, } = options; this.options = options; @@ -129,6 +133,10 @@ export class SectionProperties extends XmlComponent { if (verticalAlign) { this.root.push(new SectionVerticalAlign(verticalAlign)); } + + if (type) { + this.root.push(new Type(type)); + } } private addHeaders(headers?: IHeaderFooterGroup): void { diff --git a/src/file/document/body/section-properties/type/index.ts b/src/file/document/body/section-properties/type/index.ts new file mode 100644 index 0000000000..fd7a8abd9c --- /dev/null +++ b/src/file/document/body/section-properties/type/index.ts @@ -0,0 +1,2 @@ +export * from "./section-type"; +export * from "./section-type-attributes"; diff --git a/src/file/document/body/section-properties/type/section-type-attributes.ts b/src/file/document/body/section-properties/type/section-type-attributes.ts new file mode 100644 index 0000000000..4ac8dd60b4 --- /dev/null +++ b/src/file/document/body/section-properties/type/section-type-attributes.ts @@ -0,0 +1,17 @@ +import { XmlAttributeComponent } from "file/xml-components"; + +export enum SectionType { + CONTINUOUS = "continuous", + EVEN_PAGE = "evenPage", + NEXT_COLUMN = "nextColumn", + NEXT_PAGE = "nextPage", + ODD_PAGE = "oddPage", +} + +export class SectionTypeAttributes extends XmlAttributeComponent<{ + readonly val: SectionType; +}> { + protected readonly xmlKeys = { + val: "w:val", + }; +} diff --git a/src/file/document/body/section-properties/type/section-type.spec.ts b/src/file/document/body/section-properties/type/section-type.spec.ts new file mode 100644 index 0000000000..7276825fab --- /dev/null +++ b/src/file/document/body/section-properties/type/section-type.spec.ts @@ -0,0 +1,35 @@ +import { expect } from "chai"; + +import { Formatter } from "export/formatter"; +import { Type } from "./section-type"; +import { SectionType } from "./section-type-attributes"; + +describe("Type", () => { + it("should create with even page section type", () => { + const sectionType = new Type(SectionType.EVEN_PAGE); + + const tree = new Formatter().format(sectionType); + + expect(tree).to.deep.equal({ + "w:type": { + _attr: { + "w:val": "evenPage", + }, + }, + }); + }); + + it("should create with continuous section type", () => { + const sectionType = new Type(SectionType.CONTINUOUS); + + const tree = new Formatter().format(sectionType); + + expect(tree).to.deep.equal({ + "w:type": { + _attr: { + "w:val": "continuous", + }, + }, + }); + }); +}); diff --git a/src/file/document/body/section-properties/type/section-type.ts b/src/file/document/body/section-properties/type/section-type.ts new file mode 100644 index 0000000000..3a11f2e041 --- /dev/null +++ b/src/file/document/body/section-properties/type/section-type.ts @@ -0,0 +1,10 @@ +// http://officeopenxml.com/WPsection.php +import { XmlComponent } from "file/xml-components"; +import { SectionType, SectionTypeAttributes } from "./section-type-attributes"; + +export class Type extends XmlComponent { + constructor(value: SectionType) { + super("w:type"); + this.root.push(new SectionTypeAttributes({ val: value })); + } +} From bfd0f0c7bb3d225868e20851ab1f739f8b643d5d Mon Sep 17 00:00:00 2001 From: Dolan Date: Mon, 22 Feb 2021 21:12:38 +0000 Subject: [PATCH 098/107] Fix linting --- src/file/document/body/section-properties/section-properties.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index 4b6df3252e..133051cb6e 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -18,9 +18,9 @@ import { IPageMarginAttributes } from "./page-margin/page-margin-attributes"; import { IPageNumberTypeAttributes, PageNumberType } from "./page-number"; import { PageSize } from "./page-size/page-size"; import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes"; +import { TitlePage } from "./title-page/title-page"; import { Type } from "./type/section-type"; import { SectionType } from "./type/section-type-attributes"; -import { TitlePage } from "./title-page/title-page"; import { ISectionVerticalAlignAttributes, SectionVerticalAlign } from "./vertical-align"; export interface IHeaderFooterGroup { From 32ceaa415eb6f9830e478b4a6355d3eb7b3f3553 Mon Sep 17 00:00:00 2001 From: Khalil Mansouri Date: Wed, 24 Feb 2021 13:30:40 +0100 Subject: [PATCH 099/107] Fix documentation typo --- docs/usage/bullet-points.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/usage/bullet-points.md b/docs/usage/bullet-points.md index 7ffcf6f241..159241b3b0 100644 --- a/docs/usage/bullet-points.md +++ b/docs/usage/bullet-points.md @@ -5,12 +5,21 @@ To make a bullet point, simply make a paragraph into a bullet point: ```ts -const text = new TextRun("Bullet points"); -const paragraph = new Paragraph({ - text: "Bullet points", - bullet: { - level: 0, //How deep you want the bullet to be - }, +doc.addSection({ + children: [ + new Paragraph({ + text: "Bullet points", + bullet: { + level: 0 //How deep you want the bullet to be + } + }), + new Paragraph({ + text: "Are awesome", + bullet: { + level: 0 + } + }) + ], }); ``` From 10455a534f1477c0381a19b39bc4cbd9b10b2a69 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 27 Feb 2021 01:40:55 +0000 Subject: [PATCH 100/107] #332 Compatability mode --- src/file/core-properties/properties.ts | 1 + src/file/file.ts | 4 +- .../compatibility-setting.spec.ts | 23 ++++++++++ .../compatibility-setting.ts | 27 ++++++++++++ src/file/settings/compatibility.spec.ts | 10 +++-- src/file/settings/compatibility.ts | 18 +++++--- src/file/settings/settings.spec.ts | 42 +++++++++++-------- src/file/settings/settings.ts | 20 ++++----- 8 files changed, 108 insertions(+), 37 deletions(-) create mode 100644 src/file/settings/compatibility-setting/compatibility-setting.spec.ts create mode 100644 src/file/settings/compatibility-setting/compatibility-setting.ts diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index ae9f227ad5..369e119697 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -37,6 +37,7 @@ export interface IPropertiesOptions { readonly features?: { readonly trackRevisions?: boolean; }; + readonly compatabilityModeVersion?: number; } export class CoreProperties extends XmlComponent { diff --git a/src/file/file.ts b/src/file/file.ts index 90986d16d7..2a2c3982fa 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -86,7 +86,9 @@ export class File { this.footNotes = new FootNotes(); this.contentTypes = new ContentTypes(); this.document = new Document({ background: options.background || {} }); - this.settings = new Settings(); + this.settings = new Settings({ + compatabilityModeVersion: options.compatabilityModeVersion, + }); this.media = fileProperties.template && fileProperties.template.media ? fileProperties.template.media : new Media(); diff --git a/src/file/settings/compatibility-setting/compatibility-setting.spec.ts b/src/file/settings/compatibility-setting/compatibility-setting.spec.ts new file mode 100644 index 0000000000..0f65697cda --- /dev/null +++ b/src/file/settings/compatibility-setting/compatibility-setting.spec.ts @@ -0,0 +1,23 @@ +import { expect } from "chai"; +import { Formatter } from "export/formatter"; + +import { CompatibilitySetting } from "./compatibility-setting"; + +describe("CompatibilitySetting", () => { + describe("#constructor", () => { + it("creates an initially empty property object", () => { + const compatibilitySetting = new CompatibilitySetting(15); + + const tree = new Formatter().format(compatibilitySetting); + expect(tree).to.deep.equal({ + "w:compatSetting": { + _attr: { + "w:name": "compatibilityMode", + "w:uri": "http://schemas.microsoft.com/office/word", + "w:val": 15, + }, + }, + }); + }); + }); +}); diff --git a/src/file/settings/compatibility-setting/compatibility-setting.ts b/src/file/settings/compatibility-setting/compatibility-setting.ts new file mode 100644 index 0000000000..9f2a0b4982 --- /dev/null +++ b/src/file/settings/compatibility-setting/compatibility-setting.ts @@ -0,0 +1,27 @@ +import { XmlAttributeComponent, XmlComponent } from "file/xml-components"; + +export class CompatibilitySettingAttributes extends XmlAttributeComponent<{ + readonly version: number; + readonly name: string; + readonly uri: string; +}> { + protected readonly xmlKeys = { + version: "w:val", + name: "w:name", + uri: "w:uri", + }; +} + +export class CompatibilitySetting extends XmlComponent { + constructor(version: number) { + super("w:compatSetting"); + + this.root.push( + new CompatibilitySettingAttributes({ + version, + uri: "http://schemas.microsoft.com/office/word", + name: "compatibilityMode", + }), + ); + } +} diff --git a/src/file/settings/compatibility.spec.ts b/src/file/settings/compatibility.spec.ts index 6399dcfeea..fa9809672d 100644 --- a/src/file/settings/compatibility.spec.ts +++ b/src/file/settings/compatibility.spec.ts @@ -1,13 +1,14 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; -import { Compatibility } from "file/settings/compatibility"; import { EMPTY_OBJECT } from "file/xml-components"; +import { Compatibility } from "./compatibility"; + describe("Compatibility", () => { describe("#constructor", () => { it("creates an initially empty property object", () => { - const compatibility = new Compatibility(); + const compatibility = new Compatibility({}); const tree = new Formatter().format(compatibility); expect(tree).to.deep.equal({ "w:compat": EMPTY_OBJECT }); @@ -16,8 +17,9 @@ describe("Compatibility", () => { describe("#doNotExpandShiftReturn", () => { it("should create a setting for not justifying lines ending in soft line break", () => { - const compatibility = new Compatibility(); - compatibility.doNotExpandShiftReturn(); + const compatibility = new Compatibility({ + doNotExpandShiftReturn: true, + }); const tree = new Formatter().format(compatibility); expect(tree).to.deep.equal({ "w:compat": [{ "w:doNotExpandShiftReturn": EMPTY_OBJECT }] }); diff --git a/src/file/settings/compatibility.ts b/src/file/settings/compatibility.ts index afd2dd0f37..fe63da92c5 100644 --- a/src/file/settings/compatibility.ts +++ b/src/file/settings/compatibility.ts @@ -1,4 +1,5 @@ import { XmlComponent } from "file/xml-components"; +import { CompatibilitySetting } from "./compatibility-setting/compatibility-setting"; class DoNotExpandShiftReturn extends XmlComponent { constructor() { @@ -6,14 +7,21 @@ class DoNotExpandShiftReturn extends XmlComponent { } } +export interface ICompatibilityOptions { + readonly doNotExpandShiftReturn?: boolean; + readonly version?: number; +} + export class Compatibility extends XmlComponent { - constructor() { + constructor(options: ICompatibilityOptions) { super("w:compat"); - } - public doNotExpandShiftReturn(): Compatibility { - this.root.push(new DoNotExpandShiftReturn()); + if (options.doNotExpandShiftReturn) { + this.root.push(new DoNotExpandShiftReturn()); + } - return this; + if (options.version) { + this.root.push(new CompatibilitySetting(options.version)); + } } } diff --git a/src/file/settings/settings.spec.ts b/src/file/settings/settings.spec.ts index 69c7c089d5..381b24d372 100644 --- a/src/file/settings/settings.spec.ts +++ b/src/file/settings/settings.spec.ts @@ -7,7 +7,7 @@ import { Settings } from "./settings"; describe("Settings", () => { describe("#constructor", () => { it("should create a empty Settings with correct rootKey", () => { - const settings = new Settings(); + const settings = new Settings({}); const tree = new Formatter().format(settings); let keys = Object.keys(tree); expect(keys).is.an.instanceof(Array); @@ -15,7 +15,7 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); keys = Object.keys(tree["w:settings"]); expect(keys).is.an.instanceof(Array); - expect(keys).has.length(2); + expect(keys).has.length(3); }); }); describe("#addUpdateFields", () => { @@ -27,16 +27,16 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(3); + expect(rootArray).has.length(4); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[2]); + keys = Object.keys(rootArray[3]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:updateFields"); - const updateFields = rootArray[2]["w:updateFields"]; + const updateFields = rootArray[3]["w:updateFields"]; keys = Object.keys(updateFields); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); @@ -45,12 +45,12 @@ describe("Settings", () => { expect(updateFieldsAttr["w:val"]).to.be.equal(true); }; it("should add a UpdateFields with value true", () => { - const settings = new Settings(); + const settings = new Settings({}); settings.addUpdateFields(); assertSettingsWithUpdateFields(settings); }); it("should add a UpdateFields with value true only once", () => { - const settings = new Settings(); + const settings = new Settings({}); settings.addUpdateFields(); assertSettingsWithUpdateFields(settings); settings.addUpdateFields(); @@ -58,9 +58,8 @@ describe("Settings", () => { }); }); describe("#addCompatibility", () => { - it("should add an empty Compatibility", () => { - const settings = new Settings(); - settings.addCompatibility(); + it("should add an empty Compatibility by default", () => { + const settings = new Settings({}); const tree = new Formatter().format(settings); let keys: string[] = Object.keys(tree); @@ -72,15 +71,24 @@ describe("Settings", () => { expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[2]); + keys = Object.keys(rootArray[1]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:compat"); + expect(rootArray[1]["w:compat"][0]).to.deep.equal({ + "w:compatSetting": { + _attr: { + "w:val": 15, + "w:uri": "http://schemas.microsoft.com/office/word", + "w:name": "compatibilityMode", + }, + }, + }); }); }); describe("#addTrackRevisions", () => { it("should add an empty Track Revisions", () => { - const settings = new Settings(); + const settings = new Settings({}); settings.addTrackRevisions(); const tree = new Formatter().format(settings); @@ -88,12 +96,12 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(3); + expect(rootArray).has.length(4); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[2]); + keys = Object.keys(rootArray[3]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:trackRevisions"); @@ -101,7 +109,7 @@ describe("Settings", () => { }); describe("#addTrackRevisionsTwice", () => { it("should add an empty Track Revisions if called twice", () => { - const settings = new Settings(); + const settings = new Settings({}); settings.addTrackRevisions(); settings.addTrackRevisions(); @@ -110,12 +118,12 @@ describe("Settings", () => { expect(keys[0]).to.be.equal("w:settings"); const rootArray = tree["w:settings"]; expect(rootArray).is.an.instanceof(Array); - expect(rootArray).has.length(3); + expect(rootArray).has.length(4); keys = Object.keys(rootArray[0]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("_attr"); - keys = Object.keys(rootArray[2]); + keys = Object.keys(rootArray[3]); expect(keys).is.an.instanceof(Array); expect(keys).has.length(1); expect(keys[0]).to.be.equal("w:trackRevisions"); diff --git a/src/file/settings/settings.ts b/src/file/settings/settings.ts index d838e8ccc7..7801ed8fe5 100644 --- a/src/file/settings/settings.ts +++ b/src/file/settings/settings.ts @@ -46,11 +46,15 @@ export class SettingsAttributes extends XmlAttributeComponent child instanceof Compatibility)) { - this.addChildElement(this.compatibility); - } - - return this.compatibility; - } - public addTrackRevisions(): TrackRevisions { if (!this.root.find((child) => child instanceof TrackRevisions)) { this.addChildElement(this.trackRevisions); From 4159be5644e671ffda548fe1cb6cfe3c3834b40a Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 27 Feb 2021 01:42:29 +0000 Subject: [PATCH 101/107] Add readonly --- src/file/settings/settings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file/settings/settings.ts b/src/file/settings/settings.ts index 7801ed8fe5..e63d539a39 100644 --- a/src/file/settings/settings.ts +++ b/src/file/settings/settings.ts @@ -47,7 +47,7 @@ export class SettingsAttributes extends XmlAttributeComponent Date: Sat, 27 Feb 2021 19:23:29 +0000 Subject: [PATCH 102/107] #773 Better hyperlink and bookmark syntax Allow for images to be hyperlinked as well --- demo/21-bookmarks.ts | 18 +++--- demo/35-hyperlinks.ts | 41 +++++++----- package-lock.json | 8 +-- package.json | 2 +- src/file/core-properties/properties.ts | 16 +---- src/file/document/document.ts | 4 +- src/file/file.spec.ts | 45 +------------ src/file/file.ts | 62 +----------------- src/file/media/media.ts | 2 +- src/file/paragraph/links/hyperlink.spec.ts | 74 +++++++++++++++++++--- src/file/paragraph/links/hyperlink.ts | 34 +++++----- src/file/paragraph/paragraph.spec.ts | 48 +++++++++++--- src/file/paragraph/paragraph.ts | 44 ++++++++----- 13 files changed, 195 insertions(+), 203 deletions(-) diff --git a/demo/21-bookmarks.ts b/demo/21-bookmarks.ts index 1ad50eb9b1..c5da12673d 100644 --- a/demo/21-bookmarks.ts +++ b/demo/21-bookmarks.ts @@ -1,7 +1,7 @@ // This demo shows how to create bookmarks then link to them with internal hyperlinks // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Bookmark, Document, HeadingLevel, HyperlinkRef, HyperlinkType, Packer, PageBreak, Paragraph } from "../build"; +import { Bookmark, Document, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun } from "../build"; const LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante."; @@ -10,12 +10,6 @@ const doc = new Document({ creator: "Clippy", title: "Sample Document", description: "A brief example of using docx with bookmarks and internal hyperlinks", - hyperlinks: { - myAnchorId: { - text: "Hyperlink", - type: HyperlinkType.INTERNAL, - }, - }, }); doc.addSection({ @@ -30,7 +24,15 @@ doc.addSection({ children: [new PageBreak()], }), new Paragraph({ - children: [new HyperlinkRef("myAnchorId")], + children: [ + new InternalHyperlink({ + child: new TextRun({ + text: "Anchor Text", + style: "Hyperlink", + }), + anchor: "myAnchorId", + }), + ], }), ], }); diff --git a/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts index 65ed9390d4..8346cd1028 100644 --- a/demo/35-hyperlinks.ts +++ b/demo/35-hyperlinks.ts @@ -1,32 +1,39 @@ // Example on how to add hyperlinks to websites // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Document, HyperlinkRef, HyperlinkType, Packer, Paragraph, Media } from "../build"; +import { ExternalHyperlink, Document, Packer, Paragraph, Media, TextRun } from "../build"; -const doc = new Document({ - hyperlinks: { - myCoolLink: { - link: "http://www.example.com", - text: "Hyperlink", - type: HyperlinkType.EXTERNAL, - }, - myOtherLink: { - link: "http://www.google.com", - text: "Google Link", - type: HyperlinkType.EXTERNAL, - }, - }, -}); +const doc = new Document({}); const image1 = Media.addImage(doc, fs.readFileSync("./demo/images/image1.jpeg")); doc.addSection({ children: [ new Paragraph({ - children: [new HyperlinkRef("myCoolLink")], + children: [ + new ExternalHyperlink({ + child: new TextRun({ + text: "Anchor Text", + style: "Hyperlink", + }), + link: "http://www.example.com", + }), + ], }), new Paragraph({ - children: [image1, new HyperlinkRef("myOtherLink")], + children: [ + new ExternalHyperlink({ + child: image1, + link: "http://www.google.com", + }), + new ExternalHyperlink({ + child: new TextRun({ + text: "BBC News Link", + style: "Hyperlink", + }), + link: "https://www.bbc.co.uk/news", + }), + ], }), ], }); diff --git a/package-lock.json b/package-lock.json index 51c6df7417..6d7d1eef60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4884,7 +4884,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -8149,9 +8149,9 @@ } }, "typescript": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", - "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.2.2.tgz", + "integrity": "sha512-tbb+NVrLfnsJy3M59lsDgrzWIflR4d4TIUjz+heUnHZwdF7YsrMTKoRERiIvI2lvBG95dfpLxB21WZhys1bgaQ==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 562c48b57c..1671bfdfb3 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "tslint": "^6.1.3", "tslint-immutable": "^6.0.1", "typedoc": "^0.16.11", - "typescript": "2.9.2", + "typescript": "4.2.2", "webpack": "^3.10.0" }, "engines": { diff --git a/src/file/core-properties/properties.ts b/src/file/core-properties/properties.ts index 369e119697..8e3921df0c 100644 --- a/src/file/core-properties/properties.ts +++ b/src/file/core-properties/properties.ts @@ -3,21 +3,10 @@ import { IDocumentBackgroundOptions } from "../document"; import { DocumentAttributes } from "../document/document-attributes"; import { INumberingOptions } from "../numbering"; -import { HyperlinkType, Paragraph } from "../paragraph"; +import { Paragraph } from "../paragraph"; import { IStylesOptions } from "../styles"; import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components"; -export interface IInternalHyperlinkDefinition { - readonly text: string; - readonly type: HyperlinkType.INTERNAL; -} - -export interface IExternalHyperlinkDefinition { - readonly link: string; - readonly text: string; - readonly type: HyperlinkType.EXTERNAL; -} - export interface IPropertiesOptions { readonly title?: string; readonly subject?: string; @@ -30,9 +19,6 @@ export interface IPropertiesOptions { readonly styles?: IStylesOptions; readonly numbering?: INumberingOptions; readonly footnotes?: Paragraph[]; - readonly hyperlinks?: { - readonly [key: string]: IInternalHyperlinkDefinition | IExternalHyperlinkDefinition; - }; readonly background?: IDocumentBackgroundOptions; readonly features?: { readonly trackRevisions?: boolean; diff --git a/src/file/document/document.ts b/src/file/document/document.ts index fb0f579568..93d4035fa1 100644 --- a/src/file/document/document.ts +++ b/src/file/document/document.ts @@ -1,6 +1,6 @@ // http://officeopenxml.com/WPdocument.php import { XmlComponent } from "file/xml-components"; -import { Hyperlink, Paragraph } from "../paragraph"; +import { ConcreteHyperlink, Paragraph } from "../paragraph"; import { Table } from "../table"; import { TableOfContents } from "../table-of-contents"; import { Body } from "./body"; @@ -42,7 +42,7 @@ export class Document extends XmlComponent { this.root.push(this.body); } - public add(item: Paragraph | Table | TableOfContents | Hyperlink): Document { + public add(item: Paragraph | Table | TableOfContents | ConcreteHyperlink): Document { this.body.push(item); return this; } diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index 9b93a63db1..9632b80897 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -5,7 +5,7 @@ import { Formatter } from "export/formatter"; import { File } from "./file"; import { Footer, Header } from "./header"; -import { HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph"; +import { Paragraph } from "./paragraph"; import { Table, TableCell, TableRow } from "./table"; import { TableOfContents } from "./table-of-contents"; @@ -164,16 +164,6 @@ describe("File", () => { ], }); }); - - it("should add hyperlink child", () => { - const doc = new File(undefined, undefined, [ - { - children: [new HyperlinkRef("test")], - }, - ]); - - expect(doc.HyperlinkCache).to.deep.equal({}); - }); }); describe("#addSection", () => { @@ -187,16 +177,6 @@ describe("File", () => { expect(spy.called).to.equal(true); }); - it("should add hyperlink child", () => { - const doc = new File(); - - doc.addSection({ - children: [new HyperlinkRef("test")], - }); - - expect(doc.HyperlinkCache).to.deep.equal({}); - }); - it("should call the underlying document's add when adding a Table", () => { const file = new File(); const spy = sinon.spy(file.Document, "add"); @@ -256,29 +236,6 @@ describe("File", () => { }); }); - describe("#HyperlinkCache", () => { - it("should initially have empty hyperlink cache", () => { - const file = new File(); - - expect(file.HyperlinkCache).to.deep.equal({}); - }); - - it("should have hyperlink cache when option is added", () => { - const file = new File({ - hyperlinks: { - myCoolLink: { - link: "http://www.example.com", - text: "Hyperlink", - type: HyperlinkType.EXTERNAL, - }, - }, - }); - - // tslint:disable-next-line: no-unused-expression no-string-literal - expect(file.HyperlinkCache["myCoolLink"]).to.exist; - }); - }); - describe("#createFootnote", () => { it("should create footnote", () => { const wrapper = new File({ diff --git a/src/file/file.ts b/src/file/file.ts index 2a2c3982fa..20d292f91b 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -1,4 +1,3 @@ -import * as shortid from "shortid"; import { AppProperties } from "./app-properties/app-properties"; import { ContentTypes } from "./content-types/content-types"; import { CoreProperties, IPropertiesOptions } from "./core-properties"; @@ -17,9 +16,8 @@ import { Footer, Header } from "./header"; import { HeaderWrapper, IDocumentHeader } from "./header-wrapper"; import { Media } from "./media"; import { Numbering } from "./numbering"; -import { Hyperlink, HyperlinkRef, HyperlinkType, Paragraph } from "./paragraph"; +import { Paragraph } from "./paragraph"; import { Relationships } from "./relationships"; -import { TargetModeType } from "./relationships/relationship/relationship"; import { Settings } from "./settings"; import { Styles } from "./styles"; import { ExternalStylesFactory } from "./styles/external-styles-factory"; @@ -41,7 +39,7 @@ export interface ISectionOptions { readonly size?: IPageSizeAttributes; readonly margins?: IPageMarginAttributes; readonly properties?: SectionPropertiesOptions; - readonly children: (Paragraph | Table | TableOfContents | HyperlinkRef)[]; + readonly children: (Paragraph | Table | TableOfContents)[]; } export class File { @@ -61,7 +59,6 @@ export class File { private readonly contentTypes: ContentTypes; private readonly appProperties: AppProperties; private readonly styles: Styles; - private readonly hyperlinkCache: { readonly [key: string]: Hyperlink } = {}; constructor( options: IPropertiesOptions = { @@ -136,12 +133,6 @@ export class File { this.document.Body.addSection(section.properties ? section.properties : {}); for (const child of section.children) { - if (child instanceof HyperlinkRef) { - const hyperlink = this.hyperlinkCache[child.id]; - this.document.add(hyperlink); - continue; - } - this.document.add(child); } } @@ -152,27 +143,6 @@ export class File { } } - if (options.hyperlinks) { - const cache = {}; - - for (const key in options.hyperlinks) { - if (!options.hyperlinks[key]) { - continue; - } - - const hyperlinkRef = options.hyperlinks[key]; - - const hyperlink = - hyperlinkRef.type === HyperlinkType.EXTERNAL - ? this.createHyperlink(hyperlinkRef.link, hyperlinkRef.text) - : this.createInternalHyperLink(key, hyperlinkRef.text); - - cache[key] = hyperlink; - } - - this.hyperlinkCache = cache; - } - if (options.features) { if (options.features.trackRevisions) { this.settings.addTrackRevisions(); @@ -205,12 +175,6 @@ export class File { }); for (const child of children) { - if (child instanceof HyperlinkRef) { - const hyperlink = this.hyperlinkCache[child.id]; - this.document.add(hyperlink); - continue; - } - this.document.add(child); } } @@ -221,24 +185,6 @@ export class File { } } - private createHyperlink(link: string, text: string = link): Hyperlink { - const hyperlink = new Hyperlink(text, shortid.generate().toLowerCase()); - this.docRelationships.createRelationship( - hyperlink.linkId, - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", - link, - TargetModeType.EXTERNAL, - ); - return hyperlink; - } - - private createInternalHyperLink(anchor: string, text: string = anchor): Hyperlink { - const hyperlink = new Hyperlink(text, shortid.generate().toLowerCase(), anchor); - // NOTE: unlike File#createHyperlink(), since the link is to an internal bookmark - // we don't need to create a new relationship. - return hyperlink; - } - private createHeader(header: Header): HeaderWrapper { const wrapper = new HeaderWrapper(this.media, this.currentRelationshipId++); @@ -371,8 +317,4 @@ export class File { public get Settings(): Settings { return this.settings; } - - public get HyperlinkCache(): { readonly [key: string]: Hyperlink } { - return this.hyperlinkCache; - } } diff --git a/src/file/media/media.ts b/src/file/media/media.ts index 71e7c6f60e..6168fbc362 100644 --- a/src/file/media/media.ts +++ b/src/file/media/media.ts @@ -82,7 +82,7 @@ export class Media { return imageData; } - public get Array(): IMediaData[] { + public get Array(): readonly IMediaData[] { const array = new Array(); this.map.forEach((data) => { diff --git a/src/file/paragraph/links/hyperlink.spec.ts b/src/file/paragraph/links/hyperlink.spec.ts index 4b06a933f5..50d6aa76aa 100644 --- a/src/file/paragraph/links/hyperlink.spec.ts +++ b/src/file/paragraph/links/hyperlink.spec.ts @@ -2,14 +2,20 @@ import { expect } from "chai"; import { Formatter } from "export/formatter"; -import { Hyperlink } from "./"; -import { HyperlinkRef } from "./hyperlink"; +import { TextRun } from "../run"; +import { ConcreteHyperlink, ExternalHyperlink, InternalHyperlink } from "./hyperlink"; -describe("Hyperlink", () => { - let hyperlink: Hyperlink; +describe("ConcreteHyperlink", () => { + let hyperlink: ConcreteHyperlink; beforeEach(() => { - hyperlink = new Hyperlink("https://example.com", "superid"); + hyperlink = new ConcreteHyperlink( + new TextRun({ + text: "https://example.com", + style: "Hyperlink", + }), + "superid", + ); }); describe("#constructor()", () => { @@ -35,7 +41,14 @@ describe("Hyperlink", () => { describe("with optional anchor parameter", () => { beforeEach(() => { - hyperlink = new Hyperlink("Anchor Text", "superid2", "anchor"); + hyperlink = new ConcreteHyperlink( + new TextRun({ + text: "Anchor Text", + style: "Hyperlink", + }), + "superid2", + "anchor", + ); }); it("should create an internal link with anchor tag", () => { @@ -61,10 +74,53 @@ describe("Hyperlink", () => { }); }); -describe("HyperlinkRef", () => { +describe("ExternalHyperlink", () => { describe("#constructor()", () => { - const hyperlinkRef = new HyperlinkRef("test-id"); + it("should create", () => { + const externalHyperlink = new ExternalHyperlink({ + child: new TextRun("test"), + link: "http://www.google.com", + }); - expect(hyperlinkRef.id).to.equal("test-id"); + expect(externalHyperlink.options.link).to.equal("http://www.google.com"); + }); + }); +}); + +describe("InternalHyperlink", () => { + describe("#constructor()", () => { + it("should create", () => { + const internalHyperlink = new InternalHyperlink({ + child: new TextRun("test"), + anchor: "test-id", + }); + + const tree = new Formatter().format(internalHyperlink); + + expect(tree).to.deep.equal({ + "w:hyperlink": [ + { + _attr: { + "w:anchor": "test-id", + "w:history": 1, + }, + }, + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "test", + ], + }, + ], + }, + ], + }); + }); }); }); diff --git a/src/file/paragraph/links/hyperlink.ts b/src/file/paragraph/links/hyperlink.ts index 302acfd603..a7512e7beb 100644 --- a/src/file/paragraph/links/hyperlink.ts +++ b/src/file/paragraph/links/hyperlink.ts @@ -1,6 +1,9 @@ // http://officeopenxml.com/WPhyperlink.php +import * as shortid from "shortid"; + import { XmlComponent } from "file/xml-components"; -import { TextRun } from "../run"; + +import { ParagraphChild } from "../paragraph"; import { HyperlinkAttributes, IHyperlinkAttributesProperties } from "./hyperlink-attributes"; export enum HyperlinkType { @@ -8,15 +11,10 @@ export enum HyperlinkType { EXTERNAL = "EXTERNAL", } -export class HyperlinkRef { - constructor(public readonly id: string) {} -} - -export class Hyperlink extends XmlComponent { +export class ConcreteHyperlink extends XmlComponent { public readonly linkId: string; - private readonly textRun: TextRun; - constructor(text: string, relationshipId: string, anchor?: string) { + constructor(child: ParagraphChild, relationshipId: string, anchor?: string) { super("w:hyperlink"); this.linkId = relationshipId; @@ -29,14 +27,16 @@ export class Hyperlink extends XmlComponent { const attributes = new HyperlinkAttributes(props); this.root.push(attributes); - this.textRun = new TextRun({ - text: text, - style: "Hyperlink", - }); - this.root.push(this.textRun); - } - - public get TextRun(): TextRun { - return this.textRun; + this.root.push(child); } } + +export class InternalHyperlink extends ConcreteHyperlink { + constructor(options: { readonly child: ParagraphChild; readonly anchor: string }) { + super(options.child, shortid.generate().toLowerCase(), options.anchor); + } +} + +export class ExternalHyperlink { + constructor(public readonly options: { readonly child: ParagraphChild; readonly link: string }) {} +} diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index a368684d40..57590f6313 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -8,8 +8,9 @@ import { EMPTY_OBJECT } from "file/xml-components"; import { File } from "../file"; import { ShadingType } from "../table/shading"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; -import { Bookmark, HyperlinkRef } from "./links"; +import { Bookmark, ExternalHyperlink } from "./links"; import { Paragraph } from "./paragraph"; +import { TextRun } from "./run"; describe("Paragraph", () => { describe("#constructor()", () => { @@ -763,7 +764,7 @@ describe("Paragraph", () => { }); describe("#shading", () => { - it("should set paragraph outline level to the given value", () => { + it("should set shading to the given value", () => { const paragraph = new Paragraph({ shading: { type: ShadingType.REVERSE_DIAGONAL_STRIPE, @@ -793,20 +794,49 @@ describe("Paragraph", () => { }); describe("#prepForXml", () => { - it("should set paragraph outline level to the given value", () => { + it("should set Internal Hyperlink", () => { const paragraph = new Paragraph({ - children: [new HyperlinkRef("myAnchorId")], + children: [ + new ExternalHyperlink({ + child: new TextRun("test"), + link: "http://www.google.com", + }), + ], }); const fileMock = ({ - HyperlinkCache: { - myAnchorId: "test", + DocumentRelationships: { + createRelationship: () => ({}), }, - // tslint:disable-next-line: no-any - } as any) as File; + } as unknown) as File; paragraph.prepForXml(fileMock); const tree = new Formatter().format(paragraph); expect(tree).to.deep.equal({ - "w:p": ["test"], + "w:p": [ + { + "w:hyperlink": [ + { + _attr: { + "r:id": "rIdtest-unique-id", + "w:history": 1, + }, + }, + { + "w:r": [ + { + "w:t": [ + { + _attr: { + "xml:space": "preserve", + }, + }, + "test", + ], + }, + ], + }, + ], + }, + ], }); }); }); diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 60efb0da34..dcaf2c480d 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -1,30 +1,35 @@ // http://officeopenxml.com/WPparagraph.php +import * as shortid from "shortid"; + import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { IXmlableObject, XmlComponent } from "file/xml-components"; import { File } from "../file"; +import { TargetModeType } from "../relationships/relationship/relationship"; import { DeletedTextRun, InsertedTextRun } from "../track-revision"; import { PageBreak } from "./formatting/page-break"; -import { Bookmark, HyperlinkRef } from "./links"; +import { Bookmark, ConcreteHyperlink, ExternalHyperlink, InternalHyperlink } from "./links"; import { Math } from "./math"; import { IParagraphPropertiesOptions, ParagraphProperties } from "./properties"; import { PictureRun, Run, SequentialIdentifier, SymbolRun, TextRun } from "./run"; +export type ParagraphChild = + | TextRun + | PictureRun + | SymbolRun + | Bookmark + | PageBreak + | SequentialIdentifier + | FootnoteReferenceRun + | InternalHyperlink + | ExternalHyperlink + | InsertedTextRun + | DeletedTextRun + | Math; + export interface IParagraphOptions extends IParagraphPropertiesOptions { readonly text?: string; - readonly children?: ( - | TextRun - | PictureRun - | SymbolRun - | Bookmark - | PageBreak - | SequentialIdentifier - | FootnoteReferenceRun - | HyperlinkRef - | InsertedTextRun - | DeletedTextRun - | Math - )[]; + readonly children?: ParagraphChild[]; } export class Paragraph extends XmlComponent { @@ -71,9 +76,16 @@ export class Paragraph extends XmlComponent { public prepForXml(file: File): IXmlableObject | undefined { for (const element of this.root) { - if (element instanceof HyperlinkRef) { + if (element instanceof ExternalHyperlink) { const index = this.root.indexOf(element); - this.root[index] = file.HyperlinkCache[element.id]; + const concreteHyperlink = new ConcreteHyperlink(element.options.child, shortid.generate().toLowerCase()); + file.DocumentRelationships.createRelationship( + concreteHyperlink.linkId, + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", + element.options.link, + TargetModeType.EXTERNAL, + ); + this.root[index] = concreteHyperlink; } } From e750735fa4f7a70138547d0a1753c7bb8d65bee2 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 28 Feb 2021 13:09:43 +0000 Subject: [PATCH 103/107] Add bookmark in footer --- demo/21-bookmarks.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/demo/21-bookmarks.ts b/demo/21-bookmarks.ts index c5da12673d..632fcb212f 100644 --- a/demo/21-bookmarks.ts +++ b/demo/21-bookmarks.ts @@ -1,7 +1,7 @@ // This demo shows how to create bookmarks then link to them with internal hyperlinks // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { Bookmark, Document, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun } from "../build"; +import { Bookmark, Document, Footer, HeadingLevel, InternalHyperlink, Packer, PageBreak, Paragraph, TextRun } from "../build"; const LOREM_IPSUM = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam mi velit, convallis convallis scelerisque nec, faucibus nec leo. Phasellus at posuere mauris, tempus dignissim velit. Integer et tortor dolor. Duis auctor efficitur mattis. Vivamus ut metus accumsan tellus auctor sollicitudin venenatis et nibh. Cras quis massa ac metus fringilla venenatis. Proin rutrum mauris purus, ut suscipit magna consectetur id. Integer consectetur sollicitudin ante, vitae faucibus neque efficitur in. Praesent ultricies nibh lectus. Mauris pharetra id odio eget iaculis. Duis dictum, risus id pellentesque rutrum, lorem quam malesuada massa, quis ullamcorper turpis urna a diam. Cras vulputate metus vel massa porta ullamcorper. Etiam porta condimentum nulla nec tristique. Sed nulla urna, pharetra non tortor sed, sollicitudin molestie diam. Maecenas enim leo, feugiat eget vehicula id, sollicitudin vitae ante."; @@ -13,6 +13,23 @@ const doc = new Document({ }); doc.addSection({ + footers: { + default: new Footer({ + children: [ + new Paragraph({ + children: [ + new InternalHyperlink({ + child: new TextRun({ + text: "Click here!", + style: "Hyperlink", + }), + anchor: "myAnchorId", + }), + ], + }), + ], + }), + }, children: [ new Paragraph({ heading: HeadingLevel.HEADING_1, From 655b40d4180cd92f94ea9a977274b37a80eda35b Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 28 Feb 2021 16:04:21 +0000 Subject: [PATCH 104/107] Work on moving Document into its own wrapper --- demo/35-hyperlinks.ts | 20 +++++++- src/export/packer/next-compiler.ts | 16 +++--- src/file/document-wrapper.spec.ts | 50 +++++++++++++++++++ src/file/document-wrapper.ts | 27 ++++++++++ .../section-properties/section-properties.ts | 12 ++--- src/file/document/document.ts | 2 +- src/file/file.spec.ts | 18 +++---- src/file/file.ts | 43 +++++++--------- src/file/footer-wrapper.spec.ts | 6 +-- src/file/footer-wrapper.ts | 5 +- src/file/header-wrapper.spec.ts | 6 +-- src/file/header-wrapper.ts | 5 +- src/file/media/media.ts | 4 +- src/file/paragraph/paragraph.spec.ts | 6 ++- src/file/paragraph/paragraph.ts | 2 +- 15 files changed, 157 insertions(+), 65 deletions(-) create mode 100644 src/file/document-wrapper.spec.ts create mode 100644 src/file/document-wrapper.ts diff --git a/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts index 8346cd1028..85fa5fc1f3 100644 --- a/demo/35-hyperlinks.ts +++ b/demo/35-hyperlinks.ts @@ -1,13 +1,31 @@ // Example on how to add hyperlinks to websites // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { ExternalHyperlink, Document, Packer, Paragraph, Media, TextRun } from "../build"; +import { ExternalHyperlink, Document, Packer, Paragraph, Media, TextRun, Footer } from "../build"; const doc = new Document({}); const image1 = Media.addImage(doc, fs.readFileSync("./demo/images/image1.jpeg")); doc.addSection({ + footers: { + default: new Footer({ + children: [ + new Paragraph({ + children: [ + new TextRun("Click here for the "), + new ExternalHyperlink({ + child: new TextRun({ + text: "Footer external hyperlink", + style: "Hyperlink", + }), + link: "http://www.example.com", + }), + ], + }), + ], + }), + }, children: [ new Paragraph({ children: [ diff --git a/src/export/packer/next-compiler.ts b/src/export/packer/next-compiler.ts index a7b5fb617e..a0c73090fc 100644 --- a/src/export/packer/next-compiler.ts +++ b/src/export/packer/next-compiler.ts @@ -69,23 +69,23 @@ export class Compiler { private xmlifyFile(file: File, prettify?: boolean): IXmlifyedFileMapping { file.verifyUpdateFields(); - const documentRelationshipCount = file.DocumentRelationships.RelationshipCount + 1; + const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1; - const documentXmlData = xml(this.formatter.format(file.Document, file), prettify); + const documentXmlData = xml(this.formatter.format(file.Document.View, file), prettify); const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media); return { Relationships: { data: (() => { documentMediaDatas.forEach((mediaData, i) => { - file.DocumentRelationships.createRelationship( + file.Document.Relationships.createRelationship( documentRelationshipCount + i, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `media/${mediaData.fileName}`, ); }); - return xml(this.formatter.format(file.DocumentRelationships, file), prettify); + return xml(this.formatter.format(file.Document.Relationships, file), prettify); })(), path: "word/_rels/document.xml.rels", }, @@ -120,7 +120,7 @@ export class Compiler { path: "_rels/.rels", }, HeaderRelationships: file.Headers.map((headerWrapper, index) => { - const xmlData = xml(this.formatter.format(headerWrapper.Header, file), prettify); + const xmlData = xml(this.formatter.format(headerWrapper.View, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); mediaDatas.forEach((mediaData, i) => { @@ -137,7 +137,7 @@ export class Compiler { }; }), FooterRelationships: file.Footers.map((footerWrapper, index) => { - const xmlData = xml(this.formatter.format(footerWrapper.Footer, file), prettify); + const xmlData = xml(this.formatter.format(footerWrapper.View, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); mediaDatas.forEach((mediaData, i) => { @@ -154,7 +154,7 @@ export class Compiler { }; }), Headers: file.Headers.map((headerWrapper, index) => { - const tempXmlData = xml(this.formatter.format(headerWrapper.Header, file), prettify); + const tempXmlData = xml(this.formatter.format(headerWrapper.View, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); // TODO: 0 needs to be changed when headers get relationships of their own const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); @@ -165,7 +165,7 @@ export class Compiler { }; }), Footers: file.Footers.map((footerWrapper, index) => { - const tempXmlData = xml(this.formatter.format(footerWrapper.Footer, file), prettify); + const tempXmlData = xml(this.formatter.format(footerWrapper.View, file), prettify); const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); // TODO: 0 needs to be changed when headers get relationships of their own const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); diff --git a/src/file/document-wrapper.spec.ts b/src/file/document-wrapper.spec.ts new file mode 100644 index 0000000000..2a32ad7968 --- /dev/null +++ b/src/file/document-wrapper.spec.ts @@ -0,0 +1,50 @@ +import { expect } from "chai"; +import * as sinon from "sinon"; + +import { FooterWrapper } from "./footer-wrapper"; +import { Media } from "./media"; +import { Paragraph } from "./paragraph"; +import { Table, TableCell, TableRow } from "./table"; + +describe("FooterWrapper", () => { + describe("#add", () => { + it("should call the underlying footer's addParagraph", () => { + const file = new FooterWrapper(new Media(), 1); + const spy = sinon.spy(file.View, "add"); + file.add(new Paragraph({})); + + expect(spy.called).to.equal(true); + }); + + it("should call the underlying footer's addParagraph", () => { + const file = new FooterWrapper(new Media(), 1); + const spy = sinon.spy(file.View, "add"); + file.add( + new Table({ + rows: [ + new TableRow({ + children: [ + new TableCell({ + children: [new Paragraph("hello")], + }), + ], + }), + ], + }), + ); + + expect(spy.called).to.equal(true); + }); + }); + + describe("#addChildElement", () => { + it("should call the underlying footer's addChildElement", () => { + const file = new FooterWrapper(new Media(), 1); + const spy = sinon.spy(file.View, "addChildElement"); + // tslint:disable-next-line:no-any + file.addChildElement({} as any); + + expect(spy.called).to.equal(true); + }); + }); +}); diff --git a/src/file/document-wrapper.ts b/src/file/document-wrapper.ts new file mode 100644 index 0000000000..3054f2c30e --- /dev/null +++ b/src/file/document-wrapper.ts @@ -0,0 +1,27 @@ +import { Document, IDocumentOptions } from "./document"; +import { Footer } from "./footer"; +import { Header } from "./header/header"; +import { Relationships } from "./relationships"; + +export interface IViewWrapper { + readonly View: Document | Footer | Header; + readonly Relationships: Relationships; +} + +export class DocumentWrapper implements IViewWrapper { + private readonly document: Document; + private readonly relationships: Relationships; + + constructor(options: IDocumentOptions) { + this.document = new Document(options); + this.relationships = new Relationships(); + } + + public get View(): Document { + return this.document; + } + + public get Relationships(): Relationships { + return this.relationships; + } +} diff --git a/src/file/document/body/section-properties/section-properties.ts b/src/file/document/body/section-properties/section-properties.ts index 133051cb6e..e3fb1be2a4 100644 --- a/src/file/document/body/section-properties/section-properties.ts +++ b/src/file/document/body/section-properties/section-properties.ts @@ -145,7 +145,7 @@ export class SectionProperties extends XmlComponent { this.root.push( new HeaderReference({ headerType: HeaderReferenceType.DEFAULT, - headerId: headers.default.Header.ReferenceId, + headerId: headers.default.View.ReferenceId, }), ); } @@ -154,7 +154,7 @@ export class SectionProperties extends XmlComponent { this.root.push( new HeaderReference({ headerType: HeaderReferenceType.FIRST, - headerId: headers.first.Header.ReferenceId, + headerId: headers.first.View.ReferenceId, }), ); } @@ -163,7 +163,7 @@ export class SectionProperties extends XmlComponent { this.root.push( new HeaderReference({ headerType: HeaderReferenceType.EVEN, - headerId: headers.even.Header.ReferenceId, + headerId: headers.even.View.ReferenceId, }), ); } @@ -176,7 +176,7 @@ export class SectionProperties extends XmlComponent { this.root.push( new FooterReference({ footerType: FooterReferenceType.DEFAULT, - footerId: footers.default.Footer.ReferenceId, + footerId: footers.default.View.ReferenceId, }), ); } @@ -185,7 +185,7 @@ export class SectionProperties extends XmlComponent { this.root.push( new FooterReference({ footerType: FooterReferenceType.FIRST, - footerId: footers.first.Footer.ReferenceId, + footerId: footers.first.View.ReferenceId, }), ); } @@ -194,7 +194,7 @@ export class SectionProperties extends XmlComponent { this.root.push( new FooterReference({ footerType: FooterReferenceType.EVEN, - footerId: footers.even.Footer.ReferenceId, + footerId: footers.even.View.ReferenceId, }), ); } diff --git a/src/file/document/document.ts b/src/file/document/document.ts index 93d4035fa1..cc33709076 100644 --- a/src/file/document/document.ts +++ b/src/file/document/document.ts @@ -7,7 +7,7 @@ import { Body } from "./body"; import { DocumentAttributes } from "./document-attributes"; import { DocumentBackground, IDocumentBackgroundOptions } from "./document-background"; -interface IDocumentOptions { +export interface IDocumentOptions { readonly background: IDocumentBackgroundOptions; } diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index 9632b80897..952fd6a35c 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -18,7 +18,7 @@ describe("File", () => { children: [], }); - const tree = new Formatter().format(doc.Document.Body); + const tree = new Formatter().format(doc.Document.View.Body); expect(tree["w:body"][0]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); expect(tree["w:body"][0]["w:sectPr"][5]["w:footerReference"]._attr["w:type"]).to.equal("default"); @@ -37,7 +37,7 @@ describe("File", () => { children: [], }); - const tree = new Formatter().format(doc.Document.Body); + const tree = new Formatter().format(doc.Document.View.Body); expect(tree["w:body"][0]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); expect(tree["w:body"][0]["w:sectPr"][5]["w:footerReference"]._attr["w:type"]).to.equal("default"); @@ -56,7 +56,7 @@ describe("File", () => { children: [], }); - const tree = new Formatter().format(doc.Document.Body); + const tree = new Formatter().format(doc.Document.View.Body); expect(tree["w:body"][0]["w:sectPr"][5]["w:headerReference"]._attr["w:type"]).to.equal("first"); expect(tree["w:body"][0]["w:sectPr"][7]["w:footerReference"]._attr["w:type"]).to.equal("first"); @@ -79,7 +79,7 @@ describe("File", () => { children: [], }); - const tree = new Formatter().format(doc.Document.Body); + const tree = new Formatter().format(doc.Document.View.Body); expect(tree["w:body"][0]["w:sectPr"][4]["w:headerReference"]._attr["w:type"]).to.equal("default"); expect(tree["w:body"][0]["w:sectPr"][5]["w:headerReference"]._attr["w:type"]).to.equal("first"); @@ -97,7 +97,7 @@ describe("File", () => { }, ]); - const tree = new Formatter().format(doc.Document.Body); + const tree = new Formatter().format(doc.Document.View.Body); expect(tree).to.deep.equal({ "w:body": [ @@ -169,7 +169,7 @@ describe("File", () => { describe("#addSection", () => { it("should call the underlying document's add a Paragraph", () => { const file = new File(); - const spy = sinon.spy(file.Document, "add"); + const spy = sinon.spy(file.Document.View, "add"); file.addSection({ children: [new Paragraph({})], }); @@ -179,7 +179,7 @@ describe("File", () => { it("should call the underlying document's add when adding a Table", () => { const file = new File(); - const spy = sinon.spy(file.Document, "add"); + const spy = sinon.spy(file.Document.View, "add"); file.addSection({ children: [ new Table({ @@ -201,7 +201,7 @@ describe("File", () => { it("should call the underlying document's add when adding an Image (paragraph)", () => { const file = new File(); - const spy = sinon.spy(file.Document, "add"); + const spy = sinon.spy(file.Document.View, "add"); // tslint:disable-next-line:no-any file.addSection({ children: [new Paragraph("")], @@ -214,7 +214,7 @@ describe("File", () => { describe("#addSection", () => { it("should call the underlying document's add", () => { const file = new File(); - const spy = sinon.spy(file.Document, "add"); + const spy = sinon.spy(file.Document.View, "add"); file.addSection({ children: [new TableOfContents()], }); diff --git a/src/file/file.ts b/src/file/file.ts index 20d292f91b..9ec8316e9f 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -1,7 +1,7 @@ import { AppProperties } from "./app-properties/app-properties"; import { ContentTypes } from "./content-types/content-types"; import { CoreProperties, IPropertiesOptions } from "./core-properties"; -import { Document } from "./document"; +import { DocumentWrapper } from "./document-wrapper"; import { FooterReferenceType, HeaderReferenceType, @@ -46,10 +46,9 @@ export class File { // tslint:disable-next-line:readonly-keyword private currentRelationshipId: number = 1; - private readonly document: Document; + private readonly documentWrapper: DocumentWrapper; private readonly headers: IDocumentHeader[] = []; private readonly footers: IDocumentFooter[] = []; - private readonly docRelationships: Relationships; private readonly coreProperties: CoreProperties; private readonly numbering: Numbering; private readonly media: Media; @@ -77,12 +76,12 @@ export class File { config: [], }, ); - this.docRelationships = new Relationships(); + // this.documentWrapper.Relationships = new Relationships(); this.fileRelationships = new Relationships(); this.appProperties = new AppProperties(); this.footNotes = new FootNotes(); this.contentTypes = new ContentTypes(); - this.document = new Document({ background: options.background || {} }); + this.documentWrapper = new DocumentWrapper({ background: options.background || {} }); this.settings = new Settings({ compatabilityModeVersion: options.compatabilityModeVersion, }); @@ -130,10 +129,10 @@ export class File { } for (const section of sections) { - this.document.Body.addSection(section.properties ? section.properties : {}); + this.documentWrapper.View.Body.addSection(section.properties ? section.properties : {}); for (const child of section.children) { - this.document.add(child); + this.documentWrapper.View.add(child); } } @@ -158,7 +157,7 @@ export class File { properties, children, }: ISectionOptions): void { - this.document.Body.addSection({ + this.documentWrapper.View.Body.addSection({ ...properties, headers: { default: headers.default ? this.createHeader(headers.default) : this.createHeader(new Header()), @@ -175,12 +174,12 @@ export class File { }); for (const child of children) { - this.document.add(child); + this.documentWrapper.View.add(child); } } public verifyUpdateFields(): void { - if (this.document.getTablesOfContents().length) { + if (this.documentWrapper.View.getTablesOfContents().length) { this.settings.addUpdateFields(); } } @@ -209,8 +208,8 @@ export class File { private addHeaderToDocument(header: HeaderWrapper, type: HeaderReferenceType = HeaderReferenceType.DEFAULT): void { this.headers.push({ header, type }); - this.docRelationships.createRelationship( - header.Header.ReferenceId, + this.documentWrapper.Relationships.createRelationship( + header.View.ReferenceId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", `header${this.headers.length}.xml`, ); @@ -219,8 +218,8 @@ export class File { private addFooterToDocument(footer: FooterWrapper, type: FooterReferenceType = FooterReferenceType.DEFAULT): void { this.footers.push({ footer, type }); - this.docRelationships.createRelationship( - footer.Footer.ReferenceId, + this.documentWrapper.Relationships.createRelationship( + footer.View.ReferenceId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", `footer${this.footers.length}.xml`, ); @@ -244,30 +243,30 @@ export class File { "docProps/app.xml", ); - this.docRelationships.createRelationship( + this.documentWrapper.Relationships.createRelationship( this.currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml", ); - this.docRelationships.createRelationship( + this.documentWrapper.Relationships.createRelationship( this.currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", "numbering.xml", ); - this.docRelationships.createRelationship( + this.documentWrapper.Relationships.createRelationship( this.currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", "footnotes.xml", ); - this.docRelationships.createRelationship( + this.documentWrapper.Relationships.createRelationship( this.currentRelationshipId++, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", "settings.xml", ); } - public get Document(): Document { - return this.document; + public get Document(): DocumentWrapper { + return this.documentWrapper; } public get Styles(): Styles { @@ -286,10 +285,6 @@ export class File { return this.media; } - public get DocumentRelationships(): Relationships { - return this.docRelationships; - } - public get FileRelationships(): Relationships { return this.fileRelationships; } diff --git a/src/file/footer-wrapper.spec.ts b/src/file/footer-wrapper.spec.ts index 4f3e95acdb..2a32ad7968 100644 --- a/src/file/footer-wrapper.spec.ts +++ b/src/file/footer-wrapper.spec.ts @@ -10,7 +10,7 @@ describe("FooterWrapper", () => { describe("#add", () => { it("should call the underlying footer's addParagraph", () => { const file = new FooterWrapper(new Media(), 1); - const spy = sinon.spy(file.Footer, "add"); + const spy = sinon.spy(file.View, "add"); file.add(new Paragraph({})); expect(spy.called).to.equal(true); @@ -18,7 +18,7 @@ describe("FooterWrapper", () => { it("should call the underlying footer's addParagraph", () => { const file = new FooterWrapper(new Media(), 1); - const spy = sinon.spy(file.Footer, "add"); + const spy = sinon.spy(file.View, "add"); file.add( new Table({ rows: [ @@ -40,7 +40,7 @@ describe("FooterWrapper", () => { describe("#addChildElement", () => { it("should call the underlying footer's addChildElement", () => { const file = new FooterWrapper(new Media(), 1); - const spy = sinon.spy(file.Footer, "addChildElement"); + const spy = sinon.spy(file.View, "addChildElement"); // tslint:disable-next-line:no-any file.addChildElement({} as any); diff --git a/src/file/footer-wrapper.ts b/src/file/footer-wrapper.ts index 8390887ba4..e16a72e974 100644 --- a/src/file/footer-wrapper.ts +++ b/src/file/footer-wrapper.ts @@ -1,6 +1,7 @@ import { XmlComponent } from "file/xml-components"; import { FooterReferenceType } from "./document"; +import { IViewWrapper } from "./document-wrapper"; import { Footer } from "./footer/footer"; import { Media } from "./media"; import { Paragraph } from "./paragraph"; @@ -12,7 +13,7 @@ export interface IDocumentFooter { readonly type: FooterReferenceType; } -export class FooterWrapper { +export class FooterWrapper implements IViewWrapper { private readonly footer: Footer; private readonly relationships: Relationships; @@ -29,7 +30,7 @@ export class FooterWrapper { this.footer.addChildElement(childElement); } - public get Footer(): Footer { + public get View(): Footer { return this.footer; } diff --git a/src/file/header-wrapper.spec.ts b/src/file/header-wrapper.spec.ts index 00ee776a95..c6a7272d16 100644 --- a/src/file/header-wrapper.spec.ts +++ b/src/file/header-wrapper.spec.ts @@ -10,7 +10,7 @@ describe("HeaderWrapper", () => { describe("#add", () => { it("should call the underlying header's addChildElement for Paragraph", () => { const wrapper = new HeaderWrapper(new Media(), 1); - const spy = sinon.spy(wrapper.Header, "add"); + const spy = sinon.spy(wrapper.View, "add"); wrapper.add(new Paragraph({})); expect(spy.called).to.equal(true); @@ -18,7 +18,7 @@ describe("HeaderWrapper", () => { it("should call the underlying header's addChildElement for Table", () => { const wrapper = new HeaderWrapper(new Media(), 1); - const spy = sinon.spy(wrapper.Header, "add"); + const spy = sinon.spy(wrapper.View, "add"); wrapper.add( new Table({ rows: [ @@ -40,7 +40,7 @@ describe("HeaderWrapper", () => { describe("#addChildElement", () => { it("should call the underlying header's addChildElement", () => { const file = new HeaderWrapper(new Media(), 1); - const spy = sinon.spy(file.Header, "addChildElement"); + const spy = sinon.spy(file.View, "addChildElement"); // tslint:disable-next-line:no-any file.addChildElement({} as any); diff --git a/src/file/header-wrapper.ts b/src/file/header-wrapper.ts index 407399a8fe..945a9d674a 100644 --- a/src/file/header-wrapper.ts +++ b/src/file/header-wrapper.ts @@ -1,6 +1,7 @@ import { XmlComponent } from "file/xml-components"; import { HeaderReferenceType } from "./document"; +import { IViewWrapper } from "./document-wrapper"; import { Header } from "./header/header"; import { Media } from "./media"; import { Paragraph } from "./paragraph"; @@ -12,7 +13,7 @@ export interface IDocumentHeader { readonly type: HeaderReferenceType; } -export class HeaderWrapper { +export class HeaderWrapper implements IViewWrapper { private readonly header: Header; private readonly relationships: Relationships; @@ -31,7 +32,7 @@ export class HeaderWrapper { this.header.addChildElement(childElement); } - public get Header(): Header { + public get View(): Header { return this.header; } diff --git a/src/file/media/media.ts b/src/file/media/media.ts index 6168fbc362..65a7f1bf58 100644 --- a/src/file/media/media.ts +++ b/src/file/media/media.ts @@ -1,14 +1,12 @@ import { IDrawingOptions } from "../drawing"; import { File } from "../file"; -import { FooterWrapper } from "../footer-wrapper"; -import { HeaderWrapper } from "../header-wrapper"; import { PictureRun } from "../paragraph"; import { IMediaData } from "./data"; // import { Image } from "./image"; export class Media { public static addImage( - file: File | HeaderWrapper | FooterWrapper, + file: File, buffer: Buffer | string | Uint8Array | ArrayBuffer, width?: number, height?: number, diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 57590f6313..211697b850 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -804,8 +804,10 @@ describe("Paragraph", () => { ], }); const fileMock = ({ - DocumentRelationships: { - createRelationship: () => ({}), + Document: { + Relationships: { + createRelationship: () => ({}), + }, }, } as unknown) as File; paragraph.prepForXml(fileMock); diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index dcaf2c480d..2e75c77f4e 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -79,7 +79,7 @@ export class Paragraph extends XmlComponent { if (element instanceof ExternalHyperlink) { const index = this.root.indexOf(element); const concreteHyperlink = new ConcreteHyperlink(element.options.child, shortid.generate().toLowerCase()); - file.DocumentRelationships.createRelationship( + file.Document.Relationships.createRelationship( concreteHyperlink.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", element.options.link, From c6e9696be0a64bd879772ee91134deea63f4f889 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Mon, 1 Mar 2021 03:28:35 +0000 Subject: [PATCH 105/107] #532 Make hyperlinks work on the Header and Footer --- demo/35-hyperlinks.ts | 20 ++++++++++++++- src/export/formatter.ts | 4 +-- src/export/packer/next-compiler.ts | 32 ++++++++++++------------ src/file/document/body/body.ts | 5 ++-- src/file/paragraph/paragraph.spec.ts | 10 +++----- src/file/paragraph/paragraph.ts | 6 ++--- src/file/table/table-cell/table-cell.ts | 4 +-- src/file/xml-components/base.ts | 4 +-- src/file/xml-components/xml-component.ts | 4 +-- 9 files changed, 53 insertions(+), 36 deletions(-) diff --git a/demo/35-hyperlinks.ts b/demo/35-hyperlinks.ts index 85fa5fc1f3..c9ef863aa4 100644 --- a/demo/35-hyperlinks.ts +++ b/demo/35-hyperlinks.ts @@ -1,7 +1,7 @@ // Example on how to add hyperlinks to websites // Import from 'docx' rather than '../build' if you install from npm import * as fs from "fs"; -import { ExternalHyperlink, Document, Packer, Paragraph, Media, TextRun, Footer } from "../build"; +import { Document, ExternalHyperlink, Footer, Media, Packer, Paragraph, TextRun } from "../build"; const doc = new Document({}); @@ -26,6 +26,24 @@ doc.addSection({ ], }), }, + headers: { + default: new Footer({ + children: [ + new Paragraph({ + children: [ + new TextRun("Click here for the "), + new ExternalHyperlink({ + child: new TextRun({ + text: "Header external hyperlink", + style: "Hyperlink", + }), + link: "http://www.google.com", + }), + ], + }), + ], + }), + }, children: [ new Paragraph({ children: [ diff --git a/src/export/formatter.ts b/src/export/formatter.ts index b863ea4b97..a91702212e 100644 --- a/src/export/formatter.ts +++ b/src/export/formatter.ts @@ -1,8 +1,8 @@ +import { IViewWrapper } from "file/document-wrapper"; import { BaseXmlComponent, IXmlableObject } from "file/xml-components"; -import { File } from "../file"; export class Formatter { - public format(input: BaseXmlComponent, file?: File): IXmlableObject { + public format(input: BaseXmlComponent, file?: IViewWrapper): IXmlableObject { const output = input.prepForXml(file); if (output) { diff --git a/src/export/packer/next-compiler.ts b/src/export/packer/next-compiler.ts index a0c73090fc..aed3951ab5 100644 --- a/src/export/packer/next-compiler.ts +++ b/src/export/packer/next-compiler.ts @@ -71,7 +71,7 @@ export class Compiler { file.verifyUpdateFields(); const documentRelationshipCount = file.Document.Relationships.RelationshipCount + 1; - const documentXmlData = xml(this.formatter.format(file.Document.View, file), prettify); + const documentXmlData = xml(this.formatter.format(file.Document.View, file.Document), prettify); const documentMediaDatas = this.imageReplacer.getMediaData(documentXmlData, file.Media); return { @@ -85,7 +85,7 @@ export class Compiler { ); }); - return xml(this.formatter.format(file.Document.Relationships, file), prettify); + return xml(this.formatter.format(file.Document.Relationships, file.Document), prettify); })(), path: "word/_rels/document.xml.rels", }, @@ -99,11 +99,11 @@ export class Compiler { path: "word/document.xml", }, Styles: { - data: xml(this.formatter.format(file.Styles, file), prettify), + data: xml(this.formatter.format(file.Styles, file.Document), prettify), path: "word/styles.xml", }, Properties: { - data: xml(this.formatter.format(file.CoreProperties, file), { + data: xml(this.formatter.format(file.CoreProperties, file.Document), { declaration: { standalone: "yes", encoding: "UTF-8", @@ -112,15 +112,15 @@ export class Compiler { path: "docProps/core.xml", }, Numbering: { - data: xml(this.formatter.format(file.Numbering, file), prettify), + data: xml(this.formatter.format(file.Numbering, file.Document), prettify), path: "word/numbering.xml", }, FileRelationships: { - data: xml(this.formatter.format(file.FileRelationships, file), prettify), + data: xml(this.formatter.format(file.FileRelationships, file.Document), prettify), path: "_rels/.rels", }, HeaderRelationships: file.Headers.map((headerWrapper, index) => { - const xmlData = xml(this.formatter.format(headerWrapper.View, file), prettify); + const xmlData = xml(this.formatter.format(headerWrapper.View, headerWrapper), prettify); const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); mediaDatas.forEach((mediaData, i) => { @@ -132,12 +132,12 @@ export class Compiler { }); return { - data: xml(this.formatter.format(headerWrapper.Relationships, file), prettify), + data: xml(this.formatter.format(headerWrapper.Relationships, headerWrapper), prettify), path: `word/_rels/header${index + 1}.xml.rels`, }; }), FooterRelationships: file.Footers.map((footerWrapper, index) => { - const xmlData = xml(this.formatter.format(footerWrapper.View, file), prettify); + const xmlData = xml(this.formatter.format(footerWrapper.View, footerWrapper), prettify); const mediaDatas = this.imageReplacer.getMediaData(xmlData, file.Media); mediaDatas.forEach((mediaData, i) => { @@ -149,12 +149,12 @@ export class Compiler { }); return { - data: xml(this.formatter.format(footerWrapper.Relationships, file), prettify), + data: xml(this.formatter.format(footerWrapper.Relationships, footerWrapper), prettify), path: `word/_rels/footer${index + 1}.xml.rels`, }; }), Headers: file.Headers.map((headerWrapper, index) => { - const tempXmlData = xml(this.formatter.format(headerWrapper.View, file), prettify); + const tempXmlData = xml(this.formatter.format(headerWrapper.View, headerWrapper), prettify); const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); // TODO: 0 needs to be changed when headers get relationships of their own const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); @@ -165,7 +165,7 @@ export class Compiler { }; }), Footers: file.Footers.map((footerWrapper, index) => { - const tempXmlData = xml(this.formatter.format(footerWrapper.View, file), prettify); + const tempXmlData = xml(this.formatter.format(footerWrapper.View, footerWrapper), prettify); const mediaDatas = this.imageReplacer.getMediaData(tempXmlData, file.Media); // TODO: 0 needs to be changed when headers get relationships of their own const xmlData = this.imageReplacer.replace(tempXmlData, mediaDatas, 0); @@ -176,19 +176,19 @@ export class Compiler { }; }), ContentTypes: { - data: xml(this.formatter.format(file.ContentTypes, file), prettify), + data: xml(this.formatter.format(file.ContentTypes, file.Document), prettify), path: "[Content_Types].xml", }, AppProperties: { - data: xml(this.formatter.format(file.AppProperties, file), prettify), + data: xml(this.formatter.format(file.AppProperties, file.Document), prettify), path: "docProps/app.xml", }, FootNotes: { - data: xml(this.formatter.format(file.FootNotes, file), prettify), + data: xml(this.formatter.format(file.FootNotes, file.Document), prettify), path: "word/footnotes.xml", }, Settings: { - data: xml(this.formatter.format(file.Settings, file), prettify), + data: xml(this.formatter.format(file.Settings, file.Document), prettify), path: "word/settings.xml", }, }; diff --git a/src/file/document/body/body.ts b/src/file/document/body/body.ts index ea0d24a448..4b0e588809 100644 --- a/src/file/document/body/body.ts +++ b/src/file/document/body/body.ts @@ -1,6 +1,7 @@ +import { IViewWrapper } from "file/document-wrapper"; import { IXmlableObject, XmlComponent } from "file/xml-components"; + import { Paragraph, ParagraphProperties, TableOfContents } from "../.."; -import { File } from "../../../file"; import { SectionProperties, SectionPropertiesOptions } from "./section-properties/section-properties"; export class Body extends XmlComponent { @@ -25,7 +26,7 @@ export class Body extends XmlComponent { this.sections.push(new SectionProperties(options)); } - public prepForXml(file?: File): IXmlableObject | undefined { + public prepForXml(file?: IViewWrapper): IXmlableObject | undefined { if (this.sections.length === 1) { this.root.splice(0, 1); this.root.push(this.sections.pop() as SectionProperties); diff --git a/src/file/paragraph/paragraph.spec.ts b/src/file/paragraph/paragraph.spec.ts index 211697b850..4302801a01 100644 --- a/src/file/paragraph/paragraph.spec.ts +++ b/src/file/paragraph/paragraph.spec.ts @@ -5,7 +5,7 @@ import { stub } from "sinon"; import { Formatter } from "export/formatter"; import { EMPTY_OBJECT } from "file/xml-components"; -import { File } from "../file"; +import { IViewWrapper } from "../document-wrapper"; import { ShadingType } from "../table/shading"; import { AlignmentType, HeadingLevel, LeaderType, PageBreak, TabStopPosition, TabStopType } from "./formatting"; import { Bookmark, ExternalHyperlink } from "./links"; @@ -804,12 +804,10 @@ describe("Paragraph", () => { ], }); const fileMock = ({ - Document: { - Relationships: { - createRelationship: () => ({}), - }, + Relationships: { + createRelationship: () => ({}), }, - } as unknown) as File; + } as unknown) as IViewWrapper; paragraph.prepForXml(fileMock); const tree = new Formatter().format(paragraph); expect(tree).to.deep.equal({ diff --git a/src/file/paragraph/paragraph.ts b/src/file/paragraph/paragraph.ts index 2e75c77f4e..7c05ee711c 100644 --- a/src/file/paragraph/paragraph.ts +++ b/src/file/paragraph/paragraph.ts @@ -4,7 +4,7 @@ import * as shortid from "shortid"; import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run"; import { IXmlableObject, XmlComponent } from "file/xml-components"; -import { File } from "../file"; +import { IViewWrapper } from "../document-wrapper"; import { TargetModeType } from "../relationships/relationship/relationship"; import { DeletedTextRun, InsertedTextRun } from "../track-revision"; import { PageBreak } from "./formatting/page-break"; @@ -74,12 +74,12 @@ export class Paragraph extends XmlComponent { } } - public prepForXml(file: File): IXmlableObject | undefined { + public prepForXml(file: IViewWrapper): IXmlableObject | undefined { for (const element of this.root) { if (element instanceof ExternalHyperlink) { const index = this.root.indexOf(element); const concreteHyperlink = new ConcreteHyperlink(element.options.child, shortid.generate().toLowerCase()); - file.Document.Relationships.createRelationship( + file.Relationships.createRelationship( concreteHyperlink.linkId, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", element.options.link, diff --git a/src/file/table/table-cell/table-cell.ts b/src/file/table/table-cell/table-cell.ts index 6fbd748cf5..e598888f83 100644 --- a/src/file/table/table-cell/table-cell.ts +++ b/src/file/table/table-cell/table-cell.ts @@ -1,9 +1,9 @@ // http://officeopenxml.com/WPtableGrid.php +import { IViewWrapper } from "file/document-wrapper"; import { Paragraph } from "file/paragraph"; import { BorderStyle } from "file/styles"; import { IXmlableObject, XmlComponent } from "file/xml-components"; -import { File } from "../../file"; import { ITableShadingAttributesProperties } from "../shading"; import { Table } from "../table"; import { ITableCellMarginOptions } from "./cell-margin/table-cell-margins"; @@ -115,7 +115,7 @@ export class TableCell extends XmlComponent { } } - public prepForXml(file?: File): IXmlableObject | undefined { + public prepForXml(file?: IViewWrapper): IXmlableObject | undefined { // Cells must end with a paragraph if (!(this.root[this.root.length - 1] instanceof Paragraph)) { this.root.push(new Paragraph({})); diff --git a/src/file/xml-components/base.ts b/src/file/xml-components/base.ts index 782dfdba12..4bb37c8ad9 100644 --- a/src/file/xml-components/base.ts +++ b/src/file/xml-components/base.ts @@ -1,4 +1,4 @@ -import { File } from "../file"; +import { IViewWrapper } from "../document-wrapper"; import { IXmlableObject } from "./xmlable-object"; export abstract class BaseXmlComponent { @@ -10,7 +10,7 @@ export abstract class BaseXmlComponent { this.rootKey = rootKey; } - public abstract prepForXml(file?: File): IXmlableObject | undefined; + public abstract prepForXml(file?: IViewWrapper): IXmlableObject | undefined; public get IsDeleted(): boolean { return this.deleted; diff --git a/src/file/xml-components/xml-component.ts b/src/file/xml-components/xml-component.ts index b06f73b930..84fd5f98e4 100644 --- a/src/file/xml-components/xml-component.ts +++ b/src/file/xml-components/xml-component.ts @@ -1,4 +1,4 @@ -import { File } from "../file"; +import { IViewWrapper } from "../document-wrapper"; import { BaseXmlComponent } from "./base"; import { IXmlableObject } from "./xmlable-object"; @@ -13,7 +13,7 @@ export abstract class XmlComponent extends BaseXmlComponent { this.root = new Array(); } - public prepForXml(file?: File): IXmlableObject | undefined { + public prepForXml(file?: IViewWrapper): IXmlableObject | undefined { const children = this.root .filter((c) => { if (c instanceof BaseXmlComponent) { From 8435ece00dffc219f99e1df738a58746e72ffdd1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 11:54:10 +0000 Subject: [PATCH 106/107] build(deps-dev): bump typedoc from 0.16.11 to 0.19.0 Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.16.11 to 0.19.0. - [Release notes](https://github.com/TypeStrong/TypeDoc/releases) - [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.16.11...v0.19.0) Signed-off-by: dependabot-preview[bot] --- package-lock.json | 168 +++++++++++++++++++--------------------------- package.json | 2 +- 2 files changed, 70 insertions(+), 100 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6d7d1eef60..d5c518d57a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -559,12 +559,6 @@ "jszip": "*" } }, - "@types/minimatch": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", - "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", - "dev": true - }, "@types/mocha": { "version": "8.2.1", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-8.2.1.tgz", @@ -1076,6 +1070,12 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", + "dev": true + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -1246,15 +1246,6 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, - "backbone": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/backbone/-/backbone-1.4.0.tgz", - "integrity": "sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ==", - "dev": true, - "requires": { - "underscore": ">=1.8.3" - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -4066,9 +4057,9 @@ "dev": true }, "handlebars": { - "version": "4.7.6", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz", - "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==", + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", "dev": true, "requires": { "minimist": "^1.2.5", @@ -4083,12 +4074,6 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true - }, - "wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true } } }, @@ -4238,9 +4223,9 @@ "dev": true }, "highlight.js": { - "version": "9.18.5", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.5.tgz", - "integrity": "sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA==", + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.6.0.tgz", + "integrity": "sha512-8mlRcn5vk/r4+QcqerapwBYTe+iPL5ih6xrNylxrnBdHQiijDETfXX7VIxC3UiCRiINBJfANBAsPzAvRQj8RpQ==", "dev": true }, "hmac-drbg": { @@ -4854,12 +4839,6 @@ "istanbul-lib-report": "^3.0.0" } }, - "jquery": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", - "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg==", - "dev": true - }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -4884,7 +4863,7 @@ }, "jsesc": { "version": "1.3.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, @@ -5241,9 +5220,9 @@ } }, "lunr": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz", - "integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==", + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, "make-dir": { @@ -8093,60 +8072,64 @@ } }, "typedoc": { - "version": "0.16.11", - "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.16.11.tgz", - "integrity": "sha512-YEa5i0/n0yYmLJISJ5+po6seYfJQJ5lQYcHCPF9ffTF92DB/TAZO/QrazX5skPHNPtmlIht5FdTXCM2kC7jQFQ==", + "version": "0.19.0", + "resolved": "http://registry.npmjs.org/typedoc/-/typedoc-0.19.0.tgz", + "integrity": "sha512-Rn68JwgDDYyIWl3HXeSsLZcsvxd2anISjhKu64PvID7RETeS2Iwnc4cH60yqc8/N50Xo1d3MHPGYinCPhMMliQ==", "dev": true, "requires": { - "@types/minimatch": "3.0.3", - "fs-extra": "^8.1.0", - "handlebars": "^4.7.2", - "highlight.js": "^9.17.1", - "lodash": "^4.17.15", - "marked": "^0.8.0", + "fs-extra": "^9.0.1", + "handlebars": "^4.7.6", + "highlight.js": "^10.0.0", + "lodash": "^4.17.20", + "lunr": "^2.3.9", + "marked": "^1.1.1", "minimatch": "^3.0.0", "progress": "^2.0.3", - "shelljs": "^0.8.3", - "typedoc-default-themes": "^0.7.2", - "typescript": "3.7.x" + "shelljs": "^0.8.4", + "typedoc-default-themes": "^0.11.1" }, "dependencies": { - "marked": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.2.tgz", - "integrity": "sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw==", - "dev": true - }, - "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", "dev": true, "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" } }, - "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true } } }, "typedoc-default-themes": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.7.2.tgz", - "integrity": "sha512-fiFKlFO6VTqjcno8w6WpTsbCgXmfPHVjnLfYkmByZE7moaz+E2DSpAT+oHtDHv7E0BM5kAhPrHJELP2J2Y2T9A==", - "dev": true, - "requires": { - "backbone": "^1.4.0", - "jquery": "^3.4.1", - "lunr": "^2.3.8", - "underscore": "^1.9.1" - } + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.11.4.tgz", + "integrity": "sha512-Y4Lf+qIb9NTydrexlazAM46SSLrmrQRqWiD52593g53SsmUFioAsMWt8m834J6qsp+7wHRjxCXSZeiiW5cMUdw==", + "dev": true }, "typescript": { "version": "4.2.2", @@ -8155,24 +8138,11 @@ "dev": true }, "uglify-js": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", - "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", + "version": "3.12.8", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.12.8.tgz", + "integrity": "sha512-fvBeuXOsvqjecUtF/l1dwsrrf5y2BCUk9AOJGzGcm6tE7vegku5u/YvqjyDaAGr422PLoLnrxg3EnRvTqsdC1w==", "dev": true, - "optional": true, - "requires": { - "commander": "~2.20.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", - "dev": true, - "optional": true - } - } + "optional": true }, "uglify-to-browserify": { "version": "1.0.2", @@ -8252,12 +8222,6 @@ } } }, - "underscore": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz", - "integrity": "sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==", - "dev": true - }, "union-value": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", @@ -8995,6 +8959,12 @@ } } }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "wrap-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", diff --git a/package.json b/package.json index 1671bfdfb3..9db7e34f55 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "ts-node": "^9.0.0", "tslint": "^6.1.3", "tslint-immutable": "^6.0.1", - "typedoc": "^0.16.11", + "typedoc": "^0.19.0", "typescript": "4.2.2", "webpack": "^3.10.0" }, From dd503996a0a9ac67f57eb57043465ea9cd5469da Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Mar 2021 19:48:23 +0000 Subject: [PATCH 107/107] build(deps): bump docsify from 4.11.6 to 4.12.0 Bumps [docsify](https://github.com/docsifyjs/docsify) from 4.11.6 to 4.12.0. - [Release notes](https://github.com/docsifyjs/docsify/releases) - [Changelog](https://github.com/docsifyjs/docsify/blob/develop/CHANGELOG.md) - [Commits](https://github.com/docsifyjs/docsify/compare/v4.11.6...v4.12.0) Signed-off-by: dependabot[bot] --- package-lock.json | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index d5c518d57a..bad5fe5e17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2343,19 +2343,42 @@ } }, "docsify": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/docsify/-/docsify-4.11.6.tgz", - "integrity": "sha512-6h3hB2Ni7gpOeu1fl1sDOmufuplIDmeFHsps17Qbg9VOS3h2tJ63FiW2w5oAydGyzaLrqu58FV7Mg4b6p0z9mg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/docsify/-/docsify-4.12.0.tgz", + "integrity": "sha512-oLr48dLeJ8sTVQfL8HLFqd2sPPG8DNAOvYAXXJQr/+/K9uC2KDhoeu+GGj5U2uFGR5czF3oLvqNBxhEElg1wGw==", "dev": true, "requires": { - "dompurify": "^2.0.8", - "marked": "^1.1.1", + "dompurify": "^2.2.6", + "marked": "^1.2.9", "medium-zoom": "^1.0.6", "opencollective-postinstall": "^2.0.2", - "prismjs": "^1.19.0", + "prismjs": "^1.23.0", "strip-indent": "^3.0.0", "tinydate": "^1.3.0", "tweezer.js": "^1.4.0" + }, + "dependencies": { + "dompurify": { + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.2.6.tgz", + "integrity": "sha512-7b7ZArhhH0SP6W2R9cqK6RjaU82FZ2UPM7RO8qN1b1wyvC/NY1FNWcX1Pu00fFOAnzEORtwXe4bPaClg6pUybQ==", + "dev": true + }, + "marked": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/marked/-/marked-1.2.9.tgz", + "integrity": "sha512-H8lIX2SvyitGX+TRdtS06m1jHMijKN/XjfH6Ooii9fvxMlh8QdqBfBDkGUpMWH2kQNrtixjzYUa3SH8ROTgRRw==", + "dev": true + }, + "prismjs": { + "version": "1.23.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.23.0.tgz", + "integrity": "sha512-c29LVsqOaLbBHuIbsTxaKENh1N2EQBOHaWv7gkHN4dgRbxSREqDnDbtFJYdpPauS4YCplMSNCABQ6Eeor69bAA==", + "dev": true, + "requires": { + "clipboard": "^2.0.0" + } + } } }, "docsify-cli": { @@ -6505,15 +6528,6 @@ "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "dev": true }, - "prismjs": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.22.0.tgz", - "integrity": "sha512-lLJ/Wt9yy0AiSYBf212kK3mM5L8ycwlyTlSxHBAneXLR0nzFMlZ5y7riFPF3E33zXOF2IH95xdY5jIyZbM9z/w==", - "dev": true, - "requires": { - "clipboard": "^2.0.0" - } - }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",