briard 2.9.3 → 2.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06c9f718653483604dff7e7c3d71ab30360f443eac5f8e574019ad32ed2e2b41
4
- data.tar.gz: 40e1d84a7163b754a1da8f7ff5f86e5420ea14916ea0a0661de70a6f7115dc48
3
+ metadata.gz: 9ce2b87b6b9a2b937d0ba4ee04cfa69376851ba89d36e475f23ed5a68fbb891f
4
+ data.tar.gz: 13699df8c5c34eaf7660cb49a77bee330b805ff3e68df5c3e67dcf18f91e430a
5
5
  SHA512:
6
- metadata.gz: 6acc897545e269db5bc64c22f6aa660a2c054ccde110b123d01ffe402dbf12b134fb4102767bddde2ed956973940b177aee7ce1660b35ca1c70f2b7cd2ad4e60
7
- data.tar.gz: 5cf21553130a1c05002c019cb0efebd842b8bb7a21fe1b0d02bdd6a10dad330b11076c70b36bf3f6e11fb8cc09cc85bc3607b8eee8e395803212cb304ecdc3a6
6
+ metadata.gz: 79380603529c8c27daafb342c17739fdc9a5ab7cabb0ad52abec052415316ab9cbaefba6ceea76715c1e49a4e3ec21eb23b90030add272f27a470dd825e3d5ac
7
+ data.tar.gz: d074e6e9a9f132707c46b8ba4320f038f06e5229aa95ba14dd67c42e4ccafe14b7191c756ce3c9b9ebada3a00d9b06beb9ed81f559231044b2362e25c27e95e0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- briard (2.9.3)
4
+ briard (2.9.4)
5
5
  activesupport (>= 4.2.5, < 8.0)
6
6
  base32-url (>= 0.5.0, < 1)
7
7
  benchmark_methods (~> 0.7)
@@ -95,21 +95,16 @@ module Briard
95
95
 
96
96
  def insert_crossref_creators(xml)
97
97
  xml.contributors do
98
- Array.wrap(creators).each_with_index do |au, index|
98
+ Array.wrap(creators).each_with_index do |person, index|
99
99
  xml.person_name('contributor_role' => 'author',
100
100
  'sequence' => index.zero? ? 'first' : 'additional') do
101
- insert_crossref_person(xml, au, 'author')
101
+ insert_crossref_person(xml, person)
102
102
  end
103
103
  end
104
104
  end
105
105
  end
106
106
 
107
- def insert_crossref_person(xml, person, _type)
108
- person_name = if person['familyName'].present?
109
- [person['familyName'], person['givenName']].compact.join(', ')
110
- else
111
- person['name']
112
- end
107
+ def insert_crossref_person(xml, person)
113
108
  xml.given_name(person['givenName']) if person['givenName'].present?
114
109
  xml.surname(person['familyName']) if person['familyName'].present?
115
110
  if person.dig('nameIdentifiers', 0, 'nameIdentifierScheme') == 'ORCID'
@@ -60,8 +60,8 @@ module Briard
60
60
  'issn' => issn ? issn['content'] : nil }.compact
61
61
 
62
62
  # workaround if not all authors are included with schema.org (e.g. in Ghost metadata)
63
- authors = doc.css("meta[name='citation_author']").to_a.map do |author|
64
- { 'name' => author['content'] }
63
+ authors = doc.css("meta[name='citation_author']").map do |author|
64
+ { '@type' => 'Person', 'name' => author['content'] }
65
65
  end
66
66
 
67
67
  hsh['author'] = hsh['creator'] if hsh['author'].blank? && hsh['creator'].present?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Briard
4
- VERSION = '2.9.3'
4
+ VERSION = '2.9.4'
5
5
  end
@@ -114,6 +114,8 @@ describe Briard::Metadata, vcr: true do
114
114
  'title' => 'Front Matter', 'type' => 'Blog')
115
115
  expect(subject.titles).to eq([{ 'title' => 'Editorial by more than 200 health journals: Call for emergency action to limit global temperature increases, restore biodiversity, and protect health' }])
116
116
  crossref = Maremma.from_xml(subject.crossref).dig('doi_batch', 'body', 'posted_content')
117
+ expect(Array.wrap(crossref.dig('contributors', 'person_name')).length).to eq(1)
118
+ expect(Array.wrap(crossref.dig('contributors', 'person_name')).first).to eq("ORCID"=>"https://orcid.org/0000-0003-1419-2405", "contributor_role"=>"author", "given_name"=>"Martin", "sequence"=>"first", "surname"=>"Fenner")
117
119
  expect(crossref.dig('titles',
118
120
  'title')).to eq('Editorial by more than 200 health journals: Call for emergency action to limit global temperature increases, restore biodiversity, and protect health')
119
121
  end
@@ -174,6 +176,8 @@ describe Briard::Metadata, vcr: true do
174
176
  'rights' => 'Creative Commons Attribution 4.0 International', 'rightsUri' => 'https://creativecommons.org/licenses/by/4.0/legalcode', 'rightsIdentifier' => 'cc-by-4.0', 'rightsIdentifierScheme' => 'SPDX', 'schemeUri' => 'https://spdx.org/licenses/'
175
177
  }])
176
178
  crossref = Maremma.from_xml(subject.crossref).dig('doi_batch', 'body', 'posted_content')
179
+ expect(Array.wrap(crossref.dig('contributors', 'person_name')).length).to eq(4)
180
+ expect(Array.wrap(crossref.dig('contributors', 'person_name')).first).to eq("contributor_role"=>"author", "given_name"=>"Mohammad", "sequence"=>"first", "surname"=>"Hosseini")
177
181
  expect(crossref.dig('titles',
178
182
  'title')).to eq('Deep dive into ethics of Contributor Roles: report of a FORCE11 workshop')
179
183
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: briard
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.3
4
+ version: 2.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-12 00:00:00.000000000 Z
11
+ date: 2023-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport