Skip to content

Commit

Permalink
Don't show ellipsis when URL shortening only removed scheme (jointaka…
Browse files Browse the repository at this point in the history
  • Loading branch information
manfre authored Jan 16, 2023
1 parent fd9015a commit 3333178
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,14 @@ def shorten_link_text(attrs, new=False):
if not text:
text = attrs.get((None, "href"))
if text and "://" in text and len(text) > 30:
attrs[(None, "class")] = " ".join(
filter(None, [attrs.pop((None, "class"), ""), "ellipsis"])
)
text = text.split("://", 1)[-1]
attrs["_text"] = text[:30]
if len(text) > 30:
attrs[(None, "class")] = " ".join(
filter(None, [attrs.pop((None, "class"), ""), "ellipsis"])
)
# Add the full URL in to title for easier user inspection
attrs[(None, "title")] = attrs.get((None, "href"))
attrs["_text"] = text.split("://", 1)[-1][:30]

return attrs

Expand Down

0 comments on commit 3333178

Please sign in to comment.