Added tests, renamed pagenumber to page-number

This commit is contained in:
Tyler Bell
2018-05-17 13:32:33 -06:00
parent 0fedfcf709
commit 8d35dc1bb0
4 changed files with 19 additions and 2 deletions

View File

@ -0,0 +1,38 @@
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
class fidCharAttrs extends XmlAttributeComponent<{ type: "begin" | "end" | "separate" }> {
protected xmlKeys = { type: "w:fldCharType" };
}
class TextAttributes extends XmlAttributeComponent<{ space: "default" | "preserve" }> {
protected xmlKeys = { space: "xml:space" };
}
export class Begin extends XmlComponent {
constructor() {
super("w:fldChar");
this.root.push(new fidCharAttrs({ type: "begin" }));
}
}
export class Page extends XmlComponent {
constructor() {
super("w:instrText");
this.root.push(new TextAttributes({ space: "preserve" }));
this.root.push("PAGE");
}
}
export class Separate extends XmlComponent {
constructor() {
super("w:fldChar");
this.root.push(new fidCharAttrs({ type: "separate" }));
}
}
export class End extends XmlComponent {
constructor() {
super("w:fldChar");
this.root.push(new fidCharAttrs({ type: "end" }));
}
}