diff --git a/drivel.go b/drivel.go index 7a8ba45..1d410db 100644 --- a/drivel.go +++ b/drivel.go @@ -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) } diff --git a/rss.template b/rss.template index d7a392e..5662a0d 100644 --- a/rss.template +++ b/rss.template @@ -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}}:

{{$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}}:

+{{replaceAll $status.Text "\n" "
"}} {{range $idxMedia, $media := $status.Extended_entities.Media}}
{{end}}