relaton-bipm 1.20.0 → 1.20.2

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: 98f4b8a04eb9738b1302ff84f91c11f5e604adfdefc2fdfac999279f4d62bf0d
4
- data.tar.gz: 4e6dad8f65ca0472b24d178474b69a78fe20b3d784adbc1512d4c79aad576de0
3
+ metadata.gz: ea992197c7e29c94560a057b995ac93721cc8e713e09a4d6191294f512f46aa0
4
+ data.tar.gz: d982f800f01ec696acbc34f4aecc2ea8d28ea7724b69f1901629d3b4623fe10a
5
5
  SHA512:
6
- metadata.gz: d07764ecb8ffba9c394eb01fb17ec617c1209038390cd37e6035a897616e1f717b69ced0830da7d6b721733eeeb8d3ae503bb65a7efc9228142dd90852f1f665
7
- data.tar.gz: a97d282c516026bd083a7ec534a0d1357e8eb4ab09f01495aff28e6be8fbabf78b071c422aa572690f12d5700d287ebb5cc2e34a23c7a1c88f041813834b7571
6
+ metadata.gz: 63a8182c1b54979c2bbe436eaca66e460e7846d4e5b47b2a9355ec8d031e1cf51e929123f02638cc450ef3533305a07cb108226d969945d2ce72fab27417bcf8
7
+ data.tar.gz: 93077b3f86f9b906bb5dbc83612e3b64bd92de42f4f66c414fd6bf0facb962d080f8a03f201062d75a197034d8241e5ce4c4fa1488d35861225a74e863efb561
@@ -54,4 +54,6 @@ JCRB:
54
54
  JCTLM:
55
55
  en: Joint Committee for Traceability in Laboratory Medicine
56
56
  INetQI:
57
- en: International Network on Quality Infrastructure
57
+ en: International Network on Quality Infrastructure
58
+ CCL-CCTF-WGFS:
59
+ en: CCL-CCTF Frequency Standards Working Group
@@ -88,8 +88,7 @@ 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
- yaml = RelatonBib.parse_yaml(File.read(path, encoding: "UTF-8"), [Date])
92
- has_part_item = RelatonBipm::BipmBibliographicItem.from_hash(yaml)
91
+ has_part_item = parse_file path
93
92
  has_part_item.relation << RelatonBib::DocumentRelation.new(type: "partOf", bibitem: item)
94
93
  @data_fetcher.write_file path, has_part_item, warn_duplicate: false
95
94
  path = File.join dir, "#{num}-#{part}.#{@data_fetcher.ext}"
@@ -111,6 +110,17 @@ module RelatonBipm
111
110
  fetch_resolution body: body, en: en, fr: fr, dir: dir, src: src, num: num
112
111
  end
113
112
 
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
+
114
124
  #
115
125
  # Read English and French files
116
126
  #
@@ -348,8 +358,12 @@ module RelatonBipm
348
358
  #
349
359
  # @return [Hash] title
350
360
  #
351
- def create_title(content, language)
352
- { content: content, language: language, script: "Latn" }
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 }
353
367
  end
354
368
 
355
369
  #
@@ -541,11 +555,12 @@ module RelatonBipm
541
555
  end
542
556
 
543
557
  def create_meeting_docids(en_id)
544
- fr_id = en_id.sub(/(\d+)(?:st|nd|rd|th)/, '\1e').sub("Meeting", "Réunion")
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>')
545
560
  [
546
561
  make_docid(id: en_id, type: "BIPM", primary: true, language: "en", script: "Latn"),
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),
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),
549
564
  ]
550
565
  end
551
566
 
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.20.0".freeze
2
+ VERSION = "1.20.2".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.20.0
4
+ version: 1.20.2
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-12 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday