From b0a87eee1cb3edac208d655ba91a3995b393f5dc Mon Sep 17 00:00:00 2001 From: fabiante Date: Tue, 13 Feb 2024 11:56:24 +0100 Subject: [PATCH] Improve readability of XML template --- template_record.go | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/template_record.go b/template_record.go index 043ebe3..c837a25 100644 --- a/template_record.go +++ b/template_record.go @@ -7,15 +7,26 @@ import ( const recordTemplateStr = ` - {{range $key, $value := .Fields}} + + {{- range $key, $value := .Fields}} {{$value}}{{end}}{{range $key, $value := .Attachments}} {{$value.Name}} - {{$value.Path}}{{if $value.Size}} - {{$value.Size}}{{end}}{{if $value.Register}} - {{$value.Register}}{{end}}{{if $value.Author}} - {{$value.Author}}{{end}} - {{end}} + {{$value.Path}} + + {{- if $value.Size}} + {{$value.Size}} + {{- end}} + + {{- if $value.Register}} + {{$value.Register}} + {{- end}} + + {{- if $value.Author}} + {{$value.Author}} + {{- end}} + + {{- end}} `