relaton-bipm 1.13.4 → 1.13.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_bipm/bipm_bibliography.rb +3 -2
- data/lib/relaton_bipm/data_fetcher.rb +39 -13
- data/lib/relaton_bipm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44b5e29b765a1c5abb4e7d1e30f25924a3aba14462c654da9926e91b4c60c040
|
4
|
+
data.tar.gz: 772df92aa9bfd854f0228bfeaaf0edcda9665a5cf10237ff5bca89a9276f285e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 041beb9bc400b47198472a9ffab00427f3d08bae04121360527d8810354406a67602f68daff60e3ee16e9e195d37d33d0ce968f20b96f4005a5796d1e6caf200
|
7
|
+
data.tar.gz: e509099ba765739a5792f9f56ba58e6e93beb1e84b7f31e0f9cec09e95d34e70b4bd099a427640d5bab4800f138587930dd11a446f88149cb9f0004d14d2a29a
|
@@ -25,6 +25,7 @@ module RelatonBipm
|
|
25
25
|
end
|
26
26
|
|
27
27
|
warn("[relaton-bipm] (\"#{text}\") found #{item.docidentifier[0].id}")
|
28
|
+
item.fetched = Date.today.to_s
|
28
29
|
item
|
29
30
|
rescue Mechanize::ResponseCodeError => e
|
30
31
|
raise RelatonBib::RequestError, e.message unless e.response_code == "404"
|
@@ -226,8 +227,8 @@ module RelatonBipm
|
|
226
227
|
link = rsp.at("//div[@class='indexer'][.='#{art}']/../div/a")
|
227
228
|
unless link
|
228
229
|
arts = rsp.xpath("//div[@class='indexer']").map(&:text)
|
229
|
-
warn "[relaton-bipm]
|
230
|
-
warn "[relaton-bipm]
|
230
|
+
warn "[relaton-bipm] No article is available at the specified start page \"#{art}\" in issue \"BIPM Metrologia #{vol} #{ish}\"."
|
231
|
+
warn "[relaton-bipm] Available articles in the issue start at the following pages: (#{arts.join(', ')})"
|
231
232
|
return
|
232
233
|
end
|
233
234
|
|
@@ -68,7 +68,6 @@ module RelatonBipm
|
|
68
68
|
doc = docstd.at "/bibdata"
|
69
69
|
hash1 = RelatonBipm::XMLParser.from_xml(doc.to_xml).to_hash
|
70
70
|
fix_si_brochure_id hash1
|
71
|
-
hash1["fetched"] = Date.today.to_s
|
72
71
|
outfile = File.join @output, File.basename(f).sub(/(?:-(?:en|fr))?\.rxl$/, ".yaml")
|
73
72
|
@index[[hash1["docnumber"] || File.basename(outfile, ".yaml")]] = outfile
|
74
73
|
hash = if File.exist? outfile
|
@@ -178,7 +177,7 @@ module RelatonBipm
|
|
178
177
|
file = "#{num}.yaml"
|
179
178
|
path = File.join dir, file
|
180
179
|
link = "https://raw.githubusercontent.com/relaton/relaton-data-bipm/master/#{path}"
|
181
|
-
hash = bibitem type: type, en: en_md, fr: fr_md, id: id, num: num, src: src, pdf: en["pdf"]
|
180
|
+
hash = bibitem body: body, type: type, en: en_md, fr: fr_md, id: id, num: num, src: src, pdf: en["pdf"]
|
182
181
|
if @files.include?(path) && part
|
183
182
|
add_part hash, part
|
184
183
|
item = RelatonBipm::BipmBibliographicItem.new(**hash)
|
@@ -190,7 +189,7 @@ module RelatonBipm
|
|
190
189
|
elsif part
|
191
190
|
hash[:title].each { |t| t[:content] = t[:content].sub(/\s\(.+\)$/, "") }
|
192
191
|
hash[:link] = [{ type: "src", content: link }]
|
193
|
-
h = bibitem type: type, en: en_md, fr: fr_md, id: id, num: num, src: src, pdf: en["pdf"]
|
192
|
+
h = bibitem body: body, type: type, en: en_md, fr: fr_md, id: id, num: num, src: src, pdf: en["pdf"]
|
194
193
|
add_part h, part
|
195
194
|
part_item = RelatonBipm::BipmBibliographicItem.new(**h)
|
196
195
|
part_item_path = File.join dir, "#{num}-#{part}.yaml"
|
@@ -219,7 +218,7 @@ module RelatonBipm
|
|
219
218
|
def fetch_resolution(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
220
219
|
args[:en]["resolutions"].each.with_index do |r, i| # rubocop:disable Metrics/BlockLength
|
221
220
|
hash = {
|
222
|
-
type: "proceedings",
|
221
|
+
type: "proceedings", title: [],
|
223
222
|
doctype: r["type"], place: [RelatonBib::Place.new(city: "Paris")]
|
224
223
|
}
|
225
224
|
hash[:title] << title(r["title"], "en") if r["title"]
|
@@ -252,10 +251,7 @@ module RelatonBipm
|
|
252
251
|
hash[:link] << { type: "pdf", content: r["reference"] } if r["reference"]
|
253
252
|
hash[:language] = %w[en fr]
|
254
253
|
hash[:script] = ["Latn"]
|
255
|
-
hash[:contributor] = [
|
256
|
-
entity: { url: "www.bipm.org", name: "Bureau International des Poids et Mesures", abbreviation: "BIPM" },
|
257
|
-
role: [{ type: "publisher" }],
|
258
|
-
}]
|
254
|
+
hash[:contributor] = contributors date, args[:body]
|
259
255
|
hash[:structuredidentifier] = RelatonBipm::StructuredIdentifier.new docnumber: num
|
260
256
|
item = RelatonBipm::BipmBibliographicItem.new(**hash)
|
261
257
|
file = year
|
@@ -269,6 +265,39 @@ module RelatonBipm
|
|
269
265
|
end
|
270
266
|
end
|
271
267
|
|
268
|
+
def contributors(date, body) # rubocop:disable Metrics/MethodLength
|
269
|
+
if body == "CCTF" && Date.parse(date).year < 1999
|
270
|
+
authors = [{
|
271
|
+
name: [
|
272
|
+
{ content: "Consultative Committee for the Definition of the Second",
|
273
|
+
language: "en", script: "Latn" },
|
274
|
+
{ content: "Comité Consultatif pour la Définition de la Seconde",
|
275
|
+
language: "fr", script: "Latn" },
|
276
|
+
],
|
277
|
+
abbreviation: { content: "CCDS", language: ["en", "fr"], script: "Latn" },
|
278
|
+
}]
|
279
|
+
elsif body == "CCTF"
|
280
|
+
authors = [{
|
281
|
+
name: [
|
282
|
+
{ content: "Consultative Committee for Time and Frequency",
|
283
|
+
language: "en", script: "Latn" },
|
284
|
+
{ content: "Comité consultatif du temps et des fréquences",
|
285
|
+
language: "fr", script: "Latn" },
|
286
|
+
],
|
287
|
+
abbreviation: { content: body, language: ["en", "fr"], script: "Latn" },
|
288
|
+
}]
|
289
|
+
else authors = []
|
290
|
+
end
|
291
|
+
authors.reduce(
|
292
|
+
[{ entity: {
|
293
|
+
url: "www.bipm.org",
|
294
|
+
name: "Bureau International des Poids et Mesures",
|
295
|
+
abbreviation: "BIPM",
|
296
|
+
},
|
297
|
+
role: [{ type: "publisher" }] }],
|
298
|
+
) { |a, e| a << { entity: e, role: [{ type: "author" }] } }
|
299
|
+
end
|
300
|
+
|
272
301
|
def title(content, language)
|
273
302
|
{ content: content, language: language, script: "Latn" }
|
274
303
|
end
|
@@ -304,7 +333,7 @@ module RelatonBipm
|
|
304
333
|
#
|
305
334
|
def bibitem(**args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
|
306
335
|
hash = { title: [], type: "proceedings", doctype: args[:type],
|
307
|
-
|
336
|
+
place: [RelatonBib::Place.new(city: "Paris")] }
|
308
337
|
hash[:title] << title(args[:en]["title"], "en") if args[:en]["title"]
|
309
338
|
hash[:title] << title(args[:fr]["title"], "fr") if args[:fr]["title"]
|
310
339
|
hash[:date] = [{ type: "published", on: args[:en]["date"] }]
|
@@ -320,10 +349,7 @@ module RelatonBipm
|
|
320
349
|
hash[:link] += args[:src] if args[:src]&.any?
|
321
350
|
hash[:language] = %w[en fr]
|
322
351
|
hash[:script] = ["Latn"]
|
323
|
-
hash[:contributor] = [
|
324
|
-
entity: { url: "www.bipm.org", name: "Bureau International des Poids et Mesures", abbreviation: "BIPM" },
|
325
|
-
role: [{ type: "publisher" }],
|
326
|
-
}]
|
352
|
+
hash[:contributor] = contributors args[:en]["date"], args[:body]
|
327
353
|
hash[:structuredidentifier] = RelatonBipm::StructuredIdentifier.new docnumber: args[:num]
|
328
354
|
hash
|
329
355
|
end
|
data/lib/relaton_bipm/version.rb
CHANGED
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.13.
|
4
|
+
version: 1.13.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|