Sfoglia il codice sorgente

Добавлен показ аннотации в начале книги

Book Pauk 4 anni fa
parent
commit
d8d89b3463
1 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 9 0
      client/components/Reader/share/BookParser.js

+ 9 - 0
client/components/Reader/share/BookParser.js

@@ -224,6 +224,15 @@ export default class BookParser {
 
             if (path.indexOf('/fictionbook/body') == 0) {
                 if (tag == 'body') {
+                    if (isFirstBody && fb2.annotation) {
+                        const ann = fb2.annotation.split('<p>').filter(v => v).map(v => utils.removeHtmlTags(v));
+                        ann.forEach(a => {
+                            newParagraph(`<emphasis><space w="1">${a}</space></emphasis>`, a.length);
+                        });
+                        if (ann.length)
+                            newParagraph(' ', 1);
+                    }
+
                     if (!isFirstBody)
                         newParagraph(' ', 1);
                     isFirstBody = false;