relaton-bipm 1.12.0 → 1.12.3

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: 34c3cc924311be1a1be33e18480b8521f168e1c72a46976045e9ccba69c38459
4
- data.tar.gz: 4d929d15878f08fd5b696ecbc7fc3b0e5e94ad05e245c5fbc74125cc77ae0b8e
3
+ metadata.gz: b6da8165d7298a3658db3d941f2e0540e61bc53ddd726a79383cc36dc77f1b9a
4
+ data.tar.gz: 6748ecb244655bbbe8ef3226c5f72572d89104f591c256fe3db9f59cd3730b83
5
5
  SHA512:
6
- metadata.gz: 020f3459446a2a48e0d571933811888bfe4fbcd91263c482609de7a34a98df38a27fe30af2dfedaba79dbd796b9cd161049573fc2209093b73c78ead725f0389
7
- data.tar.gz: f638c858d2384822f59dbe04d39fa0ab6f9cb9bbd42fffb2e9e57c917a5f8d64782ff7176abe98a3968b73eca59be0ed95d0822be32349c549c9b2d8b6213db9
6
+ metadata.gz: c58dfe2d3407b0b0ec5bcc42a412eb740ff7834559a533e7f8677789590f78016ef58111936cc7021a76b263f6f4dfce5d636b559d0fd83a5484c822a2aa2bb4
7
+ data.tar.gz: b5e9ad9000dd8605eefc6cc06957d9841e9b283f3f471616ba681f64086ffc70004ca929c0d291dd66a3b46a56491cf96ca4dceaf2e36de599a876f84aef40d0
data/README.adoc CHANGED
@@ -263,7 +263,7 @@ RelatonBipm::BipmBibliographicItem.from_hash hash
263
263
 
264
264
  This gem uses following datasets as data sources:
265
265
  - `bipm-data-outcomes` - looking for local directory with the repository https://github.com/metanorma/bipm-data-outcomes
266
- - `si-brochute` - looking for local directory with the repository https://github.com/metanorma/bipm-si-brochure
266
+ - `bipm-si-brochute` - looking for local directory with the repository https://github.com/metanorma/bipm-si-brochure
267
267
 
268
268
  The method `RelatonBipm::DataFetcher.fetch(sourece, output: "data", format: "yaml")` fetches all the documents from the datast and save them to the `./data` folder in YAML format.
269
269
  Arguments:
@@ -280,7 +280,7 @@ Stopped at: 2022-06-23 09:36:58 +0200
280
280
  Done in: 2 sec.
281
281
  => nil
282
282
 
283
- RelatonBipm::DataFetcher.fetch "si-brochure"
283
+ RelatonBipm::DataFetcher.fetch "bipm-si-brochure"
284
284
  Started at: 2022-06-23 09:37:12 +0200
285
285
  Stopped at: 2022-06-23 09:37:12 +0200
286
286
  Done in: 0 sec.
@@ -25,7 +25,7 @@ module RelatonBipm
25
25
  def self.fetch(source, output: "data", format: "yaml")
26
26
  t1 = Time.now
27
27
  puts "Started at: #{t1}"
28
- FileUtils.mkdir_p output unless Dir.exist? output
28
+ FileUtils.mkdir_p output
29
29
  new(output, format).fetch(source)
30
30
  t2 = Time.now
31
31
  puts "Stopped at: #{t2}"
@@ -40,7 +40,7 @@ module RelatonBipm
40
40
  def fetch(source)
41
41
  case source
42
42
  when "bipm-data-outcomes" then parse_bipm_data_outcomes
43
- when "si-brochure" then parse_si_brochure
43
+ when "bipm-si-brochure" then parse_si_brochure
44
44
  end
45
45
  File.write @index_path, @index.to_yaml, encoding: "UTF-8"
46
46
  end
@@ -137,9 +137,9 @@ module RelatonBipm
137
137
  fr_file = en_file.sub "en", "fr"
138
138
  fr = RelatonBib.parse_yaml File.read(fr_file, encoding: "UTF-8"), [Date]
139
139
  fr_md = fr["metadata"]
140
- gh_src = "https://raw.githubusercontent.com/metanorma/"
141
- src_en = gh_src + en_file.split("/")[1..].insert(1, "main").join("/")
142
- src_fr = gh_src + fr_file.split("/")[1..].insert(1, "main").join("/")
140
+ gh_src = "https://raw.githubusercontent.com/metanorma/bipm-data-outcomes/"
141
+ src_en = gh_src + en_file.split("/")[-3..].unshift("main").join("/")
142
+ src_fr = gh_src + fr_file.split("/")[-3..].unshift("main").join("/")
143
143
  src = [{ type: "src", content: src_en }, { type: "src", content: src_fr }]
144
144
 
145
145
  /^(?<num>\d+)(?:-_(?<part>\d+))?-\d{4}$/ =~ en_md["url"].split("/").last
@@ -189,8 +189,11 @@ module RelatonBipm
189
189
  args[:en]["resolutions"].each.with_index do |r, i| # rubocop:disable Metrics/BlockLength
190
190
  hash = { fetched: Date.today.to_s, title: [], doctype: r["type"] }
191
191
  hash[:title] << title(r["title"], "en") if r["title"]
192
- fr_title = args[:fr]["resolutions"][i]["title"]
193
- hash[:title] << title(fr_title, "fr") if fr_title
192
+ fr_resolution = args[:fr]["resolutions"].fetch(i, nil)
193
+ if fr_resolution
194
+ fr_title = fr_resolution["title"]
195
+ hash[:title] << title(fr_title, "fr") if fr_title
196
+ end
194
197
  date = r["dates"].first.to_s
195
198
  hash[:date] = [{ type: "published", on: date }]
196
199
  num = r["identifier"].to_s.split("-").last
@@ -278,7 +281,7 @@ module RelatonBipm
278
281
  hash[:id] = args[:id].gsub " ", "-"
279
282
  hash[:docnumber] = args[:id]
280
283
  hash[:link] = [{ type: "src", content: args[:en]["url"] }]
281
- hash[:link] << { type: "pdf", content: args[:pdf] } if args[:pdf]
284
+ RelatonBib.array(args[:pdf]).each { |pdf| hash[:link] << { type: "pdf", content: pdf } }
282
285
  hash[:link] += args[:src] if args[:src]&.any?
283
286
  hash[:language] = %w[en fr]
284
287
  hash[:script] = ["Latn"]
@@ -28,7 +28,7 @@ module RelatonBipm
28
28
 
29
29
  # @param ret [Hash]
30
30
  def title_hash_to_bib(ret)
31
- ret[:title] &&= array(ret[:title])
31
+ ret[:title] &&= RelatonBib.array(ret[:title])
32
32
  .reduce(RelatonBib::TypedTitleStringCollection.new) do |m, t|
33
33
  m << if t.is_a? Hash
34
34
  RelatonBib::TypedTitleString.new(**t)
@@ -45,7 +45,7 @@ module RelatonBipm
45
45
 
46
46
  # @param ret [Hash]
47
47
  # def project_group_hash_to_bib(ret)
48
- # ret[:project_group] &&= array(ret[:project_group]).map do |pg|
48
+ # ret[:project_group] &&= RelatonBib.array(ret[:project_group]).map do |pg|
49
49
  # wg = RelatonBib::FormattedString.new pg[:workgroup]
50
50
  # ProjectTeam.new(committee: pg[:committee], workgroup: wg)
51
51
  # end
@@ -77,14 +77,14 @@ module RelatonBipm
77
77
  Committee.new(**c)
78
78
  end
79
79
  end
80
- wg = array(ret[:editorialgroup][:workgroup]).map do |w|
80
+ wg = RelatonBib.array(ret[:editorialgroup][:workgroup]).map do |w|
81
81
  w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
82
82
  end
83
83
  ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
84
84
  end
85
85
 
86
86
  def committee_variants(cmt)
87
- array(cmt[:variants]).each_with_object([]) do |v, a|
87
+ RelatonBib.array(cmt[:variants]).each_with_object([]) do |v, a|
88
88
  c = v[:content] || (ac = acronyms[cmt[:acronym]]) && ac[v[:language]]
89
89
  a << RelatonBib::LocalizedString.new(c, v[:language], v[:script]) if c
90
90
  end
@@ -9,7 +9,7 @@ module RelatonBipm
9
9
  @prefix = "BIPM"
10
10
  @defaultprefix = %r{^(?:BIPM|CCTF|CCDS|CGPM|CIPM)(?!\w)}
11
11
  @idtype = "BIPM"
12
- @datasets = %w[bipm-data-outcomes si-brochure]
12
+ @datasets = %w[bipm-data-outcomes bipm-si-brochure]
13
13
  end
14
14
 
15
15
  # @param code [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.12.0".freeze
2
+ VERSION = "1.12.3".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.12.0
4
+ version: 1.12.3
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-06-25 00:00:00.000000000 Z
11
+ date: 2022-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug