Explorar o código

Небольшое улучшение парсинга оглавления

Book Pauk %!s(int64=4) %!d(string=hai) anos
pai
achega
17699f66f8
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      client/components/Reader/share/BookParser.js

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

@@ -304,6 +304,11 @@ export default class BookParser {
                     bold = true;
                     center = true;
 
+                    if (curTitle.paraIndex < 0) {
+                        curTitle = {paraIndex, title: 'Оглавление', inset: sectionLevel, bodyIndex, subtitles: []};
+                        this.contents.push(curTitle);
+                    }
+
                     inSubtitle = true;
                     curSubtitle = {paraIndex, inset: sectionLevel, title: ''};
                     curTitle.subtitles.push(curSubtitle);