From 6da09f08213c12e345d7dc2cceea9f5e90d658b2 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Mon, 13 Jan 2025 22:29:49 +0100 Subject: [PATCH] use guid as doi in jsonfeed reader --- cmd/root.go | 2 +- jsonfeed/reader.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 40bdcc1..f4960e0 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -13,7 +13,7 @@ import ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ Use: "commonmeta", - Version: "v0.6.27", + Version: "v0.6.28", Short: "Convert scholarly metadata from one format to another", Long: `Convert scholarly metadata between formats. Currently supported input formats are Crossref and DataCite DOIs, currently diff --git a/jsonfeed/reader.go b/jsonfeed/reader.go index 3961b33..0e40bc1 100644 --- a/jsonfeed/reader.go +++ b/jsonfeed/reader.go @@ -270,7 +270,10 @@ func Read(content Content) (commonmeta.Data, error) { if content.DOI != "" { data.ID = doiutils.NormalizeDOI(content.DOI) - } else if content.Blog.Prefix != "" { + } else if content.GUID != "" { + data.ID = doiutils.NormalizeDOI(content.GUID) + } + if data.ID == "" && content.Blog.Prefix != "" { // optionally generate a DOI string if missing but a DOI prefix is provided data.ID = doiutils.EncodeDOI(content.Blog.Prefix) } else {