Fix empty link replacement

This commit is contained in:
Zed 2019-08-15 18:45:56 +02:00
parent f27bc63d9d
commit fdd71946da
2 changed files with 4 additions and 3 deletions

View File

@ -63,10 +63,11 @@ proc linkifyText*(text: string; prefs: Prefs): string =
result = result.replace(twRegex, prefs.replaceTwitter)
proc replaceUrl*(url: string; prefs: Prefs): string =
result = url
if prefs.replaceYouTube.len > 0:
return url.replace(ytRegex, prefs.replaceYouTube)
result = url.replace(ytRegex, prefs.replaceYouTube)
if prefs.replaceTwitter.len > 0:
return url.replace(twRegex, prefs.replaceTwitter)
result = url.replace(twRegex, prefs.replaceTwitter)
proc stripTwitterUrls*(text: string): string =
result = text

View File

@ -44,7 +44,7 @@ const prefList*: Table[string, seq[Pref]] = {
defaultState: false),
Pref(kind: checkbox, name: "autoplayGifs", label: "Autoplay gifs",
defaultState: true),
defaultState: true)
],
"Display": @[