relaton-ietf 1.13.4 → 1.13.5

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: db91bbb481894890a4cbeaa2be2360cdec706ed70032802445be832c563894cb
4
- data.tar.gz: 46d9f9e438e4dbe4d42f8d12c6236c864677a56940358abf87a314987ac22579
3
+ metadata.gz: 48b025f8949b55b5df8b2655037fed2d843721ae2e7c2d33c287f3dd5916ccc3
4
+ data.tar.gz: 263251fa0ee6063de9ed33e8af021041aaa71b95abf0547c809e643eae8a29ed
5
5
  SHA512:
6
- metadata.gz: cc5e578aa8f3669bd0a4edea2de81ec2b4413d4c35c569458bf8b30ac4f8d05e777aaf7180d4c2488041cfc8f0963e4730cb7364668e95c0f166bd81f189e84d
7
- data.tar.gz: 64ff855b716bc70c09c3790bf7bb24fb2d208aee7ef92080d74d72e1a4425183d4ccf0d3ed33530c8a63fe41260cbac589618e82b3f0c12280dfcd4715e2f4fb
6
+ metadata.gz: 45d31fe5d94624e4a81762502daecf1be53759fb543e93fcb0b7a1a91a8f326ba4f01294344aca18fe7581df671a61dbb7cf8617f56204e25a71acd7c65b6d80
7
+ data.tar.gz: d301e5635a36a9c0f2897f33561398c7f4c31db4c5477cbc8050c7b5b9902b83282e234f03bb0823794edf200b40b9e825cc396f4a56c541ca500bfada2a9175
@@ -3,25 +3,6 @@ module RelatonIetf
3
3
  include RelatonBib::BibXMLParser
4
4
  extend BibXMLParser
5
5
 
6
- FULLNAMEORG = [
7
- "IAB", "Internet Architecture Board", "IAB and IESG", "IESG",
8
- "IAB Advisory Committee", "Internet Engineering Steering Group",
9
- "Network Information Center. Stanford Research Institute",
10
- "Information Sciences Institute University of Southern California",
11
- "International Telegraph and Telephone Consultative Committee of the International Telecommunication Union",
12
- "National Bureau of Standards", "International Organization for Standardization",
13
- "National Research Council", "Gateway Algorithms and Data Structures Task Force",
14
- "National Science Foundation", "Network Technical Advisory Group",
15
- "NetBIOS Working Group in the Defense Advanced Research Projects Agency",
16
- "Internet Activities Board", "End-to-End Services Task Force",
17
- "Defense Advanced Research Projects Agency", "The North American Directory Forum",
18
- "ESCC X.500/X.400 Task Force", "ESnet Site Coordinating Comittee (ESCC)",
19
- "Energy Sciences Network (ESnet)", "RARE WG-MSG Task Force 88",
20
- "Internet Assigned Numbers Authority (IANA)", "Federal Networking Council",
21
- "Audio-Video Transport Working Group", "KOI8-U Working Group",
22
- "The Internet Society", "Sun Microsystems"
23
- ].freeze
24
-
25
6
  # @param attrs [Hash]
26
7
  # @return [RelatonIetf::IetfBibliographicItem]
27
8
  def bib_item(**attrs)
@@ -68,30 +49,77 @@ module RelatonIetf
68
49
  contribs + super
69
50
  end
70
51
 
52
+ def person(author, reference)
53
+ full_name_org(author[:fullname]) || super
54
+ end
55
+
56
+ def full_name_org(name) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
57
+ case name
58
+ when "ISO"
59
+ RelatonBib::Organization.new(abbreviation: name, name: "International Organization for Standardization")
60
+ when "IAB"
61
+ RelatonBib::Organization.new(abbreviation: name, name: "Internet Architecture Board")
62
+ when "IESG"
63
+ RelatonBib::Organization.new(abbreviation: name, name: "Internet Engineering Steering Group")
64
+ when "IANA"
65
+ RelatonBib::Organization.new(abbreviation: name, name: "Internet Assigned Numbers Authority")
66
+ when "International Organization for Standardization"
67
+ RelatonBib::Organization.new(abbreviation: "ISO", name: name)
68
+ when "Federal Networking Council", "Internet Architecture Board", "Internet Activities Board",
69
+ "Defense Advanced Research Projects Agency", "National Science Foundation",
70
+ "National Research Council", "National Bureau of Standards",
71
+ "Internet Engineering Steering Group"
72
+ abbr = name.split.map { |w| w[0] if w[0] == w[0].upcase }.join
73
+ RelatonBib::Organization.new(abbreviation: abbr, name: name)
74
+ when "IETF Secretariat"
75
+ RelatonBib::Organization.new(abbreviation: "IETF", name: name)
76
+ when "Audio-Video Transport Working Group", /North American Directory Forum/, "EARN Staff",
77
+ "Vietnamese Standardization Working Group", "ACM SIGUCCS", "ESCC X.500/X.400 Task Force",
78
+ "Sun Microsystems", "NetBIOS Working Group in the Defense Advanced Research Projects Agency",
79
+ "End-to-End Services Task Force", "Network Technical Advisory Group", "Bolt Beranek",
80
+ "Newman Laboratories", "Gateway Algorithms and Data Structures Task Force",
81
+ "Network Information Center. Stanford Research Institute", "RFC Editor",
82
+ "Information Sciences Institute University of Southern California", "IAB and IESG",
83
+ "RARE WG-MSG Task Force 88", "KOI8-U Working Group", "The Internet Society",
84
+ "IAB Advisory Committee", "ISOC Board of Trustees", "Mitra", "RFC Editor, et al."
85
+ RelatonBib::Organization.new(name: name)
86
+ when "Internet Assigned Numbers Authority (IANA)"
87
+ RelatonBib::Organization.new(abbreviation: "IANA", name: "Internet Assigned Numbers Authority (IANA)")
88
+ when "ESnet Site Coordinating Comittee (ESCC)"
89
+ RelatonBib::Organization.new(abbreviation: "ESCC", name: "ESnet Site Coordinating Comittee (ESCC)")
90
+ when "Energy Sciences Network (ESnet)"
91
+ RelatonBib::Organization.new(abbreviation: "ESnet", name: "Energy Sciences Network (ESnet)")
92
+ when "International Telegraph and Telephone Consultative Committee of the International Telecommunication Union"
93
+ RelatonBib::Organization.new(abbreviation: "CCITT", name: name)
94
+ end
95
+ end
96
+
71
97
  #
72
98
  # Overrade RelatonBib::BibXMLParser#full_name method
73
99
  #
74
- # @param author [Nokogiri::XML::Element]
75
- # @param reference [Nokogiri::XML::Element]
100
+ # @param fname [String] full name
101
+ # @param sname [String, nil] surname
102
+ # @param fname [String, nil] first name
103
+ # @param lang [String, nil] language
104
+ # @param script [String, nil] script
76
105
  #
77
106
  # @return [RelatonBib::FullName]
78
107
  #
79
- def full_name(author, reference)
80
- lang = language reference
81
- sname, inits = parse_surname_initials author
82
- initials = localized_string(inits, lang)
108
+ def full_name(fname, sname, inits, lang, script = nil)
109
+ surname, ints = parse_surname_initials fname, sname, inits
110
+ initials = localized_string(ints, lang, script)
83
111
  RelatonBib::FullName.new(
84
- completename: localized_string(author[:fullname], lang),
85
- initials: initials, forename: forename(inits, lang),
86
- surname: localized_string(sname, lang)
112
+ completename: localized_string(fname, lang, script),
113
+ initials: initials, forename: forename(ints, lang, script),
114
+ surname: localized_string(surname, lang, script)
87
115
  )
88
116
  end
89
117
 
90
- def parse_surname_initials(author)
118
+ def parse_surname_initials(fname, sname, inits)
91
119
  regex = /(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+/
92
- surname = author[:surname] || author[:fullname].sub(regex, "").strip
93
- inits = author[:initials] || regex.match(author[:fullname])&.to_s&.strip
94
- [surname, inits]
120
+ surname = sname || fname.sub(regex, "").strip
121
+ initials = inits || regex.match(fname)&.to_s&.strip
122
+ [surname, initials]
95
123
  end
96
124
  end
97
125
  end
@@ -149,48 +149,12 @@ module RelatonIetf
149
149
  #
150
150
  # @return [Array<RelatonBib::ContributionInfo>] document contributors
151
151
  #
152
- def parse_contributor # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
153
- @doc.xpath("./xmlns:author").map do |contrib| # rubocop:disable Metrics/BlockLength
154
- n = contrib.at("./xmlns:name").text
155
- case n
156
- when "ISO"
157
- entity = RelatonBib::Organization.new(abbrev: n, name: "International Organization for Standardization")
158
- when "International Organization for Standardization"
159
- entity = RelatonBib::Organization.new(abbrev: "ISO", name: n)
160
- when /#{RelatonBib::BibXMLParser::FULLNAMEORG.join("|")}/
161
- abbr = n.upcase == n ? n : n.split.reduce([]) { |a, w| w == w.upcase ? break : a << w[0] }&.join
162
- entity = RelatonBib::Organization.new(abbrev: abbr, name: n)
163
- when "Federal Networking Council", "Internet Activities Board",
164
- "Defense Advanced Research Projects Agency", "National Science Foundation",
165
- "National Research Council", "National Bureau of Standards"
166
- abbr = n.split.map { |w| w[0] if w[0] == w[0].upcase }.join
167
- entity = RelatonBib::Organization.new(abbrev: abbr, name: n)
168
- when "IETF Secretariat"
169
- entity = RelatonBib::Organization.new(abbrev: "IETF", name: n)
170
- when "Audio-Video Transport Working Group", /North American Directory Forum/, "EARN Staff",
171
- "Vietnamese Standardization Working Group", "ACM SIGUCCS", "ESCC X.500/X.400 Task Force",
172
- "Sun Microsystems", "NetBIOS Working Group in the Defense Advanced Research Projects Agency",
173
- "End-to-End Services Task Force", "Network Technical Advisory Group", "Bolt Beranek",
174
- "Newman Laboratories", "Gateway Algorithms and Data Structures Task Force",
175
- "Network Information Center. Stanford Research Institute", "RFC Editor",
176
- "Information Sciences Institute University of Southern California",
177
- "RARE WG-MSG Task Force 88", "KOI8-U Working Group", "The Internet Society"
178
- entity = RelatonBib::Organization.new(name: n)
179
- when "Internet Assigned Numbers Authority (IANA)"
180
- entity = RelatonBib::Organization.new(abbrev: "IANA", name: "Internet Assigned Numbers Authority (IANA)")
181
- when "ESnet Site Coordinating Comittee (ESCC)"
182
- entity = RelatonBib::Organization.new(abbrev: "ESCC", name: "ESnet Site Coordinating Comittee (ESCC)")
183
- when "Energy Sciences Network (ESnet)"
184
- entity = RelatonBib::Organization.new(abbrev: "ESnet", name: "Energy Sciences Network (ESnet)")
185
- when "International Telegraph and Telephone Consultative Committee of the International Telecommunication Union"
186
- entity = RelatonBib::Organization.new(abbrev: "CCITT", name: n)
187
- else
188
- /^(?:(?<int>(?:\p{Lu}+(?:-\w|\(\w\))?\.{0,2}[-\s]?)+)\s)?(?<snm>[[:alnum:]\s'-.]+)$/ =~ n
189
- surname = RelatonBib::LocalizedString.new(snm, "en", "Latn")
190
- name = RelatonBib::LocalizedString.new(n, "en", "Latn")
191
- fname = RelatonBib::FullName.new(
192
- completename: name, initials: int, forename: forename(int), surname: surname,
193
- )
152
+ def parse_contributor
153
+ @doc.xpath("./xmlns:author").map do |contrib|
154
+ name = contrib.at("./xmlns:name").text
155
+ entity = BibXMLParser.full_name_org name
156
+ unless entity
157
+ fname = BibXMLParser.full_name name, nil, nil, "en", "Latn"
194
158
  entity = RelatonBib::Person.new(name: fname)
195
159
  end
196
160
  RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib))
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.13.4".freeze
2
+ VERSION = "1.13.5".freeze
3
3
  end
data/relaton_ietf.gemspec CHANGED
@@ -38,5 +38,5 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "vcr"
39
39
  spec.add_development_dependency "webmock"
40
40
 
41
- spec.add_dependency "relaton-bib", "~> 1.13.10"
41
+ spec.add_dependency "relaton-bib", "~> 1.13.11"
42
42
  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.13.4
4
+ version: 1.13.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-10-18 00:00:00.000000000 Z
11
+ date: 2022-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.13.10
131
+ version: 1.13.11
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.13.10
138
+ version: 1.13.11
139
139
  description: "RelatonIetf: retrieve IETF Standards for bibliographic use \nusing the
140
140
  BibliographicItem model.\n\nFormerly known as rfcbib.\n"
141
141
  email: