From 3f5cd7985d1e0d5836d17e8f962aec9d6f3a0d03 Mon Sep 17 00:00:00 2001 From: AaronBenDaniel <144371000+AaronBenDaniel@users.noreply.github.com> Date: Sat, 12 Apr 2025 13:52:14 -0400 Subject: [PATCH] fix(api): Carry over paragraph styling (#51) --- src/api/src/create_book.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/api/src/create_book.py b/src/api/src/create_book.py index f1c4ae3..e834134 100644 --- a/src/api/src/create_book.py +++ b/src/api/src/create_book.py @@ -152,6 +152,13 @@ def generate_clean_part_html(part: Part, content: str) -> bs4.Tag: for child in html.find_all("p"): current_paragraph = clean.new_tag("p") + + # Attempt to carry over paragraph styling + try: + current_paragraph["style"] = child["style"] + except: + current_paragraph["style"] = "text-align: left;" + for p_child in list(child.children): if not p_child: continue