mirror of
https://github.com/zedeus/nitter.git
synced 2025-12-08 04:55:37 -05:00
Improve link shortening
This commit is contained in:
@@ -23,7 +23,7 @@ proc stripHtml*(text: string): string =
|
||||
html.innerText()
|
||||
|
||||
proc shortLink*(text: string; length=28): string =
|
||||
result = text.replace(re"https?://(www.)?", "")
|
||||
result = text.replace(re"https?://(www[0-9]?\.)?", "")
|
||||
if result.len > length:
|
||||
result = result[0 ..< length] & "…"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user