make strings.ReplaceAll available in templates
* replace newline with br in rss template
This commit is contained in:
parent
11dd018f97
commit
0687b4e2f2
|
@ -583,7 +583,7 @@ func wrapCommandFl(cmd func() (goutil.CommandFlagsInit, goutil.CommandFunc)) fun
|
|||
flagsInit(s)
|
||||
}, func(args []string) error {
|
||||
if f.templateFile != "" {
|
||||
formatTemplate = template.Must(template.ParseFiles(f.templateFile))
|
||||
formatTemplate = template.Must(template.New(filepath.Base(f.templateFile)).Funcs(template.FuncMap{"replaceAll": strings.ReplaceAll}).ParseFiles(f.templateFile))
|
||||
}
|
||||
return commandFunc(args)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
{{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>{{$status.Text}}
|
||||
@{{$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}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user