diff --git a/src/book_solver.py b/src/book_solver.py index b4d4df3..4c3d8f2 100644 --- a/src/book_solver.py +++ b/src/book_solver.py @@ -15,11 +15,6 @@ from abc import abstractmethod, ABCMeta from livecarta_config import LawCartaConfig from util.helpers import BookLogger, BookStatusWrapper -<<<<<<< HEAD:converter/src/book_solver.py - - -======= ->>>>>>> develop:converter/src/solver.py class BookSolver: diff --git a/src/css_reader.py b/src/css_reader.py index bd2dc17..156ebb6 100644 --- a/src/css_reader.py +++ b/src/css_reader.py @@ -231,8 +231,21 @@ class TagStyleConverter: style = style.replace('list-style-image', 'list-style-type') # if tag had already had inline style, add this to style parsed from css + if self.tag.attrs.get('style') and self.tag.attrs['style'] not in style: - style += self.tag.attrs['style'] + # hot_fix + negative_text_indent_regexp = re.compile(r'((text-indent:( *-\w+%*);) *(margin-left:( *\w+%*);))|(text-indent:( *-\w+%*);)') + inline_style = self.tag.attrs['style'] + has_inline_style_attrs = re.search(negative_text_indent_regexp, inline_style) + has_css_style_attrs = re.search(negative_text_indent_regexp, style) + if has_inline_style_attrs: + if has_inline_style_attrs.group(1): + inline_style = inline_style.replace(has_inline_style_attrs.group(1), 'text-indent: ' + has_inline_style_attrs.group(5)) + style = style.replace(has_css_style_attrs.group(1), '') + if has_inline_style_attrs.group(6): + inline_style = inline_style.replace(has_inline_style_attrs.group(6), '') + style = style.replace(has_css_style_attrs.group(6), '') + style += inline_style return style diff --git a/src/docx_solver.py b/src/docx_solver.py index 19e5d18..5f3a13d 100644 --- a/src/docx_solver.py +++ b/src/docx_solver.py @@ -8,11 +8,7 @@ from threading import Event from bs4 import BeautifulSoup from html_docx_preprocessor import HTMLDocxPreprocessor from libra_html2json_converter import LibraHTML2JSONConverter -<<<<<<< HEAD from book_solver import BookSolver -======= -from solver import BookSolver ->>>>>>> develop class DocxBook(BookSolver): diff --git a/src/epub_converter.py b/src/epub_converter.py index 375020e..82510af 100644 --- a/src/epub_converter.py +++ b/src/epub_converter.py @@ -442,7 +442,7 @@ if __name__ == "__main__": logger_object = BookLogger(name=f'epub', main_logger=logger, book_id=0) - json_converter = EpubConverter('../epub/calibri.epub', + json_converter = EpubConverter('../epub/', logger=logger_object) tmp = json_converter.convert_to_dict() diff --git a/src/epub_solver.py b/src/epub_solver.py index f03be13..5b07f23 100644 --- a/src/epub_solver.py +++ b/src/epub_solver.py @@ -1,10 +1,5 @@ from epub_converter import EpubConverter -<<<<<<< HEAD from book_solver import BookSolver -======= -from solver import BookSolver ->>>>>>> develop - class EpubBook(BookSolver):