relaton-bipm 1.12.0 → 1.12.1

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: 452c7efc10863231dddcf973d6bba23c40756b5e2bb4eae6a6fe05f1454a8fcc
4
+ data.tar.gz: 559200bd9b5700cfa2f11f69bfa379ae4fe2da10a12a1a0395e1eeb2710cd88e
5
5
  SHA512:
6
- metadata.gz: 020f3459446a2a48e0d571933811888bfe4fbcd91263c482609de7a34a98df38a27fe30af2dfedaba79dbd796b9cd161049573fc2209093b73c78ead725f0389
7
- data.tar.gz: f638c858d2384822f59dbe04d39fa0ab6f9cb9bbd42fffb2e9e57c917a5f8d64782ff7176abe98a3968b73eca59be0ed95d0822be32349c549c9b2d8b6213db9
6
+ metadata.gz: 07ec7af51e53a3ecd5fae8fcd4870d8debcbcd4630ad5d8936b9e884e2ed127cfe3a26a6930af742a08067d3f129a7135c1374b3f684d795f00d2b5c6fa56ced
7
+ data.tar.gz: c04e0cee65e8e3ea11dff07868c7f633e8d82cd61d6962eb4788e871275e0f08639ae1947d3b4e2b29f00884e82e77ad9589ae0b2b9c672c8ee9b1289b874e5d
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.12.0".freeze
2
+ VERSION = "1.12.1".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.1
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-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug