dhruv575 commited on
Commit
1dc11f7
·
1 Parent(s): 98df35b

Pesky double semicolon

Browse files
app/email_new_converter.py CHANGED
@@ -629,10 +629,14 @@ class EmailNewConverter:
629
  # Add text-align:right as fallback in inline style
630
  second_td_style = second_td.get("style", "")
631
  if "text-align" not in second_td_style.lower():
632
- if second_td_style and not second_td_style.endswith(";"):
633
- second_td_style += ";"
634
- second_td_style += "text-align:right;"
635
- second_td["style"] = second_td_style.strip("; ")
 
 
 
 
636
 
637
  logger.info("Fixed section header table to simple 2-column layout for mobile compatibility")
638
 
 
629
  # Add text-align:right as fallback in inline style
630
  second_td_style = second_td.get("style", "")
631
  if "text-align" not in second_td_style.lower():
632
+ # Clean up the style first - remove trailing semicolons and spaces
633
+ second_td_style = second_td_style.strip().rstrip(";").strip()
634
+ # Add text-align:right
635
+ if second_td_style:
636
+ second_td_style += ";text-align:right"
637
+ else:
638
+ second_td_style = "text-align:right"
639
+ second_td["style"] = second_td_style
640
 
641
  logger.info("Fixed section header table to simple 2-column layout for mobile compatibility")
642
 
app/post_process.py CHANGED
@@ -424,10 +424,14 @@ def fix_section_header_alignment(html_content: str) -> str:
424
  # Add text-align:right as fallback in inline style
425
  second_td_style = second_td.get("style", "")
426
  if "text-align" not in second_td_style.lower():
427
- if second_td_style and not second_td_style.endswith(";"):
428
- second_td_style += ";"
429
- second_td_style += "text-align:right;"
430
- second_td["style"] = second_td_style.strip("; ")
 
 
 
 
431
  modified = True
432
 
433
  if modified:
 
424
  # Add text-align:right as fallback in inline style
425
  second_td_style = second_td.get("style", "")
426
  if "text-align" not in second_td_style.lower():
427
+ # Clean up the style first - remove trailing semicolons and spaces
428
+ second_td_style = second_td_style.strip().rstrip(";").strip()
429
+ # Add text-align:right
430
+ if second_td_style:
431
+ second_td_style += ";text-align:right"
432
+ else:
433
+ second_td_style = "text-align:right"
434
+ second_td["style"] = second_td_style
435
  modified = True
436
 
437
  if modified: