diff --git a/lib/bolognese/metadata_utils.rb b/lib/bolognese/metadata_utils.rb index 08830d52..ee1df597 100644 --- a/lib/bolognese/metadata_utils.rb +++ b/lib/bolognese/metadata_utils.rb @@ -154,7 +154,8 @@ def citeproc_hsh "author" => author, "contributor" => to_citeproc(contributors), "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year.to_s), - "submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil), + "submitted" => get_date(dates, "Submitted") ? get_date_parts(get_date(dates, "Submitted")) : nil, + "available-date" => get_date(dates, "Available") ? get_date_parts(get_date(dates, "Available")) : nil, "abstract" => parse_attributes(descriptions, content: "description", first: true), "container-title" => container_title, "DOI" => doi, diff --git a/spec/writers/citeproc_writer_spec.rb b/spec/writers/citeproc_writer_spec.rb index 26e4c758..ab59e213 100644 --- a/spec/writers/citeproc_writer_spec.rb +++ b/spec/writers/citeproc_writer_spec.rb @@ -286,5 +286,25 @@ expect(json["DOI"]).to eq("10.34747/g6yb-3412") expect(json["issued"]).to eq("date-parts"=>[[2019]]) end + + it "arxiv" do + input = "https://doi.org/10.48550/arxiv.2410.00001" + subject = Bolognese::Metadata.new(input: input, from: "datacite") + json = JSON.parse(subject.citeproc) + expect(json["type"]).to eq("article") + expect(json["id"]).to eq("https://doi.org/10.48550/arxiv.2410.00001") + expect(json["DOI"]).to eq("10.48550/arxiv.2410.00001") + expect(json["URL"]).to eq("https://arxiv.org/abs/2410.00001") + expect(json["title"]).to eq("iSurgARy: A mobile augmented reality solution for ventriculostomy in resource-limited settings") + expect(json["author"]).to eq([{"family"=>"Asadi", "given"=>"Zahra"}, + {"family"=>"Castillo", "given"=>"Joshua Pardillo"}, + {"family"=>"Asadi", "given"=>"Mehrdad"}, + {"family"=>"Sinclair", "given"=>"David S."}, + {"family"=>"Kersten-Oertel", "given"=>"Marta"}]) + expect(json["publisher"]).to eq("arXiv") + expect(json["issued"]).to eq("date-parts" => [[2024]]) + expect(json["available-date"]).to eq("date-parts" => [[2024, 10]]) + expect(json["submitted"]).to eq("date-parts" => [[2024, 9, 12]]) + end end end