forked from LiveCarta/BookConverter
small fix
This commit is contained in:
15
src/book.py
15
src/book.py
@@ -851,12 +851,15 @@ class Book:
|
|||||||
self.set_error_status()
|
self.set_error_status()
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
# add is_introduction field if first chapter is Introduction
|
# Add is_introduction field to json structure
|
||||||
if not self.top_level_headers[0]['should_be_numbered']:
|
# after deleting content before toc, some chapters can be deleted
|
||||||
# title should be checked as after deleting content
|
same_first_titles = self.top_level_headers[0]['title'] in json_strc[0].keys()
|
||||||
# before toc, some chapters can be deleted
|
is_first_header_introduction = not self.top_level_headers[0]['should_be_numbered']
|
||||||
if self.top_level_headers[0]['title'] in json_strc[0].keys():
|
|
||||||
json_strc[0]['is_introduction'] = True
|
if is_first_header_introduction and same_first_titles:
|
||||||
|
json_strc[0]['is_introduction'] = True
|
||||||
|
else:
|
||||||
|
json_strc[0]['is_introduction'] = False
|
||||||
|
|
||||||
self.content_dict = {
|
self.content_dict = {
|
||||||
"content": json_strc,
|
"content": json_strc,
|
||||||
|
|||||||
Reference in New Issue
Block a user