relaton-ietf 1.12.4 → 1.12.5

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: 18af96dce8ec5c7579aec1dc247517bdb6d04c5425c8f64e00c3f71c5357c94b
4
- data.tar.gz: be74165b6a45cd3aa1f21ea100dbe6664be78687f23cc0c54bb280b6b2a2d0a2
3
+ metadata.gz: 0eddad3431b1f0aade4e139456c33ae9cd067eaec9dd38b64257be00e285efd7
4
+ data.tar.gz: 156d9d50c7964ec4167526fc1f31460134c717fbd48c4dd41b7d4bc42450c094
5
5
  SHA512:
6
- metadata.gz: 7adc1f2cf07a3e571b554d19dac1663088761da74ce483f410e99db180cfb749e499443ec8a0b151eef73e93930ce3c03900b194aac2cf2e56e1e29ec33240ff
7
- data.tar.gz: 37a1074f67177a69c0e01926114f2b36ef450802c75ad1b120a6d78513e77c92916c88257bda82ae90b2b573c1b67a9bc45c6ec2d92a615a4ade473297b3e909
6
+ metadata.gz: ab78ea185c4bf6e7be09f78a7457f36ac3f1951b46bc0b2c3c33b6465fcdee9cdad00cb69f3fc606144bba3efe2e94e765a340933d129a67dfd29aa6c8dfa14f
7
+ data.tar.gz: 8e5e48e4257c89edcca19c85e54d5ef2dfc8a941ebed64cd3b826f63373774d25f2ef6b9c65ae2752e36fb7efa118874be489e5ee9f6faefceae674d9919e4dd
@@ -151,8 +151,8 @@ module RelatonIetf
151
151
  # @return [Array<RelatonBib::ContributionInfo>] document contributors
152
152
  #
153
153
  def parse_contributor # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
154
- @doc.xpath("./xmlns:author").map do |contributor| # rubocop:disable Metrics/BlockLength
155
- n = contributor.at("./xmlns:name").text
154
+ @doc.xpath("./xmlns:author").map do |contrib| # rubocop:disable Metrics/BlockLength
155
+ n = contrib.at("./xmlns:name").text
156
156
  case n
157
157
  when "ISO"
158
158
  entity = RelatonBib::Organization.new(abbrev: n, name: "International Organization for Standardization")
@@ -186,17 +186,28 @@ module RelatonIetf
186
186
  when "International Telegraph and Telephone Consultative Committee of the International Telecommunication Union"
187
187
  entity = RelatonBib::Organization.new(abbrev: "CCITT", name: n)
188
188
  else
189
- # int, snm = n.split
190
189
  /^(?:(?<int>(?:\p{Lu}+(?:-\w|\(\w\))?\.{0,2}[-\s]?)+)\s)?(?<snm>[[:alnum:]\s'-.]+)$/ =~ n
191
190
  surname = RelatonBib::LocalizedString.new(snm, "en", "Latn")
192
191
  name = RelatonBib::LocalizedString.new(n, "en", "Latn")
193
192
  fname = RelatonBib::FullName.new(completename: name, initial: initials(int), surname: surname)
194
193
  entity = RelatonBib::Person.new(name: fname)
195
194
  end
196
- RelatonBib::ContributionInfo.new(entity: entity, role: [{ type: "author" }])
195
+ RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib))
197
196
  end
198
197
  end
199
198
 
199
+ #
200
+ # Parse contributors role
201
+ #
202
+ # @param [Nokogiri::XML::Node] contrib <description>
203
+ #
204
+ # @return [Array<Hash>] contributors role
205
+ #
206
+ def parse_role(contrib)
207
+ type = contrib.at("./xmlns:title")&.text&.downcase || "author"
208
+ [{ type: type }]
209
+ end
210
+
200
211
  #
201
212
  # Ctreat initials
202
213
  #
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.12.4".freeze
2
+ VERSION = "1.12.5".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ietf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.4
4
+ version: 1.12.5
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-07-02 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml