#? stdtmpl(subsChar = '$', metaChad = '#') #import strutils, xmltree, strformat, options #import ../types, ../utils, ../formatters # #proc getTitle(tweet: Tweet; prefs: Prefs; retweet: string): string = #if tweet.pinned: result = "Pinned: " #elif retweet.len > 0: result = &"RT by @{retweet}: " #elif tweet.reply.len > 0: result = &"R to @{tweet.reply[0]}: " #end if #result &= xmltree.escape(stripHtml(tweet.text)) #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 getDescription(desc: string; cfg: Config): string = Twitter feed for: ${desc}. Generated by ${cfg.hostname} #end proc # #proc renderRssTweet(tweet: Tweet; prefs: Prefs; cfg: Config): string = #let tweet = tweet.retweet.get(tweet) #let urlPrefix = getUrlPrefix(cfg) #let text = replaceUrl(tweet.text, prefs, absolute=urlPrefix) #if tweet.quote.isSome and get(tweet.quote).available: # let quoteLink = getLink(get(tweet.quote))
${text}
${cfg.hostname}${quoteLink}
${text}
#end if #if tweet.photos.len > 0: # for photo in tweet.photos: # end for #elif tweet.video.isSome: #elif tweet.gif.isSome: # let thumb = &"{urlPrefix}{getPicUrl(get(tweet.gif).thumb)}" # let url = &"{urlPrefix}{getPicUrl(get(tweet.gif).url)}" #elif tweet.card.isSome: # let card = tweet.card.get() # if card.image.len > 0: # end if #end if #end proc # #proc renderRssTweets(tweets: seq[Tweet]; prefs: Prefs; cfg: Config): string = #let urlPrefix = getUrlPrefix(cfg) #var links: seq[string] #for t in tweets: # let retweet = if t.retweet.isSome: t.profile.username else: "" # let tweet = if retweet.len > 0: t.retweet.get else: t # let link = getLink(tweet) # if link in links: continue # end if # links.add link