Improve link shortening
This commit is contained in:
parent
5c6a7bde58
commit
2b7b374708
1 changed files with 1 additions and 1 deletions
|
@ -23,7 +23,7 @@ proc stripHtml*(text: string): string =
|
||||||
html.innerText()
|
html.innerText()
|
||||||
|
|
||||||
proc shortLink*(text: string; length=28): string =
|
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:
|
if result.len > length:
|
||||||
result = result[0 ..< length] & "…"
|
result = result[0 ..< length] & "…"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue