Unshortify links when stripping html
This commit is contained in:
parent
73cfc6979f
commit
2a2255d75a
1 changed files with 5 additions and 1 deletions
|
@ -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 =
|
||||
|
|
Loading…
Reference in a new issue