relaton-bipm 1.13.1 → 1.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edb89c4c5c98e541ba6c2b6dceb5e3c0133679d3058c88a28a873ef24a4b132d
4
- data.tar.gz: f73db142b9080babed9748cb846e803dd2b8fbe76764d644ce072f2d614be704
3
+ metadata.gz: 8684961db2e3b70deffa9ba3a943ac4ce4990edd0b00a0e5311c0d92ca61f344
4
+ data.tar.gz: 4d585b8f37043d19e14bf2bf9f1a9ee32186978f86db61a9fa2aade824171133
5
5
  SHA512:
6
- metadata.gz: 9252968e4aafe5721c843620e3515046f5360f6e1b492f341fe951314ed7de7894941052959a6c9c4a0bda18eba4cdbac47857fa58a4c0065199540128215253
7
- data.tar.gz: 434e30bc8487085bf50d69b3be05443e53e235e813ba0a14937531a46b635a2eaa6fd919db4b1d21a2f96943c97a981b7704409963c8b77dd14f540b384dacc7
6
+ metadata.gz: f426fa79bd1c71061fe411ff764435817c49d0a9c9e56333304ae54390a6f20384dbdaf40fba7e19062c3618ca212fbd2d21dc3180ee461f75d0d2f5d6c6ffe3
7
+ data.tar.gz: 0b7b9707e8cd16955591edd14592bc59550cb0efb21cfcdceacd5733a471af0d4b8ee4ec39138e8ae6653f22e006144195e1ab8e1a685e95199f2f6408ebdee5
@@ -63,8 +63,6 @@ module RelatonBipm
63
63
  # puts "Ls #{Dir['bipm-si-brochure/site/*']}"
64
64
  # puts "Ls #{Dir['bipm-si-brochure/site/documents/*']}"
65
65
  Dir["bipm-si-brochure/site/documents/*.rxl"].each do |f|
66
- next if f.include?("sib-a4")
67
-
68
66
  puts "Parsing #{f}"
69
67
  docstd = Nokogiri::XML File.read f
70
68
  doc = docstd.at "/bibdata"
@@ -88,12 +86,27 @@ module RelatonBipm
88
86
  end
89
87
  end
90
88
 
91
- def fix_si_brochure_id(hash)
92
- hash["id"] = hash["id"].sub(/^BIPMBrochure$/, "BIPMSIBrochure")
93
- hash["docnumber"] = hash["docnumber"].sub(/^Brochure$/i, "SI Brochure")
89
+ #
90
+ # Update ID of SI brochure
91
+ #
92
+ # @param [Hash] hash hash of bibitem
93
+ #
94
+ # @return [void]
95
+ #
96
+ def fix_si_brochure_id(hash) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
94
97
  did = hash["docid"].detect { |id| id["type"] == "BIPM" }
95
98
  did["primary"] = true
96
- did["id"] = did["id"].sub(/^BIPM Brochure$/, "BIPM SI Brochure")
99
+ return unless did["id"] == "BIPM Brochure"
100
+
101
+ isbn = hash["docid"].detect { |id| id["type"] == "ISBN" }
102
+ num = if isbn && isbn["id"] == "978-92-822-2272-0"
103
+ "SI Brochure"
104
+ else
105
+ "SI Brochure, Appendix 4"
106
+ end
107
+ hash["id"] = hash["id"].sub(/(?<=^BIPM)Brochure$/i, num.gsub(/[,\s]/, ""))
108
+ hash["docnumber"] = hash["docnumber"].sub(/^Brochure$/i, num)
109
+ did["id"] = did["id"].sub(/(?<=^BIPM\s)Brochure$/i, num)
97
110
  end
98
111
 
99
112
  #
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.13.1".freeze
2
+ VERSION = "1.13.2".freeze
3
3
  end
@@ -23,17 +23,6 @@ module RelatonBipm
23
23
  BipmBibliographicItem.new(**item_hash)
24
24
  end
25
25
 
26
- # @param item [Nokogiri::XML::Element]
27
- # @return [Array<RelatonBib::FormattedString>]
28
- def fetch_titles(item)
29
- item.xpath("./title").map do |t|
30
- RelatonBib::TypedTitleString.new(
31
- content: t.text, language: t[:language], script: t[:script],
32
- format: t[:format]
33
- )
34
- end
35
- end
36
-
37
26
  def fetch_dates(item) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
38
27
  item.xpath("./date").reduce([]) do |a, d|
39
28
  type = d[:type].to_s.empty? ? "published" : d[:type]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.1
4
+ version: 1.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.