forked from LiveCarta/BookConverter
Font -> span out of presets
This commit is contained in:
@@ -43,11 +43,6 @@
|
|||||||
{
|
{
|
||||||
"preset_name": "replacer",
|
"preset_name": "replacer",
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
|
||||||
"tags": ["^font$"],
|
|
||||||
"condition": null,
|
|
||||||
"tag_to_replace": "span"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"tags": ["^h[6-9]$"],
|
"tags": ["^h[6-9]$"],
|
||||||
"condition": null,
|
"condition": null,
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class Docx2LibreHtml:
|
|||||||
"""Method for reading .html file into beautiful soup tag."""
|
"""Method for reading .html file into beautiful soup tag."""
|
||||||
try:
|
try:
|
||||||
html_text = open(html_path, "r", encoding="utf8").read()
|
html_text = open(html_path, "r", encoding="utf8").read()
|
||||||
self.logger_object.log("HTML for book has been loaded.")
|
self.logger_object.log("Html for book has been loaded.")
|
||||||
except FileNotFoundError as exc:
|
except FileNotFoundError as exc:
|
||||||
self.logger_object.log("There is no html to process."
|
self.logger_object.log("There is no html to process."
|
||||||
"Conversion went wrong or you specified wrong paths.", logging.ERROR)
|
"Conversion went wrong or you specified wrong paths.", logging.ERROR)
|
||||||
|
|||||||
@@ -283,9 +283,19 @@ class HtmlDocxProcessor:
|
|||||||
access=None,
|
access=None,
|
||||||
html_path: pathlib.Path = "",
|
html_path: pathlib.Path = "",
|
||||||
book_id: int = 0) -> Tuple[List[Tag], List[str], List[Dict[str, Union[str, bool]]]]:
|
book_id: int = 0) -> Tuple[List[Tag], List[str], List[Dict[str, Union[str, bool]]]]:
|
||||||
"""Process html code to satisfy LiveCarta formatting."""
|
"""Process html to satisfy LiveCarta formatting."""
|
||||||
self.logger.log("Beginning of processing .html file.")
|
self.logger.log("Beginning of processing .html file.")
|
||||||
|
|
||||||
|
# Process styles doesn't see <fonts> because they aren't supported by html
|
||||||
|
self._font_to_span()
|
||||||
|
|
||||||
|
self.logger.log("Inline style reading.")
|
||||||
|
self.style_preprocessor.process_inline_styles_in_html_soup(
|
||||||
|
self.body_tag)
|
||||||
|
|
||||||
|
self.logger.log("Inline style processing.")
|
||||||
|
modify_html_soup_with_css_styles(self.body_tag)
|
||||||
|
|
||||||
self.logger.log("Image processing.")
|
self.logger.log("Image processing.")
|
||||||
self.images = process_images(access, path_to_html=html_path,
|
self.images = process_images(access, path_to_html=html_path,
|
||||||
book_id=book_id, body_tag=self.body_tag)
|
book_id=book_id, body_tag=self.body_tag)
|
||||||
|
|||||||
Reference in New Issue
Block a user