From af6d385b31c6f5f90baae4f59feb0cd5f4dbbcab Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sun, 27 Jan 2019 00:58:29 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/share/BookParser.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index 5a33d56c..033c470e 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -138,8 +138,8 @@ export default class BookParser { }); parser.on('textNode', (text) => { - text = text.replace(/[\t\n\r]/g, ' '); - + text = text.replace(/ |[\t\n\r]/g, ' '); + if (text != ' ' && text.trim() == '') text = text.trim(); @@ -179,22 +179,22 @@ export default class BookParser { fb2.annotation += text; } - let cOpen = (center ? '
' : ''); - cOpen += (bold ? '' : ''); - let cClose = (center ? '
' : ''); - cClose += (bold ? '' : ''); + let tOpen = (center ? '
' : ''); + tOpen += (bold ? '' : ''); + let tClose = (center ? '
' : ''); + tClose += (bold ? '' : ''); if (path.indexOf('/FictionBook/body/title') == 0) { - newParagraph(`${cOpen}${text}${cClose}`, text.length, true); + newParagraph(`${tOpen}${text}${tClose}`, text.length, true); } if (path.indexOf('/FictionBook/body/section') == 0) { switch (tag) { case 'p': - growParagraph(`${cOpen}${text}${cClose}`, text.length); + growParagraph(`${tOpen}${text}${tClose}`, text.length); break; default: - growParagraph(`${cOpen}${text}${cClose}`, text.length); + growParagraph(`${tOpen}${text}${tClose}`, text.length); } } });