Работа над ContentsPage
This commit is contained in:
@@ -58,6 +58,7 @@ export default class BookParser {
|
||||
let curSubtitle = {paraIndex: -1, title: ''};
|
||||
let inTitle = false;
|
||||
let inSubtitle = false;
|
||||
let sectionLevel = 0;
|
||||
|
||||
let paraIndex = -1;
|
||||
let paraOffset = 0;
|
||||
@@ -234,7 +235,7 @@ export default class BookParser {
|
||||
center = true;
|
||||
|
||||
inTitle = true;
|
||||
curTitle = {paraIndex, title: '', subtitles: []};
|
||||
curTitle = {paraIndex, title: '', inset: sectionLevel, subtitles: []};
|
||||
this.contents.push(curTitle);
|
||||
}
|
||||
|
||||
@@ -242,6 +243,7 @@ export default class BookParser {
|
||||
if (!isFirstSection)
|
||||
newParagraph(' ', 1);
|
||||
isFirstSection = false;
|
||||
sectionLevel++;
|
||||
}
|
||||
|
||||
if (tag == 'emphasis' || tag == 'strong') {
|
||||
@@ -264,7 +266,7 @@ export default class BookParser {
|
||||
center = true;
|
||||
|
||||
inSubtitle = true;
|
||||
curSubtitle = {paraIndex, title: ''};
|
||||
curSubtitle = {paraIndex, inset: sectionLevel, title: ''};
|
||||
curTitle.subtitles.push(curSubtitle);
|
||||
}
|
||||
|
||||
@@ -298,6 +300,10 @@ export default class BookParser {
|
||||
inTitle = false;
|
||||
}
|
||||
|
||||
if (tag == 'section') {
|
||||
sectionLevel--;
|
||||
}
|
||||
|
||||
if (tag == 'emphasis' || tag == 'strong') {
|
||||
growParagraph(`</${tag}>`, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user