drivel/rss.template
gutmet 0687b4e2f2 make strings.ReplaceAll available in templates
* replace newline with br in rss template
2020-11-25 14:49:49 +01:00

45 lines
1.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>Twitter</title>
<link>https://twitter.com</link>
<description>Twitter</description>
{{range $index, $post := .}}
<item>
<title>{{$post.User.Screen_name}} ({{$post.Id_str}})</title>
<content:encoded><![CDATA[
{{$status := $post}}
{{if $status.Retweeted_status}}
{{$status = $post.Retweeted_status}}
@{{$post.User.Screen_name}} ({{$post.Id_str}}) retweeted
{{end}}
{{$user := $status.User.Screen_name}}
@{{$user}} ({{$status.Id_str}}){{if $status.In_reply_to_status_id_str}} in reply to {{$status.In_reply_to_screen_name}} ({{$status.In_reply_to_status_id_str}}){{end}}: <br><br>
{{replaceAll $status.Text "\n" "<br>"}}
{{range $idxMedia, $media := $status.Extended_entities.Media}}
<br><a href="https://twitter.com/{{$user}}/status/{{$status.Id_str}}"><img src="{{$media.Media_url}}"></a>
{{end}}
{{if $status.Quoted_status}}
{{$quotedUser := $status.Quoted_status.User.Screen_name}}
<br><br>Quotes
@{{$quotedUser}} ({{$status.Quoted_status.Id_str}}): <br><br>{{$status.Quoted_status.Text}}
{{range $idxMedia, $media := $status.Quoted_status.Extended_entities.Media}}
<br><a href="https://twitter.com/{{$quotedUser}}/status/{{$status.Quoted_status.Id_str}}"><img src="{{$media.Media_url}}"></a>
{{end}}
{{end}}
]]></content:encoded>
<link>https://twitter.com/{{$user}}/status/{{$status.Id_str}}</link>
<guid>https://twitter.com/{{$user}}/status/{{$status.Id_str}}</guid>
<pubDate>{{$post.Created_at.Time.Format "Mon, 02 Jan 2006 15:04:05 -0700"}}</pubDate>
</item>
{{- end}}
</channel>
</rss>