mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 09:05:30 +00:00
Better reverse link resoving
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package xmlmodels
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -16,6 +16,10 @@ type Work struct {
|
||||
AnnotationNote
|
||||
}
|
||||
|
||||
func (w Work) Name() string {
|
||||
return "work"
|
||||
}
|
||||
|
||||
func (p Work) ReferencesAgent(a string) (*AgentRef, bool) {
|
||||
for _, i := range p.AgentRefs {
|
||||
if strings.HasPrefix(i.Ref, a) {
|
||||
@@ -34,5 +38,6 @@ type Citation struct {
|
||||
}
|
||||
|
||||
func (w Work) String() string {
|
||||
return fmt.Sprintf("URLs: %v, Citation: %v, PreferredTitle: %s, Akteur: %v, Identifier: %v, AnnotationNote: %v\n", w.URLs, w.Citation, w.PreferredTitle, w.AgentRefs, w.Identifier, w.AnnotationNote)
|
||||
data, _ := json.MarshalIndent(w, "", " ")
|
||||
return string(data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user