浏览代码

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

Book Pauk 4 年之前
父节点
当前提交
17699f66f8
共有 1 个文件被更改,包括 5 次插入0 次删除
  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);