relaton-bipm 1.19.4 → 1.20.0

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: 43be99f1f787252271ae3b9736d74ca0976f03c74b14b705680941c819efda7e
4
- data.tar.gz: c3200a477a9066e31a3d90153a031a1e71dc5433109547d17ada0eec4e70dbb8
3
+ metadata.gz: 98f4b8a04eb9738b1302ff84f91c11f5e604adfdefc2fdfac999279f4d62bf0d
4
+ data.tar.gz: 4e6dad8f65ca0472b24d178474b69a78fe20b3d784adbc1512d4c79aad576de0
5
5
  SHA512:
6
- metadata.gz: db81f3968f5d282a2837f55ebfa0b01fd020900ca32c30046a840b193619308cbae6488482666e472dc232b060f37beb51c225b15afc6a9cd2516ec2a1ecb790
7
- data.tar.gz: 2350797aafdbfa8881e3fb33fc3e526ae89df1a1cabf8e7686cdfcdf69240a111b3f94dfb5571b7b237b6b15e86ba7645fab49a76cc149ff64f225ed5d31dfd8
6
+ metadata.gz: d07764ecb8ffba9c394eb01fb17ec617c1209038390cd37e6035a897616e1f717b69ced0830da7d6b721733eeeb8d3ae503bb65a7efc9228142dd90852f1f665
7
+ data.tar.gz: a97d282c516026bd083a7ec534a0d1357e8eb4ab09f01495aff28e6be8fbabf78b071c422aa572690f12d5700d287ebb5cc2e34a23c7a1c88f041813834b7571
@@ -54,6 +54,4 @@ JCRB:
54
54
  JCTLM:
55
55
  en: Joint Committee for Traceability in Laboratory Medicine
56
56
  INetQI:
57
- en: International Network on Quality Infrastructure
58
- CCL-CCTF-WGFS:
59
- en: CCL-CCTF Frequency Standards Working Group
57
+ en: International Network on Quality Infrastructure
@@ -86,12 +86,16 @@ module RelatonBipm
86
86
  #
87
87
  def to_hash(embedded: false)
88
88
  hash = super
89
- hash["comment_period"] = comment_period.to_hash if comment_period
90
- hash["si_aspect"] = si_aspect if si_aspect
91
- hash["meeting_note"] = meeting_note if meeting_note
89
+ hash["ext"]["comment_period"] = comment_period.to_hash if comment_period
90
+ hash["ext"]["si_aspect"] = si_aspect if si_aspect
91
+ hash["ext"]["meeting_note"] = meeting_note if meeting_note
92
92
  hash
93
93
  end
94
94
 
95
+ def has_ext?
96
+ super || comment_period || si_aspect || meeting_note
97
+ end
98
+
95
99
  # @param prefix [String]
96
100
  # @return [String]
97
101
  def to_asciibib(prefix = "")
@@ -88,7 +88,8 @@ module RelatonBipm
88
88
  if @data_fetcher.files.include?(path) && part
89
89
  add_part hash, part
90
90
  item = RelatonBipm::BipmBibliographicItem.new(**hash)
91
- has_part_item = parse_file path
91
+ yaml = RelatonBib.parse_yaml(File.read(path, encoding: "UTF-8"), [Date])
92
+ has_part_item = RelatonBipm::BipmBibliographicItem.from_hash(yaml)
92
93
  has_part_item.relation << RelatonBib::DocumentRelation.new(type: "partOf", bibitem: item)
93
94
  @data_fetcher.write_file path, has_part_item, warn_duplicate: false
94
95
  path = File.join dir, "#{num}-#{part}.#{@data_fetcher.ext}"
@@ -110,17 +111,6 @@ module RelatonBipm
110
111
  fetch_resolution body: body, en: en, fr: fr, dir: dir, src: src, num: num
111
112
  end
112
113
 
113
- def parse_file(path)
114
- case @data_fetcher.format
115
- when "yaml"
116
- yaml = RelatonBib.parse_yaml(File.read(path, encoding: "UTF-8"), [Date])
117
- RelatonBipm::BipmBibliographicItem.from_hash(yaml)
118
- when "xml"
119
- xml = File.read(path, encoding: "UTF-8")
120
- RelatonBipm::XMLParser.from_xml xml
121
- end
122
- end
123
-
124
114
  #
125
115
  # Read English and French files
126
116
  #
@@ -358,12 +348,8 @@ module RelatonBipm
358
348
  #
359
349
  # @return [Hash] title
360
350
  #
361
- def create_title(content, language, format = "text/plain")
362
- if language == "fr"
363
- content.sub!(/(\d+)(e)/, '\1<sup>\2</sup>')
364
- format = "text/html" if content.match?(/<sup>/)
365
- end
366
- { content: content, language: language, script: "Latn", format: format }
351
+ def create_title(content, language)
352
+ { content: content, language: language, script: "Latn" }
367
353
  end
368
354
 
369
355
  #
@@ -555,12 +541,11 @@ module RelatonBipm
555
541
  end
556
542
 
557
543
  def create_meeting_docids(en_id)
558
- fr_id = en_id.sub(/(\d+)(?:st|nd|rd|th)/, '\1e').sub("Meeting", "réunion")
559
- fr_id_sup = fr_id.sub(/(\d+)(e)/, '\1<sup>\2</sup>')
544
+ fr_id = en_id.sub(/(\d+)(?:st|nd|rd|th)/, '\1e').sub("Meeting", "Réunion")
560
545
  [
561
546
  make_docid(id: en_id, type: "BIPM", primary: true, language: "en", script: "Latn"),
562
- make_docid(id: fr_id_sup, type: "BIPM", primary: true, language: "fr", script: "Latn"),
563
- make_docid(id: "#{en_id} / #{fr_id_sup}", type: "BIPM", primary: true),
547
+ make_docid(id: fr_id, type: "BIPM", primary: true, language: "fr", script: "Latn"),
548
+ make_docid(id: "#{en_id} / #{fr_id}", type: "BIPM", primary: true),
564
549
  ]
565
550
  end
566
551
 
@@ -17,6 +17,7 @@ module RelatonBipm
17
17
 
18
18
  # project_group_hash_to_bib ret
19
19
  commentperiod_hash_to_bib ret
20
+ ret[:si_aspect] = args["ext"]["si_aspect"] if args.dig("ext", "si_aspect")
20
21
  ret
21
22
  end
22
23
 
@@ -42,7 +43,10 @@ module RelatonBipm
42
43
 
43
44
  # @param ret [Hash]
44
45
  def commentperiod_hash_to_bib(ret)
45
- ret[:comment_period] &&= CommentPeriond.new(**ret[:comment_period])
46
+ compr = ret.dig(:ext, :comment_period) || ret[:comment_period] # @TODO: remove ret[:comment_period] after all data is updated
47
+ return unless compr
48
+
49
+ ret[:comment_period] &&= CommentPeriond.new(**compr)
46
50
  end
47
51
 
48
52
  # @param ret [Hash]
@@ -69,16 +73,17 @@ module RelatonBipm
69
73
 
70
74
  # @param ret [Hash]
71
75
  def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
72
- return unless ret[:editorialgroup]
76
+ ed = ret.dig(:ext, :editorialgroup) || ret[:editorialgroup] # @TODO: remove ret[:editorialgroup] after all data is updated
77
+ return unless ed
73
78
 
74
- cmt = ret[:editorialgroup][:committee].map do |c|
79
+ cmt = ed[:committee].map do |c|
75
80
  if (vars = committee_variants c).any?
76
81
  Committee.new acronym: c[:acronym], content: vars
77
82
  else
78
83
  Committee.new(**c)
79
84
  end
80
85
  end
81
- wg = RelatonBib.array(ret[:editorialgroup][:workgroup]).map do |w|
86
+ wg = RelatonBib.array(ed[:workgroup]).map do |w|
82
87
  w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
83
88
  end
84
89
  ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
@@ -97,9 +102,10 @@ module RelatonBipm
97
102
 
98
103
  # @param ret [Hash]
99
104
  def structuredidentifier_hash_to_bib(ret)
100
- ret[:structuredidentifier] &&= StructuredIdentifier.new(
101
- **ret[:structuredidentifier],
102
- )
105
+ struct_id = ret.dig(:ext, :structuredidentifier) || ret[:structuredidentifier] # @TODO: remove ret[:structuredidentifier] after all data is updated
106
+ return unless struct_id
107
+
108
+ ret[:structuredidentifier] = StructuredIdentifier.new(**struct_id)
103
109
  end
104
110
 
105
111
  def create_doctype(**args)
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.19.4".freeze
2
+ VERSION = "1.20.0".freeze
3
3
  end
data/relaton_bipm.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
35
35
  spec.add_dependency "faraday", "~> 2.7.0"
36
36
  spec.add_dependency "mechanize", "~> 2.10"
37
37
  spec.add_dependency "parslet", "~> 2.0.0"
38
- spec.add_dependency "relaton-bib", "~> 1.19.0"
38
+ spec.add_dependency "relaton-bib", "~> 1.20.0"
39
39
  spec.add_dependency "relaton-index", "~> 0.2.2"
40
40
  spec.add_dependency "rubyzip", "~> 2.3.0"
41
41
  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.19.4
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-17 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.19.0
61
+ version: 1.20.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.19.0
68
+ version: 1.20.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: relaton-index
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  requirements: []
168
- rubygems_version: 3.5.19
168
+ rubygems_version: 3.3.27
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: 'RelatonBipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem