#? stdtmpl(subsChar = '$', metaChad = '#') #import strutils, xmltree, strformat #import ../types, ../utils, ../formatters #const hostname {.strdefine.} = "nitter.net" # #proc renderRssTweet(tweet: Tweet; prefs: Prefs): string = #let text = linkifyText(tweet.text, prefs, rss=true) #if tweet.quote.isSome and get(tweet.quote).available: #let quoteLink = hostname & getLink(get(tweet.quote))

${text}
${quoteLink}

#else:

${text}

#end if #if tweet.photos.len > 0: #elif tweet.video.isSome: #elif tweet.gif.isSome: #let thumb = &"https://{hostname}{getPicUrl(get(tweet.gif).thumb)}" #let url = &"https://{hostname}{getGifUrl(get(tweet.gif).url)}" #end if #end proc # #proc getTitle(tweet: Tweet; prefs: Prefs): string = #if tweet.pinned: result = "Pinned: " #elif tweet.retweet.isSome: result = "RT: " #end if #result &= xmltree.escape(replaceUrl(tweet.text, prefs)) #if result.len > 0: return #end if #if tweet.photos.len > 0: # result &= "Image" #elif tweet.video.isSome: # result &= "Video" #elif tweet.gif.isSome: # result &= "Gif" #end if #end proc # #proc renderTimelineRss*(tweets: seq[Tweet]; profile: Profile): string = #let prefs = Prefs(replaceTwitter: hostname) #result = "" ${profile.fullname} / @${profile.username} https://${hostname}/${profile.username} Twitter feed for: @${profile.username}. Generated by ${hostname} en-us 40 ${profile.fullname} / @${profile.username} https://${hostname}/${profile.username} https://${hostname}${getPicUrl(profile.getUserPic(style="_400x400"))} 128 128 #for tweet in tweets: ${getTitle(tweet, prefs)} @${tweet.profile.username} ${getRfc822Time(tweet)} https://${hostname}${getLink(tweet)} https://${hostname}${getLink(tweet)} #end for #end proc # #proc renderListRss*(tweets: seq[Tweet]; name, list: string): string = #let prefs = Prefs(replaceTwitter: hostname) #result = "" ${list} / @${name} https://${hostname}/${name}/lists/${list} Twitter feed for: ${list} by @${name}. Generated by ${hostname} en-us 40 #for tweet in tweets: ${getTitle(tweet, prefs)} @${tweet.profile.username} ${getRfc822Time(tweet)} https://${hostname}${getLink(tweet)} https://${hostname}${getLink(tweet)} #end for #end proc