Skip to content

Commit

Permalink
improve journal-article crossrefxml
Browse files Browse the repository at this point in the history
  • Loading branch information
mfenner committed May 15, 2024
1 parent 5b497b4 commit 578c219
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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) {
cmd.Println("Commonmeta v0.3.15 -- HEAD")
cmd.Println("Commonmeta v0.3.16 -- HEAD")
},
}

Expand Down
2 changes: 1 addition & 1 deletion crossrefxml/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ type Archive struct {
type ArchiveLocations struct {
XMLName xml.Name `xml:"archive_locations"`
Text string `xml:",chardata"`
Archive []Archive `xml:"archive"`
Archive []Archive `xml:"archive,omitempty"`
}

type Assertion struct {
Expand Down
21 changes: 11 additions & 10 deletions crossrefxml/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ func Convert(data commonmeta.Data) (Body, error) {
}
}

var issn []ISSN
if data.Container.IdentifierType == "issn" {
issn = append(issn, ISSN{
MediaType: "electronic",
Text: data.Container.Identifier,
})
}

doiData := DOIData{
DOI: doi,
Resource: data.URL,
Expand Down Expand Up @@ -380,10 +388,6 @@ func Convert(data commonmeta.Data) (Body, error) {
CitationList: citationList,
})
case "JournalArticle":
// var issn string
// if len(data.Container.Identifier) > 0 {
// issn = data.Container.Identifier[0].Identifier
// }
c.Journal = append(c.Journal, Journal{
JournalArticle: JournalArticle{
PublicationType: "full_text",
Expand All @@ -397,27 +401,24 @@ func Convert(data commonmeta.Data) (Body, error) {
// },
DOIData: doiData,
// Pages:
// Program: program,
Program: program,
// PublicationDate: data.Date.Published,
// PublisherItem: PublisherItem{
// ItemNumber: itemNumber,
// },
Titles: titles,
},
JournalMetadata: JournalMetadata{
Language: data.Language,
FullTitle: data.Container.Title,
//ISSN: []string{issn},
Language: data.Language,
ISSN: issn,
},
JournalIssue: JournalIssue{
JournalVolume: JournalVolume{
Volume: data.Container.Volume,
},
Issue: data.Container.Issue,
},
// JournalVolume: JournalVolume{
// Volume: data.Container.Volume,
// },
})
case "PeerReview":
c.PeerReview = append(c.PeerReview, PeerReview{})
Expand Down

0 comments on commit 578c219

Please sign in to comment.