Skip to content

Commit

Permalink
Improve readability of XML template
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiante committed Feb 13, 2024
1 parent d3d597a commit b0a87ee
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions template_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,26 @@ import (

const recordTemplateStr = `<?xml version="1.0"?>
<records xmlns="http://namespace.otris.de/2010/09/archive/recordExtern">
<record>{{range $key, $value := .Fields}}
<record>
{{- range $key, $value := .Fields}}
<field name="{{$key}}">{{$value}}</field>{{end}}{{range $key, $value := .Attachments}}
<attachment>
<name>{{$value.Name}}</name>
<path>{{$value.Path}}</path>{{if $value.Size}}
<size>{{$value.Size}}</size>{{end}}{{if $value.Register}}
<register>{{$value.Register}}</register>{{end}}{{if $value.Author}}
<author>{{$value.Author}}</author>{{end}}
</attachment>{{end}}
<path>{{$value.Path}}</path>
{{- if $value.Size}}
<size>{{$value.Size}}</size>
{{- end}}
{{- if $value.Register}}
<register>{{$value.Register}}</register>
{{- end}}
{{- if $value.Author}}
<author>{{$value.Author}}</author>
{{- end}}
</attachment>
{{- end}}
</record>
</records>
`
Expand Down

0 comments on commit b0a87ee

Please sign in to comment.