Unshortify links when stripping html

This commit is contained in:
Zed 2019-10-11 19:20:40 +02:00
parent 73cfc6979f
commit 2a2255d75a
1 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,11 @@ proc stripText*(text: string): string =
text.replace(nbsp, " ").strip()
proc stripHtml*(text: string): string =
let html = parseHtml(text)
var html = parseHtml(text)
for el in html.findAll("a"):
let link = el.attr("href")
if "http" in link:
el[0].text = link
html.innerText()
proc shortLink*(text: string; length=28): string =