Introduce some functional programming techniques
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IFootnoteAttributesProperties {
|
||||
type?: string;
|
||||
id: number;
|
||||
readonly type?: string;
|
||||
readonly id: number;
|
||||
}
|
||||
|
||||
export class FootnoteAttributes extends XmlAttributeComponent<IFootnoteAttributesProperties> {
|
||||
protected xmlKeys = {
|
||||
protected readonly xmlKeys = {
|
||||
type: "w:type",
|
||||
id: "w:id",
|
||||
};
|
||||
|
@ -3,11 +3,11 @@ import { Style } from "file/paragraph/run/style";
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
|
||||
export interface IFootNoteReferenceRunAttributesProperties {
|
||||
id: number;
|
||||
readonly id: number;
|
||||
}
|
||||
|
||||
export class FootNoteReferenceRunAttributes extends XmlAttributeComponent<IFootNoteReferenceRunAttributesProperties> {
|
||||
protected xmlKeys = {
|
||||
protected readonly xmlKeys = {
|
||||
id: "w:id",
|
||||
};
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
import { XmlAttributeComponent } from "file/xml-components";
|
||||
|
||||
export interface IFootnotesAttributesProperties {
|
||||
wpc?: string;
|
||||
mc?: string;
|
||||
o?: string;
|
||||
r?: string;
|
||||
m?: string;
|
||||
v?: string;
|
||||
wp14?: string;
|
||||
wp?: string;
|
||||
w10?: string;
|
||||
w?: string;
|
||||
w14?: string;
|
||||
w15?: string;
|
||||
wpg?: string;
|
||||
wpi?: string;
|
||||
wne?: string;
|
||||
wps?: string;
|
||||
Ignorable?: string;
|
||||
readonly wpc?: string;
|
||||
readonly mc?: string;
|
||||
readonly o?: string;
|
||||
readonly r?: string;
|
||||
readonly m?: string;
|
||||
readonly v?: string;
|
||||
readonly wp14?: string;
|
||||
readonly wp?: string;
|
||||
readonly w10?: string;
|
||||
readonly w?: string;
|
||||
readonly w14?: string;
|
||||
readonly w15?: string;
|
||||
readonly wpg?: string;
|
||||
readonly wpi?: string;
|
||||
readonly wne?: string;
|
||||
readonly wps?: string;
|
||||
readonly Ignorable?: string;
|
||||
}
|
||||
|
||||
export class FootnotesAttributes extends XmlAttributeComponent<IFootnotesAttributesProperties> {
|
||||
protected xmlKeys = {
|
||||
protected readonly xmlKeys = {
|
||||
wpc: "xmlns:wpc",
|
||||
mc: "xmlns:mc",
|
||||
o: "xmlns:o",
|
||||
|
@ -6,12 +6,13 @@ import { SeperatorRun } from "./footnote/run/seperator-run";
|
||||
import { FootnotesAttributes } from "./footnotes-attributes";
|
||||
|
||||
export class FootNotes extends XmlComponent {
|
||||
private counter: number;
|
||||
// tslint:disable-next-line:readonly-keyword
|
||||
private currentId: number;
|
||||
|
||||
constructor() {
|
||||
super("w:footnotes");
|
||||
|
||||
this.counter = 1;
|
||||
this.currentId = 1;
|
||||
|
||||
this.root.push(
|
||||
new FootnotesAttributes({
|
||||
@ -61,10 +62,10 @@ export class FootNotes extends XmlComponent {
|
||||
}
|
||||
|
||||
public createFootNote(paragraph: Paragraph): void {
|
||||
const footnote = new Footnote(this.counter);
|
||||
const footnote = new Footnote(this.currentId);
|
||||
footnote.addParagraph(paragraph);
|
||||
this.root.push(footnote);
|
||||
|
||||
this.counter++;
|
||||
this.currentId++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user