diff --git a/cmd/version.go b/cmd/version.go index b0d6f92..812ec01 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -15,7 +15,7 @@ var versionCmd = &cobra.Command{ Short: "Print the version number of commonmeta", Long: `All software has versions. This is commonmeta's`, Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Commonmeta v0.3.7 -- HEAD") + fmt.Println("Commonmeta v0.3.8 -- HEAD") }, } diff --git a/jsonfeed/reader.go b/jsonfeed/reader.go index feee217..db04902 100644 --- a/jsonfeed/reader.go +++ b/jsonfeed/reader.go @@ -89,8 +89,7 @@ type Relation struct { // Reference represents a reference in the JSON Feed item. type Reference struct { Key string `json:"key"` - DOI string `json:"doi"` - URL string `json:"url"` + ID string `json:"id"` PublicationYear string `json:"publicationYear"` Title string `json:"title"` } @@ -324,17 +323,19 @@ func Read(content Content) (commonmeta.Data, error) { } for _, v := range content.Reference { - reference := commonmeta.Reference{ - Key: v.Key, - ID: doiutils.NormalizeDOI(v.DOI), - Title: v.Title, - PublicationYear: v.PublicationYear, - } - containsKey := slices.ContainsFunc(data.References, func(e commonmeta.Reference) bool { - return e.Key != "" && e.Key == reference.Key - }) - if !containsKey { - data.References = append(data.References, reference) + if v.ID != "" { + reference := commonmeta.Reference{ + Key: v.Key, + ID: v.ID, + Title: v.Title, + PublicationYear: v.PublicationYear, + } + containsKey := slices.ContainsFunc(data.References, func(e commonmeta.Reference) bool { + return e.Key != "" && e.Key == reference.Key + }) + if !containsKey { + data.References = append(data.References, reference) + } } }