stupid and buggy
This commit is contained in:
parent
3445b183cd
commit
b9d8ec6773
@ -66,7 +66,6 @@ proc replaceUrls*(body: string; prefs: Prefs; absolute=""): string =
|
||||
result = result.replace(tco, https & prefs.replaceTwitter & "/t.co")
|
||||
result = result.replace(cards, prefs.replaceTwitter & "/cards")
|
||||
result = result.replace(twRegex, prefs.replaceTwitter)
|
||||
result = result.replace("https:", "")
|
||||
result = result.replacef(twLinkRegex, a(
|
||||
prefs.replaceTwitter & "$4", href = prefs.replaceTwitter & "$2"))
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import strutils, strformat, options, json, sequtils, times, math
|
||||
import ".."/[types, formatters, utils]
|
||||
|
||||
proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string =
|
||||
var content = replaceUrls(tweet.text, prefs, absolute=getUrlPrefix(cfg)).replace("href=\"//", "href=\"http://")
|
||||
var content = replaceUrls(tweet.text, prefs, absolute=getUrlPrefix(cfg))
|
||||
|
||||
if tweet.poll.isSome():
|
||||
let poll = get(tweet.poll)
|
||||
@ -24,7 +24,7 @@ proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string =
|
||||
if tweet.quote.isSome():
|
||||
let
|
||||
quote = get(tweet.quote)
|
||||
quoteContent = replaceUrls(quote.text, prefs, absolute=getUrlPrefix(cfg)).replace("href=\"//", "href=\"http://")
|
||||
quoteContent = replaceUrls(quote.text, prefs, absolute=getUrlPrefix(cfg))
|
||||
quoteUrl = &"{getUrlPrefix(cfg)}/i/status/{quote.id}"
|
||||
content &= &"\n\n<blockquote><b>↘ <a href=\"{quoteUrl}\">{quote.user.fullName} (@{quote.user.username})</a></b>\n{quoteContent}"
|
||||
|
||||
@ -42,7 +42,7 @@ proc formatTweetForMastoAPI*(tweet: Tweet, cfg: Config, prefs: Prefs): string =
|
||||
if tweet.birdwatch.isSome():
|
||||
let
|
||||
note = get(tweet.birdwatch)
|
||||
noteContent = replaceUrls(note.text, prefs, absolute=getUrlPrefix(cfg)).replace("href=\"//", "href=\"http://")
|
||||
noteContent = replaceUrls(note.text, prefs, absolute=getUrlPrefix(cfg))
|
||||
content &= &"\n\n<blockquote><b>ⓘ {note.title}</b>\n{noteContent}</blockquote>"
|
||||
|
||||
result = content.replace("\n", "<br>")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user