diff --git a/src/book.py b/src/book.py index b751220..bdd6947 100644 --- a/src/book.py +++ b/src/book.py @@ -722,6 +722,18 @@ class Book: new_tag.string = title tag.replace_with(new_tag) + def _process_lists(self): + """ + Function to process tags
tags. + """ + list_tags = self.body_tag.find_all("ul") + + for tag in list_tags: + for il_tag in tag.find_all("li"): + il_tag.attrs.update(il_tag.p.attrs) + il_tag.p.unwrap() + def write_html_from_list(self, file_name='url_test.html'): folder_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) file_path = pathlib.Path(os.path.join(folder_path, file_name)) @@ -779,6 +791,8 @@ class Book: # delete text before table of content if exists self.delete_content_before_toc() + + self._process_lists() except Exception as exc: self.log('Error has occurred while processing html.', logging.ERROR) self.log_error_to_main_log()