{{ $piece := . }} {{ if $piece.AgentRefs }}
{{ range $agentref := $piece.AgentRefs }} {{ if (or (eq $agentref.Category "") (eq $agentref.Category "autor")) }} {{ $agent := GetAgent $agentref.Ref }} {{- if gt (len $agent.Names) 0 -}} {{- index $agent.Names 0 -}} {{ end }} {{ end }} {{ end }}
{{ end }}
{{ if $piece.CategoryRefs }} {{ range $catref := $piece.CategoryRefs }} {{ $category := GetCategory $catref.Ref }} {{- if gt (len $category.Names) 0 -}}
{{- index $category.Names 0 -}}
{{ end }} {{ end }} {{ end }} {{- if $piece.Title -}}
{{- index $piece.Title 0 -}}
{{- else if $piece.Incipit -}}
{{- index $piece.Incipit 0 -}}
{{- end -}} {{- if $piece.PlaceRefs -}} {{ $place := GetPlace (index $piece.PlaceRefs 0).Ref }} {{- if gt (len $place.Names) 0 -}}
{{- index $place.Names 0 -}}
{{- end -}} {{- end -}} {{ if $piece.WorkRefs }} {{ range $workref := $piece.WorkRefs }} {{ $work := GetWork $workref.Ref }} {{- $kat := $workref.Category }} {{- if not $kat }} {{- $kat = "rezension" -}} {{- end -}} {{- $category := GetCategory $kat -}} {{- if gt (len $category.Names) 0 -}}
{{- index $category.Names 0 -}}
{{- end -}} {{- if $work.PreferredTitle -}}
{{- $work.PreferredTitle -}}
{{- else if $work.Citation.Title -}}
{{- $work.Citation.Title -}}
{{- else -}}
{{- $work.Citation.Chardata -}}
{{- end -}} {{- end -}} {{- end -}}
{{ range $annotation := $piece.AnnotationNote.Annotations }}
{{ $annotation.Inner.InnerXML }}
{{ end }}