From 7dd9f0bfff53a149e837b410329ed40a395dac26 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:10:39 +0200 Subject: [PATCH] doi volume + locale --- app/models/concerns/with_citations.rb | 16 ++++++++-------- app/models/research/journal/paper.rb | 4 +++- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/models/concerns/with_citations.rb b/app/models/concerns/with_citations.rb index 3ebef124d..ace51af13 100644 --- a/app/models/concerns/with_citations.rb +++ b/app/models/concerns/with_citations.rb @@ -1,23 +1,23 @@ module WithCitations extend ActiveSupport::Concern - def citation_apa(website: nil) - citation_for("apa", website: website) + def citation_apa(website: nil, locale: nil) + citation_for("apa", website: website, locale: locale) end - def citation_iso690(website: nil) - citation_for("iso690-author-date-fr-no-abstract", website: website) + def citation_iso690(website: nil, locale: nil) + citation_for("iso690-author-date-fr-no-abstract", website: website, locale: locale) end - def citation_mla(website: nil) - citation_for("modern-language-association", website: website) + def citation_mla(website: nil, locale: nil) + citation_for("modern-language-association", website: website, locale: locale) end protected - def citation_for(style, website: nil) + def citation_for(style, website: nil, locale: nil) citeproc = to_citeproc(website: website) - processor = CiteProc::Processor.new style: style, format: 'text' + processor = CiteProc::Processor.new style: style, format: 'text', locale: locale processor.import([citeproc]) processor.render(:bibliography, id: citeproc["id"]).first end diff --git a/app/models/research/journal/paper.rb b/app/models/research/journal/paper.rb index dacacb04f..0b489feb5 100644 --- a/app/models/research/journal/paper.rb +++ b/app/models/research/journal/paper.rb @@ -113,8 +113,10 @@ class Research::Journal::Paper < ApplicationRecord { "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, - "publisher" => university.name, + "volume" => volume&.number, + # "publisher" => university.name, "keywords" => keywords, "pdf" => pdf.attached? ? pdf.url : nil, "month-numeric" => published_at.present? ? published_at.month.to_s : nil, -- GitLab