From e310dfc2611870f43dfb114ed76510840627a0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com> Date: Fri, 7 Jul 2023 18:25:46 +0200 Subject: [PATCH] citeproc --- app/models/research/journal/paper.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/models/research/journal/paper.rb b/app/models/research/journal/paper.rb index 952b75be4..5d9ffaef5 100644 --- a/app/models/research/journal/paper.rb +++ b/app/models/research/journal/paper.rb @@ -107,21 +107,24 @@ class Research::Journal::Paper < ApplicationRecord protected def to_citeproc(website: nil) - { + citeproc = { "title" => title, "author" => people.map { |person| { "family" => person.last_name, "given" => person.first_name } }, "URL" => website.url + Communication::Website::Permalink.for_object(self, website).computed_path, - "DOI" => doi.present? ? doi : nil, "container-title" => journal.title, "volume" => volume&.number, "keywords" => keywords, "pdf" => pdf.attached? ? pdf.url : nil, - "month-numeric" => published_at.present? ? published_at.month.to_s : nil, - "issued" => published_at.present? ? { "date-parts" => [[published_at.year, published_at.month]] } : nil, "id" => id } + citeproc["DOI"] = doi if doi.present? + if published_at.present? + citeproc["month-numeric"] = published_at.month.to_s + citeproc["issued"] = { "date-parts" => [[published_at.year, published_at.month]] } + end + citeproc end def other_papers_in_the_volume -- GitLab