From 7ce539729ec6a2b1d82863cd197c11233e2fa7ac Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Tue, 22 Jan 2019 23:49:44 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D0=BE=D0=B7=D0=BD=D0=B0=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20title-subtitle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/share/BookParser.js | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index e513c4e2..2a58ea01 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -43,6 +43,7 @@ export default class BookParser { let tag = ''; let nextPerc = 0; let center = false; + let bold = false; let paraIndex = -1; let paraOffset = 0; @@ -106,10 +107,16 @@ export default class BookParser { growParagraph(`<${tag}>`, 0); } - if (tag == 'title' || tag == 'subtitle') { + if (tag == 'title') { newParagraph(' ', 1); + bold = true; center = true; } + + if (tag == 'subtitle') { + newParagraph(' ', 1); + bold = true; + } }); parser.on('endNode', (elemName, isTagStart, getStrNode) => {// eslint-disable-line no-unused-vars @@ -118,8 +125,13 @@ export default class BookParser { growParagraph(``, 0); } - if (tag == 'title' || tag == 'subtitle') + if (tag == 'title') { + bold = false; center = false; + } + + if (tag == 'subtitle') + bold = false; path = path.substr(0, path.length - tag.length - 1); let i = path.lastIndexOf('/'); @@ -171,8 +183,10 @@ export default class BookParser { fb2.annotation += text; } - let cOpen = (center ? '
' : ''); - let cClose = (center ? '
' : ''); + let cOpen = (center ? '
' : ''); + cOpen += (bold ? '' : ''); + let cClose = (center ? '
' : ''); + cClose += (bold ? '' : ''); if (path.indexOf('/FictionBook/body/title') == 0) { newParagraph(`${cOpen}${text}${cClose}`, text.length, true);