relaton-bipm 1.13.1 → 1.13.2
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 +4 -4
- data/lib/relaton_bipm/data_fetcher.rb +19 -6
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm/xml_parser.rb +0 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8684961db2e3b70deffa9ba3a943ac4ce4990edd0b00a0e5311c0d92ca61f344
|
4
|
+
data.tar.gz: 4d585b8f37043d19e14bf2bf9f1a9ee32186978f86db61a9fa2aade824171133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
92
|
-
|
93
|
-
|
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
|
-
|
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
|
#
|
data/lib/relaton_bipm/version.rb
CHANGED
@@ -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]
|