Jelajahi Sumber

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

Book Pauk 4 tahun lalu
induk
melakukan
83a60b4091
1 mengubah file dengan 6 tambahan dan 4 penghapusan
  1. 6 4
      client/components/Reader/share/BookParser.js

+ 6 - 4
client/components/Reader/share/BookParser.js

@@ -189,7 +189,7 @@ export default class BookParser {
                 return;
 
             tag = elemName;
-            path += '/' + elemName;
+            path += '/' + tag;
 
             if (tag == 'binary') {
                 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)
                     fb2.author = [];
                 fb2.author.push({});
@@ -272,7 +272,7 @@ export default class BookParser {
                     curTitle.subtitles.push(curSubtitle);
                 }
 
-                if (tag == 'epigraph') {
+                if (tag == 'epigraph' || tag == 'annotation') {
                     italic = true;
                     space += 1;
                 }
@@ -321,9 +321,11 @@ export default class BookParser {
                         inSubtitle = false;
                     }
 
-                    if (tag == 'epigraph') {
+                    if (tag == 'epigraph' || tag == 'annotation') {
                         italic = false;
                         space -= 1;
+                        if (tag == 'annotation')
+                            newParagraph(' ', 1);
                     }
 
                     if (tag == 'stanza') {