2017-03-27 07:34:58 +02:00
|
|
|
// A abstract PageItem class, can be TextItem, LineItem or LineItemBlock
|
2017-03-07 21:59:15 +01:00
|
|
|
export default class PageItem {
|
|
|
|
|
|
|
|
constructor(options) {
|
|
|
|
if (this.constructor === PageItem) {
|
|
|
|
throw new TypeError("Can not construct abstract class.");
|
|
|
|
}
|
|
|
|
this.type = options.type;
|
|
|
|
this.annotation = options.annotation;
|
|
|
|
this.parsedElements = options.parsedElements;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2017-03-10 08:49:40 +01:00
|
|
|
|
|
|
|
export class ParsedElements {
|
|
|
|
|
|
|
|
constructor(options) {
|
2017-03-18 08:56:08 +01:00
|
|
|
this.footnoteLinks = options.footnoteLinks || [];
|
|
|
|
this.footnotes = options.footnotes || [];
|
|
|
|
this.containLinks = options.containLinks;
|
2017-03-28 08:15:27 +02:00
|
|
|
this.formattedWords = options.formattedWords;
|
2017-03-10 08:49:40 +01:00
|
|
|
}
|
|
|
|
|
2017-03-11 13:42:09 +01:00
|
|
|
add(parsedElements) {
|
2017-03-10 08:49:40 +01:00
|
|
|
this.footnoteLinks = this.footnoteLinks.concat(parsedElements.footnoteLinks);
|
|
|
|
this.footnotes = this.footnotes.concat(parsedElements.footnotes);
|
2017-03-18 08:56:08 +01:00
|
|
|
this.containLinks = this.containLinks || parsedElements.containLinks;
|
2017-03-28 08:15:27 +02:00
|
|
|
this.formattedWords += parsedElements.formattedWords;
|
2017-03-10 08:49:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|