bolognese 2.3.9 → 2.5.0

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: 5490a2fbec4b0acaad6edf965cd5a7c27a9b9edc2e0f9c2e8bc1041e1f8701d8
4
- data.tar.gz: d74808cfadf7fbc3469c56a248479d23526ad34d32af4e75bffb843846055bee
3
+ metadata.gz: 3f0239c99410f1942496bd26e40c9fe98884e7b850bafad0c20af747073d8828
4
+ data.tar.gz: a154ee1f051aeb20ab12f4131bff2776e77db6d9241af3940d70e80761fdf4bd
5
5
  SHA512:
6
- metadata.gz: a7e9f5e56b9c1c5429bb32174b1392e46fb83208f07106f20ca56c86fe8f25847d7308cd490c897752b9812cabc934b0cac59b6f1d136340b50eb7635a24c37d
7
- data.tar.gz: 34caaba62200f9e8c203f8e55d97acb3423e9f4d865c6726dc81aae3de2b15934cdef9cc26ae7dc6cf619baf63ee5cdbb5b6d5d6f50f307407fcb3c40a34765a
6
+ metadata.gz: d7fbdfd38162ac2d47143f2a296a6ec7d3a7d8799ec1c6d1b8b15bfaa6257bb4b19b13acb64b0abee782efb4f058ab96293705c106b75344c93110008ffdbe6a
7
+ data.tar.gz: 65a3c6ded83c62d019520a1dfd936ce0a23251679458cd2669e106541adcb506ced58e879d634579495ecdb16cda2e78684567b7232c34d861690700a3598743
@@ -7,7 +7,7 @@ jobs:
7
7
  strategy:
8
8
  fail-fast: false
9
9
  matrix:
10
- ruby: ["3.0", "3.1", "3.2", "3.3"]
10
+ ruby: ["3.1", "3.2", "3.3"]
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v3
@@ -11,10 +11,10 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v3
14
- - name: Set up Ruby 3.1.4
14
+ - name: Set up Ruby
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
- ruby-version: "3.1.4"
17
+ ruby-version: "3.2.9"
18
18
 
19
19
  - name: Build
20
20
  run: |
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (2.3.9)
5
- activesupport (>= 4.2.5)
4
+ bolognese (2.5.0)
5
+ activesupport (= 7.2.3)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
8
8
  builder (~> 3.2, >= 3.2.2)
@@ -29,17 +29,26 @@ PATH
29
29
  GEM
30
30
  remote: https://rubygems.org/
31
31
  specs:
32
- activesupport (6.1.7.3)
33
- concurrent-ruby (~> 1.0, >= 1.0.2)
32
+ activesupport (7.2.3)
33
+ base64
34
+ benchmark (>= 0.3)
35
+ bigdecimal
36
+ concurrent-ruby (~> 1.0, >= 1.3.1)
37
+ connection_pool (>= 2.2.5)
38
+ drb
34
39
  i18n (>= 1.6, < 2)
40
+ logger (>= 1.4.2)
35
41
  minitest (>= 5.1)
36
- tzinfo (~> 2.0)
37
- zeitwerk (~> 2.3)
42
+ securerandom (>= 0.3)
43
+ tzinfo (~> 2.0, >= 2.0.5)
38
44
  addressable (2.8.1)
39
45
  public_suffix (>= 2.0.2, < 6.0)
46
+ base64 (0.3.0)
47
+ benchmark (0.5.0)
40
48
  benchmark_methods (0.7)
41
49
  bibtex-ruby (6.0.0)
42
50
  latex-decode (~> 0.0)
51
+ bigdecimal (3.3.1)
43
52
  builder (3.2.4)
44
53
  byebug (11.1.3)
45
54
  citeproc (1.0.10)
@@ -48,7 +57,8 @@ GEM
48
57
  citeproc (~> 1.0, >= 1.0.9)
49
58
  csl (~> 1.6)
50
59
  colorize (0.8.1)
51
- concurrent-ruby (1.2.2)
60
+ concurrent-ruby (1.3.5)
61
+ connection_pool (2.5.5)
52
62
  crack (0.4.5)
53
63
  rexml
54
64
  crass (1.0.6)
@@ -59,6 +69,7 @@ GEM
59
69
  csl (~> 1.0)
60
70
  diff-lcs (1.5.0)
61
71
  docile (1.4.0)
72
+ drb (2.2.3)
62
73
  ebnf (2.3.3)
63
74
  htmlentities (~> 4.3)
64
75
  rdf (~> 3.2)
@@ -111,6 +122,7 @@ GEM
111
122
  optimist (~> 3)
112
123
  latex-decode (0.4.0)
113
124
  link_header (0.0.8)
125
+ logger (1.7.0)
114
126
  loofah (2.21.3)
115
127
  crass (~> 1.0.2)
116
128
  nokogiri (>= 1.12.0)
@@ -194,6 +206,7 @@ GEM
194
206
  rspec (~> 3)
195
207
  ruby2_keywords (0.0.5)
196
208
  scanf (1.0.0)
209
+ securerandom (0.4.1)
197
210
  simplecov (0.17.1)
198
211
  docile (~> 1.1)
199
212
  json (>= 1.8, < 3)
@@ -214,7 +227,6 @@ GEM
214
227
  addressable (>= 2.8.0)
215
228
  crack (>= 0.3.2)
216
229
  hashdiff (>= 0.4.0, < 2.0.0)
217
- zeitwerk (2.6.8)
218
230
  zlib (2.1.1)
219
231
 
220
232
  PLATFORMS
data/bolognese.gemspec CHANGED
@@ -13,15 +13,14 @@ Gem::Specification.new do |s|
13
13
  s.version = Bolognese::VERSION
14
14
  s.extra_rdoc_files = ["README.md"]
15
15
  s.license = 'MIT'
16
- s.required_ruby_version = ['>=3.0']
16
+ s.required_ruby_version = ['>= 3.1', '<= 3.3.10']
17
17
 
18
18
  # Declare dependencies here, rather than in the Gemfile
19
19
  s.add_dependency 'maremma', '~> 5.0'
20
- #s.add_dependency 'faraday', '~> 0.17.3'
21
20
  s.add_dependency 'nokogiri', '~> 1.16', '>= 1.16.2'
22
21
  s.add_dependency 'loofah', '~> 2.0', '>= 2.0.3'
23
22
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
24
- s.add_dependency 'activesupport', '>= 4.2.5'
23
+ s.add_dependency 'activesupport', '7.2.3'
25
24
  s.add_dependency 'bibtex-ruby', '>= 5.1.0'
26
25
  s.add_dependency 'thor', '>= 0.19'
27
26
  s.add_dependency 'colorize', '~> 0.8.1'
@@ -337,7 +337,7 @@ module Bolognese
337
337
  return xml unless descriptions.present? || container && container["title"].present?
338
338
 
339
339
  xml.descriptions do
340
- if container && container["title"].present?
340
+ if (respond_to?(:from) && !from.to_s.include?("datacite")) && container && container["title"].present?
341
341
  issue = container["issue"].present? ? "(#{container["issue"]})" : nil
342
342
  volume_issue = container["volume"].present? ? [container["volume"], issue].join("") : nil
343
343
  pages = [container["firstPage"], container["lastPage"]].compact.join("-") if container["firstPage"].present?
@@ -5,6 +5,7 @@ require_relative 'metadata_utils'
5
5
  module Bolognese
6
6
  class Metadata
7
7
  include Bolognese::MetadataUtils
8
+ include Bolognese::Utils
8
9
 
9
10
  attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue, :show_errors
10
11
  attr_reader :doc, :page_start, :page_end
@@ -205,7 +206,9 @@ module Bolognese
205
206
  end
206
207
 
207
208
  def container
208
- @container ||= meta.fetch("container", nil)
209
+ @container ||= begin
210
+ generate_container(types, related_items, related_identifiers, descriptions) || meta.fetch("container", nil)
211
+ end
209
212
  end
210
213
 
211
214
  def geo_locations
@@ -153,15 +153,21 @@ module Bolognese
153
153
  "language" => language,
154
154
  "author" => author,
155
155
  "contributor" => to_citeproc(contributors),
156
+ "editor" => contributors ? to_citeproc(contributors.select { |c| c["contributorType"] == "Editor" }) : nil,
156
157
  "translator" => contributors ? to_citeproc(contributors.select { |c| c["contributorType"] == "Translator" }) : nil,
157
158
  "issued" => get_date(dates, "Issued") ? get_date_parts(get_date(dates, "Issued")) : get_date_parts(publication_year.to_s),
158
159
  "submitted" => Array.wrap(dates).find { |d| d["dateType"] == "Submitted" }.to_h.fetch("__content__", nil),
160
+ "available-date" => Array.wrap(dates).find { |d| d["dateType"] == "Available" }.to_h.fetch("__content__", nil),
159
161
  "abstract" => parse_attributes(descriptions, content: "description", first: true),
160
162
  "container-title" => container_title,
161
163
  "DOI" => doi,
162
164
  "volume" => container.to_h["volume"],
163
165
  "issue" => container.to_h["issue"],
166
+ "number" => container.to_h["number"],
167
+ "chapter-number" => container.to_h["chapterNumber"],
168
+ "edition" => container.to_h["edition"],
164
169
  "page" => page,
170
+ "page-first" => container.to_h["firstPage"],
165
171
  "publisher" => publisher["name"],
166
172
  "title" => parse_attributes(titles, content: "title", first: true),
167
173
  "URL" => url,
@@ -298,7 +298,6 @@ module Bolognese
298
298
  "titles" => titles,
299
299
  "creators" => get_authors(Array.wrap(meta.dig("creators", "creator"))),
300
300
  "contributors" => get_authors(Array.wrap(meta.dig("contributors", "contributor"))),
301
- "container" => set_container(meta),
302
301
  "publisher" => publisher,
303
302
  "agency" => "datacite",
304
303
  "funding_references" => funding_references,
@@ -319,28 +318,6 @@ module Bolognese
319
318
  }.merge(read_options)
320
319
  end
321
320
 
322
- def set_container(meta)
323
- series_information = Array.wrap(meta.dig("descriptions", "description")).find { |r| r["descriptionType"] == "SeriesInformation" }.to_h.fetch("__content__", nil)
324
- si = get_series_information(series_information)
325
-
326
- is_part_of = Array.wrap(meta.dig("relatedIdentifiers", "relatedIdentifier")).find { |ri| ri["relationType"] == "IsPartOf" }.to_h
327
-
328
- if si["title"].present? || is_part_of.present?
329
- {
330
- "type" => meta.dig("resourceType", "resourceTypeGeneral") == "Dataset" ? "DataRepository" : "Series",
331
- "identifier" => is_part_of["__content__"],
332
- "identifierType" => is_part_of["relatedIdentifierType"],
333
- "title" => si["title"],
334
- "volume" => si["volume"],
335
- "issue" => si["issue"],
336
- "firstPage" => si["firstPage"],
337
- "lastPage" => si["lastPage"]
338
- }.compact
339
- else
340
- {}
341
- end
342
- end
343
-
344
321
  def get_titles(meta)
345
322
  titles = Array.wrap(meta.dig("titles", "title")).map do |r|
346
323
  if r.blank?
@@ -1434,5 +1434,47 @@ module Bolognese
1434
1434
  # Fetch the first description with descriptionType "Abstract"
1435
1435
  Array.wrap(descriptions)&.find { |d| d["descriptionType"] == "Abstract" }
1436
1436
  end
1437
+
1438
+ def generate_container(types, related_items, related_identifiers, descriptions)
1439
+ container_type = (types.respond_to?(:dig) && types&.dig("resourceTypeGeneral")) == "Dataset" ? "DataRepository" : "Series"
1440
+
1441
+ # relatedItem container
1442
+ related_item = Array.wrap(related_items).find { |ri| ri["relationType"] == "IsPublishedIn" }.to_h
1443
+
1444
+ if related_item.present?
1445
+ return {
1446
+ "type" => container_type,
1447
+ "identifier" => related_item.dig("relatedItemIdentifier", "relatedItemIdentifier"),
1448
+ "identifierType" => related_item.dig("relatedItemIdentifier", "relatedItemIdentifierType"),
1449
+ "title" => related_item.dig("titles", 0).then { |t| t ? parse_attributes(t, content: "title", first: true) : nil },
1450
+ "volume" => related_item["volume"],
1451
+ "issue" => related_item["issue"],
1452
+ "edition" => related_item["edition"],
1453
+ "number" => related_item["number"],
1454
+ "chapterNumber" => related_item["numberType"] == "Chapter" ? related_item["number"] : nil,
1455
+ "firstPage" => related_item["firstPage"],
1456
+ "lastPage" => related_item["lastPage"]
1457
+ }.compact
1458
+ end
1459
+
1460
+ # Legacy SeriesInformation/relatedIdentifier container fallback
1461
+ series_information = Array.wrap(descriptions).find { |r| r["descriptionType"] == "SeriesInformation" }.to_h.fetch("description", nil)
1462
+ si = get_series_information(series_information)
1463
+
1464
+ is_part_of = Array.wrap(related_identifiers).find { |ri| ri["relationType"] == "IsPartOf" }.to_h
1465
+
1466
+ if si["title"].present?
1467
+ return {
1468
+ "type" => container_type,
1469
+ "identifier" => is_part_of["relatedIdentifier"],
1470
+ "identifierType" => is_part_of["relatedIdentifierType"],
1471
+ "title" => si["title"],
1472
+ "volume" => si["volume"],
1473
+ "issue" => si["issue"],
1474
+ "firstPage" => si["firstPage"],
1475
+ "lastPage" => si["lastPage"]
1476
+ }.compact
1477
+ end
1478
+ end
1437
1479
  end
1438
1480
  end
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "2.3.9"
2
+ VERSION = "2.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.9
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-15 00:00:00.000000000 Z
11
+ date: 2026-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -88,16 +88,16 @@ dependencies:
88
88
  name: activesupport
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
91
+ - - '='
92
92
  - !ruby/object:Gem::Version
93
- version: 4.2.5
93
+ version: 7.2.3
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ">="
98
+ - - '='
99
99
  - !ruby/object:Gem::Version
100
- version: 4.2.5
100
+ version: 7.2.3
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: bibtex-ruby
103
103
  requirement: !ruby/object:Gem::Requirement
@@ -796,14 +796,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
796
796
  requirements:
797
797
  - - ">="
798
798
  - !ruby/object:Gem::Version
799
- version: '3.0'
799
+ version: '3.1'
800
+ - - "<="
801
+ - !ruby/object:Gem::Version
802
+ version: 3.3.10
800
803
  required_rubygems_version: !ruby/object:Gem::Requirement
801
804
  requirements:
802
805
  - - ">="
803
806
  - !ruby/object:Gem::Version
804
807
  version: '0'
805
808
  requirements: []
806
- rubygems_version: 3.3.26
809
+ rubygems_version: 3.4.19
807
810
  signing_key:
808
811
  specification_version: 4
809
812
  summary: Ruby client library for conversion of DOI Metadata