Небольшие поправки парсера

This commit is contained in:
Book Pauk
2020-11-13 23:59:55 +07:00
parent b292407ec2
commit 83a60b4091

View File

@@ -189,7 +189,7 @@ export default class BookParser {
return; return;
tag = elemName; tag = elemName;
path += '/' + elemName; path += '/' + tag;
if (tag == 'binary') { if (tag == 'binary') {
let attrs = sax.getAttrsSync(tail); let attrs = sax.getAttrsSync(tail);
@@ -216,7 +216,7 @@ export default class BookParser {
} }
} }
if (elemName == 'author' && path.indexOf('/fictionbook/description/title-info/author') == 0) { if (tag == 'author' && path.indexOf('/fictionbook/description/title-info/author') == 0) {
if (!fb2.author) if (!fb2.author)
fb2.author = []; fb2.author = [];
fb2.author.push({}); fb2.author.push({});
@@ -272,7 +272,7 @@ export default class BookParser {
curTitle.subtitles.push(curSubtitle); curTitle.subtitles.push(curSubtitle);
} }
if (tag == 'epigraph') { if (tag == 'epigraph' || tag == 'annotation') {
italic = true; italic = true;
space += 1; space += 1;
} }
@@ -321,9 +321,11 @@ export default class BookParser {
inSubtitle = false; inSubtitle = false;
} }
if (tag == 'epigraph') { if (tag == 'epigraph' || tag == 'annotation') {
italic = false; italic = false;
space -= 1; space -= 1;
if (tag == 'annotation')
newParagraph(' ', 1);
} }
if (tag == 'stanza') { if (tag == 'stanza') {