From f075d3b71957da0da813bed7bd73e770ced3e5a0 Mon Sep 17 00:00:00 2001 From: Dolan Miu Date: Tue, 24 May 2016 21:37:58 +0100 Subject: [PATCH] made numberings compile properly --- ts/export/packer/packer.ts | 4 ++-- ts/numbering/abstract-numbering.ts | 7 +++++++ ts/numbering/index.ts | 4 +++- ts/tests/runTest.ts | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ts/export/packer/packer.ts b/ts/export/packer/packer.ts index 62e0bed3fc..8b24d2c199 100644 --- a/ts/export/packer/packer.ts +++ b/ts/export/packer/packer.ts @@ -53,8 +53,8 @@ export abstract class Packer { var xmlStyles = xml(this.formatter.format(this.style)); var xmlProperties = xml(this.formatter.format(this.properties), { declaration: { standalone: 'yes', encoding: 'UTF-8' } }); var xmlNumbering = xml(this.formatter.format(this.numbering)); - console.log(xmlNumbering); - + //console.log(JSON.stringify(this.numbering, null, " ")); + console.log(xmlNumbering); this.archive.append(xmlDocument, { name: 'word/document.xml' }); diff --git a/ts/numbering/abstract-numbering.ts b/ts/numbering/abstract-numbering.ts index c0df59e0af..f5efd1811f 100644 --- a/ts/numbering/abstract-numbering.ts +++ b/ts/numbering/abstract-numbering.ts @@ -2,6 +2,7 @@ import {XmlComponent} from "../docx/xml-components"; import {XmlAttributeComponent} from "../docx/xml-components"; import {Level} from "./level"; import {MultiLevelType} from "./multi-level-type"; +import * as _ from "lodash"; interface AbstractNumberingAttributesProperties { abstractNumId?: Number, @@ -32,4 +33,10 @@ export class AbstractNumbering extends XmlComponent { addLevel(level: Level): void { this.root.push(level); } + + clearVariables() { + _.forEach(this.root, element => { + element.clearVariables(); + }); + } } \ No newline at end of file diff --git a/ts/numbering/index.ts b/ts/numbering/index.ts index c5174f8f1f..b624a4e452 100644 --- a/ts/numbering/index.ts +++ b/ts/numbering/index.ts @@ -83,8 +83,10 @@ export class Numbering extends MultiPropertyXmlComponent { } clearVariables() { + super.clearVariables(); _.forEach(this.root, element => { - element.clearVariables(); + console.log(element); + element.clearVariables(); }); } } \ No newline at end of file diff --git a/ts/tests/runTest.ts b/ts/tests/runTest.ts index 70322672f1..5b0c819e43 100644 --- a/ts/tests/runTest.ts +++ b/ts/tests/runTest.ts @@ -24,9 +24,9 @@ describe("Run", () => { }); }); - describe('#italics()', () => { + describe('#italic()', () => { it("it should add italics to the properties", () => { - run.italics(); + run.italic(); var newJson = jsonify(run); assert.equal(newJson.root[0].root[0].rootKey, "w:i"); });