Fixed RSS ellipsis
This commit is contained in:
@@ -401,7 +401,6 @@ def process_title(title: str) -> str:
|
||||
title_text = clean_whitespace(title_text)
|
||||
return title_text
|
||||
|
||||
|
||||
def build_post_text_variants(title_text: str, link: str, max_length: int = 300):
|
||||
title_text = clean_whitespace(title_text)
|
||||
link = canonicalize_url(link) or link or ""
|
||||
@@ -426,7 +425,8 @@ def build_post_text_variants(title_text: str, link: str, max_length: int = 300):
|
||||
reserve = len(link) + 2
|
||||
available = max_length - reserve
|
||||
if available > 20:
|
||||
truncated_title = title_text[:available - 3].rstrip() + "..."
|
||||
# FIX: Use single char '…' and strip trailing dots/spaces
|
||||
truncated_title = title_text[:available - 1].rstrip(" .") + "…"
|
||||
add_variant(f"{truncated_title}\n\n{link}")
|
||||
|
||||
# Variant 2: només títol (truncat si cal)
|
||||
@@ -434,7 +434,8 @@ def build_post_text_variants(title_text: str, link: str, max_length: int = 300):
|
||||
if len(title_text) <= max_length:
|
||||
add_variant(title_text)
|
||||
else:
|
||||
truncated = title_text[:max_length - 3].rstrip() + "..."
|
||||
# FIX: Use single char '…' and strip trailing dots/spaces
|
||||
truncated = title_text[:max_length - 1].rstrip(" .") + "…"
|
||||
add_variant(truncated)
|
||||
|
||||
# Variant 3: només link (si no hi ha títol)
|
||||
|
||||
Reference in New Issue
Block a user