relaton-bipm 1.20.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98f4b8a04eb9738b1302ff84f91c11f5e604adfdefc2fdfac999279f4d62bf0d
4
- data.tar.gz: 4e6dad8f65ca0472b24d178474b69a78fe20b3d784adbc1512d4c79aad576de0
3
+ metadata.gz: 3f82a59533864cf6f80702a221409634b40078c86a3089b8f0578cca757052f6
4
+ data.tar.gz: 6b34ad48868eb793e6d34b4e049ff688144efde7e8431020e618e4f77b7d0185
5
5
  SHA512:
6
- metadata.gz: d07764ecb8ffba9c394eb01fb17ec617c1209038390cd37e6035a897616e1f717b69ced0830da7d6b721733eeeb8d3ae503bb65a7efc9228142dd90852f1f665
7
- data.tar.gz: a97d282c516026bd083a7ec534a0d1357e8eb4ab09f01495aff28e6be8fbabf78b071c422aa572690f12d5700d287ebb5cc2e34a23c7a1c88f041813834b7571
6
+ metadata.gz: 5894ea600bac7d43358e31dfdfc4114a83e29962850c07b258424dbb208d7c8087b27bfe927ea82546266ee3babdfeabf7228b81b43bb5889beadba4759ab537
7
+ data.tar.gz: dd53039d5050bce849c4bed6a6df73046c0ef2c578cd85134ed561a85d27b60367dbc47fbd3e179a0773ba8de98d88b8ee23da44ce196745890ca371f7ab221c
@@ -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.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.20.0
4
+ version: 1.20.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: 2024-12-12 00:00:00.000000000 Z
11
+ date: 2024-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday