Улучшение парсинга fb2

This commit is contained in:
Book Pauk
2019-02-20 19:43:39 +07:00
parent dd61c04d63
commit d3a30b87f4
2 changed files with 15 additions and 12 deletions

View File

@@ -73,7 +73,7 @@ export default class DrawHelper {
let lineText = '';
let center = false;
let space = false;
let space = 0;
let j = 0;
//формируем строку
for (const part of line.parts) {
@@ -97,7 +97,7 @@ export default class DrawHelper {
lineText += `${tOpen}${text}${tClose}`;
center = center || part.style.center;
space = space || part.style.space;
space = (part.style.space > 0 ? part.style.space : space);
//избражения
//image: {local: Boolean, inline: Boolean, id: String, imageLine: Number, lineCount: Number, paraIndex: Number},
@@ -129,7 +129,7 @@ export default class DrawHelper {
const centerStyle = (center ? `text-align: center; text-align-last: center; width: ${this.w}px` : '')
if ((line.first || space) && !center) {
let p = (line.first ? this.p : 0);
p = (space ? p + this.p : p);
p = (space ? p + this.p*space : p);
lineText = `<span style="display: inline-block; margin-left: ${p}px"></span>${lineText}`;
}