Ellipsis erased
This commit is contained in:
@@ -426,7 +426,7 @@ def build_post_text_variants(title_text: str, link: str, max_length: int = 300):
|
|||||||
available = max_length - reserve
|
available = max_length - reserve
|
||||||
if available > 20:
|
if available > 20:
|
||||||
# FIX: Use single char '…' and strip trailing dots/spaces
|
# FIX: Use single char '…' and strip trailing dots/spaces
|
||||||
truncated_title = title_text[:available - 1].rstrip(" .") + "…"
|
truncated_title = title_text[:available].rstrip(" .")
|
||||||
add_variant(f"{truncated_title}\n\n{link}")
|
add_variant(f"{truncated_title}\n\n{link}")
|
||||||
|
|
||||||
# Variant 2: només títol (truncat si cal)
|
# Variant 2: només títol (truncat si cal)
|
||||||
@@ -435,7 +435,7 @@ def build_post_text_variants(title_text: str, link: str, max_length: int = 300):
|
|||||||
add_variant(title_text)
|
add_variant(title_text)
|
||||||
else:
|
else:
|
||||||
# FIX: Use single char '…' and strip trailing dots/spaces
|
# FIX: Use single char '…' and strip trailing dots/spaces
|
||||||
truncated = title_text[:max_length - 1].rstrip(" .") + "…"
|
truncated = title_text[:max_length - 1].rstrip(" .")
|
||||||
add_variant(truncated)
|
add_variant(truncated)
|
||||||
|
|
||||||
# Variant 3: només link (si no hi ha títol)
|
# Variant 3: només link (si no hi ha títol)
|
||||||
@@ -500,7 +500,7 @@ def make_rich(content: str):
|
|||||||
text_builder.text(trailing)
|
text_builder.text(trailing)
|
||||||
|
|
||||||
elif cleaned_word.startswith("#") and len(cleaned_word) > 1:
|
elif cleaned_word.startswith("#") and len(cleaned_word) > 1:
|
||||||
tag_name = cleaned_word[1:].rstrip(".,;:!?)'\"…")
|
tag_name = cleaned_word[1:].rstrip(".,;:!?)'\"")
|
||||||
if tag_name:
|
if tag_name:
|
||||||
text_builder.tag(cleaned_word, tag_name)
|
text_builder.tag(cleaned_word, tag_name)
|
||||||
trailing = word[len(cleaned_word):]
|
trailing = word[len(cleaned_word):]
|
||||||
|
|||||||
Reference in New Issue
Block a user