relaton-bipm 1.20.3 → 1.20.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: 3d1539848f18eda46cb7357eb8861594434a26b7248878477b9430ae09aabcac
4
- data.tar.gz: f06a0572b5a70a5fd1d4457d731fac35458372f728f14ec2794bcaf6d73ab6c7
3
+ metadata.gz: 4f22d6e95a7abfb3746767ce7563d0e92a562856d3e8ced8831a77fa05624349
4
+ data.tar.gz: 2c30572b6d1f260dc51c7fa280dd56a79565b8d30bfed8c4d60537a73bb95ebf
5
5
  SHA512:
6
- metadata.gz: 2e42be1fbbc4f9971c688b83a9f3e9de80a4a529be73699c11efb9c095471072cd73f07aaf39b0f94964446e2dbd1a76d16f530cc72d6ee5f45c4ba53c083477
7
- data.tar.gz: 9565d9d1069aee7a2029af710d60d39c8c0f0ddfd9b0b2f4bda900f7befb4c5b5580d8acafb1d45bd15776db922026451c7b32e5f42f47d4f73900e6fce4097e
6
+ metadata.gz: 15f75a91447405b02707631ca6a3e744d62ef623767da504f08f0a33a0f770bb0731cdc03cde57769871bb4ab2e1c662ad79dcfa4c6a21e6f9a883b1cc05bd87
7
+ data.tar.gz: efd882bc871d9fb20cb1305bc0ff1a9e6f90a57ceb4cb1a419e0358c54d3c498b54cacf7821df6baf82948a2544483cdbb17fdf7114480252f27b5b7e650578b
@@ -59,20 +59,34 @@ module RelatonBipm
59
59
  #
60
60
  # @return [void]
61
61
  #
62
- def fix_si_brochure_id(hash) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
62
+ def fix_si_brochure_id(hash)
63
63
  # isbn = hash["docid"].detect { |id| id["type"] == "ISBN" }
64
64
  # num = isbn && isbn["id"] == "978-92-822-2272-0" ? "SI Brochure" : "SI Brochure, Appendix 4"
65
65
 
66
+ update_id hash
67
+
68
+ prid = primary_id hash
69
+ if hash["docnumber"]
70
+ hash["docnumber"].sub!(/^Brochure(?:\sConcise|\sFAQ)?$/i, prid.sub(/^BIPM\s/, ""))
71
+ else
72
+ hash["docnumber"] = prid.sub(/^BIPM\s/, "")
73
+ end
74
+ hash["id"] = prid.gsub(/[,\s]/, "")
75
+ end
76
+
77
+ def update_id(hash)
66
78
  hash["docid"].each do |id|
67
79
  next unless id["type"] == "BIPM" && id["id"].match?(/BIPM Brochure/i)
68
80
 
69
81
  id["primary"] = true
70
82
  id["id"].sub!(/(?<=^BIPM\s)(Brochure)/i, "SI \\1")
71
83
  end
84
+ end
72
85
 
73
- num = hash["docid"].detect { |id| id["primary"] && id["language"] == "en" }["id"]
74
- hash["docnumber"].sub!(/^Brochure$/i, num.sub(/^BIPM\s/, ""))
75
- hash["id"] = num.gsub(/[,\s]/, "")
86
+ def primary_id(hash)
87
+ hash["docid"].detect do |id|
88
+ id["primary"] && (id["language"] == "en" || id["language"].nil?)
89
+ end["id"]
76
90
  end
77
91
 
78
92
  #
@@ -91,7 +91,7 @@ module RelatonBipm
91
91
  #
92
92
  def parse(id)
93
93
  # str = StringScanner.new id
94
- match = parse_outcome(id) || parse_brochure(id) || parse_brochure_other(id) || parse_metrologia(id) || parse_jcgm(id)
94
+ match = parse_outcome(id) || parse_brochure(id) || parse_metrologia(id) || parse_jcgm(id)
95
95
  @id = match.named_captures.compact.transform_keys(&:to_sym)
96
96
  self
97
97
  rescue StandardError => e
@@ -127,9 +127,13 @@ module RelatonBipm
127
127
  def num_and_year; "(?:(?:#{number}\\s)?#{year_lang}|#{year}-#{number}|#{number})"; end
128
128
 
129
129
  def parse_brochure(id)
130
+ parse_si_brochure(id) || parse_brochure_other(id)
131
+ end
132
+
133
+ def parse_si_brochure(id)
130
134
  %r{^
131
135
  (?<group>SI)\s(?<type>Brochure)
132
- (?:,?\s(?:(?:Part|Partie)\s(?<part>\d+)|(?:Appendix|Annexe)\s(?<append>\d+)))?
136
+ (?:,?\s(?:(?:Part|Partie)\s(?<part>\d+)|(?:Appendix|Annexe)\s(?<append>\d+)|(?<number>Concise|FAQ)))?
133
137
  $}x.match(id)
134
138
  end
135
139
 
@@ -330,7 +330,7 @@ module RelatonBipm
330
330
  # @return [Array<RelatonBib::Extent>] array of extents
331
331
  #
332
332
  def parse_extent
333
- @meta.xpath("./volume|./issue|./fpage").map do |e|
333
+ locs = @meta.xpath("./volume|./issue|./fpage").map do |e|
334
334
  if e.name == "fpage"
335
335
  type = "page"
336
336
  to = @meta.at("./lpage")&.text
@@ -339,6 +339,7 @@ module RelatonBipm
339
339
  end
340
340
  RelatonBib::Locality.new type, e.text, to
341
341
  end
342
+ [RelatonBib::Extent.new(locs)]
342
343
  # %w[volume issue page].map.with_index do |t, i|
343
344
  # RelatonBib::Locality.new t, volume_issue_page[i]
344
345
  # end
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.20.3".freeze
2
+ VERSION = "1.20.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.3
4
+ version: 1.20.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-19 00:00:00.000000000 Z
11
+ date: 2025-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.3.27
168
+ rubygems_version: 3.5.22
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: 'RelatonBipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem