small fix

This commit is contained in:
shirshasa
2020-05-22 14:05:52 +03:00
parent 7f59c5d381
commit db4e1d0fb1

View File

@@ -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,