relaton-ietf 1.12.4 → 1.12.7

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: 18af96dce8ec5c7579aec1dc247517bdb6d04c5425c8f64e00c3f71c5357c94b
4
- data.tar.gz: be74165b6a45cd3aa1f21ea100dbe6664be78687f23cc0c54bb280b6b2a2d0a2
3
+ metadata.gz: f2fd674003889725827b1fabaa8f17e203d89c3db34c94a00dda7cbac76217c1
4
+ data.tar.gz: 0bacd63b9c7593281255b93aaef453378a1e9cc60f1e1fe0cfb0b2c7b5f438d4
5
5
  SHA512:
6
- metadata.gz: 7adc1f2cf07a3e571b554d19dac1663088761da74ce483f410e99db180cfb749e499443ec8a0b151eef73e93930ce3c03900b194aac2cf2e56e1e29ec33240ff
7
- data.tar.gz: 37a1074f67177a69c0e01926114f2b36ef450802c75ad1b120a6d78513e77c92916c88257bda82ae90b2b573c1b67a9bc45c6ec2d92a615a4ade473297b3e909
6
+ metadata.gz: d054a537dc2f99f682a874f5945fa96dd80e097beacd2e2174167cfa4a0679d0f4402b3e77d24b5e99cb4e51542d42323c8c9d853d1e0b304896e084e19f3366
7
+ data.tar.gz: 72a6c35c33589156f569248d4b10979047f3459f90c37e8013c69ec1ff89a87e6238c1ddd599bee4aec6246e22051a788a99de6fc1eabe526557e9a750b21ce4
@@ -67,7 +67,7 @@ module RelatonIetf
67
67
  versions = Dir["bibxml-ids/*.xml"].each_with_object([]) do |path, vers|
68
68
  file = File.basename path, ".xml"
69
69
  if file.include?("D.draft-")
70
- vers << file.sub(/^reference\.I-D\./, "")
70
+ vers << file.sub(/^reference\.I-D\./, "").downcase
71
71
  /(?<ver>\d+)$/ =~ file
72
72
  end
73
73
  bib = BibXMLParser.parse(File.read(path, encoding: "UTF-8"))
@@ -92,7 +92,7 @@ module RelatonIetf
92
92
  match = /(?<series>draft-.+)-(?<ver>\d{2})\.#{@ext}$/.match file
93
93
  if match
94
94
  if series != match[:series]
95
- bib_versions = versions.grep(/^#{match[:series]}-\d{2}/)
95
+ bib_versions = versions.grep(/^#{Regexp.quote match[:series]}-\d{2}/)
96
96
  create_series match[:series], bib_versions
97
97
  series = match[:series]
98
98
  end
@@ -115,8 +115,6 @@ module RelatonIetf
115
115
  # @param [Array<String>] versions list of versions
116
116
  #
117
117
  def create_series(ref, versions) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
118
- return if versions.size < 2
119
-
120
118
  vs = versions.sort_by { |v| v.match(/\d+$/).to_s.to_i }
121
119
  fref = RelatonBib::FormattedRef.new content: ref
122
120
  docid = RelatonBib::DocumentIdentifier.new type: "Internet-Draft", id: ref, primary: true
@@ -6,7 +6,7 @@ module RelatonIetf
6
6
  def initialize # rubocop:disable Lint/MissingSuper
7
7
  @short = :relaton_ietf
8
8
  @prefix = "IETF"
9
- @defaultprefix = /^(IETF|RFC|BCP|FYI|STD)\s/
9
+ @defaultprefix = /^((IETF|RFC|BCP|FYI|STD)\s|I-D[.\s])/
10
10
  @idtype = "IETF"
11
11
  @datasets = %w[ietf-rfcsubseries ietf-internet-drafts ietf-rfc-entries]
12
12
  end
@@ -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
  #
@@ -31,7 +31,7 @@ module RelatonIetf
31
31
  when /^RFC/ then RFC
32
32
  when /^(?:BCP|FYI|STD)/ then RSS
33
33
  when /^I-D/
34
- ref.sub!(/^I-D\./, "")
34
+ ref.sub!(/^I-D[.\s]/, "")
35
35
  IDS
36
36
  else return
37
37
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.12.4".freeze
2
+ VERSION = "1.12.7".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.7
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-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml