relaton-ietf 1.13.3 → 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: 6fe51d3e7f18e3e3b6c093ee78a24c917cdfd95d88bab7035078c8627a35f0fb
4
- data.tar.gz: 29b83fa09d9a1b403fdeef78ef77297b8911d7ab222a2b4cf47a60ffd5b7a8d6
3
+ metadata.gz: 48b025f8949b55b5df8b2655037fed2d843721ae2e7c2d33c287f3dd5916ccc3
4
+ data.tar.gz: 263251fa0ee6063de9ed33e8af021041aaa71b95abf0547c809e643eae8a29ed
5
5
  SHA512:
6
- metadata.gz: 98e68d59cc3b1c53c6c3ed3a845a05b9f2f2ceca3a60b6f63bb952fc51dcf81cfe8ebe7e62e9fbfaadd30a2268ded0dbf1c947e6c6c3f17e91bf76bd0feb4a70
7
- data.tar.gz: ccf02324637a7da4cb8b960c5ed05363e399dd4da11578f50254dc783662aa82b4da87b4ca031bd8cc9de9c5500bc41741d98e9c63314e29771bd1ef7a62be2c
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)
@@ -43,7 +24,8 @@ module RelatonIetf
43
24
  type = super
44
25
  case type
45
26
  when "BCP", "FYI", "STD", "RFC" then "RFC"
46
- when "Internet-Draft" then type
27
+ # when "Internet-Draft" then type
28
+ when "I-D" then "Internet-Draft"
47
29
  else "IETF"
48
30
  end
49
31
  end
@@ -67,38 +49,77 @@ module RelatonIetf
67
49
  contribs + super
68
50
  end
69
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
+
70
97
  #
71
98
  # Overrade RelatonBib::BibXMLParser#full_name method
72
99
  #
73
- # @param author [Nokogiri::XML::Element]
74
- # @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
75
105
  #
76
106
  # @return [RelatonBib::FullName]
77
107
  #
78
- def full_name(author, reference)
79
- lang = language reference
80
- sname, inits = parse_surname_initials author
81
- 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)
82
111
  RelatonBib::FullName.new(
83
- completename: localized_string(author[:fullname], lang),
84
- initials: initials, forename: forename(inits, lang),
85
- 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)
86
115
  )
87
116
  end
88
117
 
89
- def parse_surname_initials(author)
118
+ def parse_surname_initials(fname, sname, inits)
90
119
  regex = /(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+/
91
- surname = author[:surname] || author[:fullname].sub(regex, "").strip
92
- inits = author[:initials] || regex.match(author[:fullname])&.to_s&.strip
93
- [surname, inits]
94
- end
95
-
96
- def parse_surname(fullname)
97
- fullname.sub(/(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+/, "").strip
98
- end
99
-
100
- def parse_initials(fullname)
101
- fullname.match(/(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+/).to_s.strip
120
+ surname = sname || fname.sub(regex, "").strip
121
+ initials = inits || regex.match(fname)&.to_s&.strip
122
+ [surname, initials]
102
123
  end
103
124
  end
104
125
  end
@@ -149,55 +149,15 @@ 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 "IAB", "IESG", "Internet Architecture Board", "IAB and IESG",
161
- # "IAB Advisory Committee", "Internet Engineering Steering Group"
162
- when /#{RelatonBib::BibXMLParser::FULLNAMEORG.join("|")}/
163
- abbr = n.upcase == n ? n : n.split.reduce([]) { |a, w| w == w.upcase ? break : a << w[0] }&.join
164
- entity = RelatonBib::Organization.new(abbrev: abbr, name: n)
165
- desc = "BibXML author"
166
- # when "IESG"
167
- # entity = RelatonBib::Organization.new(abbrev: n, name: "Internet Engineering Steering Group")
168
- when "Federal Networking Council", "Internet Activities Board",
169
- "Defense Advanced Research Projects Agency", "National Science Foundation",
170
- "National Research Council", "National Bureau of Standards"
171
- abbr = n.split.map { |w| w[0] if w[0] == w[0].upcase }.join
172
- entity = RelatonBib::Organization.new(abbrev: abbr, name: n)
173
- when "IETF Secretariat"
174
- entity = RelatonBib::Organization.new(abbrev: "IETF", name: n)
175
- when "Audio-Video Transport Working Group", /North American Directory Forum/, "EARN Staff",
176
- "Vietnamese Standardization Working Group", "ACM SIGUCCS", "ESCC X.500/X.400 Task Force",
177
- "Sun Microsystems", "NetBIOS Working Group in the Defense Advanced Research Projects Agency",
178
- "End-to-End Services Task Force", "Network Technical Advisory Group", "Bolt Beranek",
179
- "Newman Laboratories", "Gateway Algorithms and Data Structures Task Force",
180
- "Network Information Center. Stanford Research Institute", "RFC Editor",
181
- "Information Sciences Institute University of Southern California"
182
- entity = RelatonBib::Organization.new(name: n)
183
- when "Internet Assigned Numbers Authority (IANA)"
184
- entity = RelatonBib::Organization.new(abbrev: "IANA", name: "Internet Assigned Numbers Authority")
185
- when "ESnet Site Coordinating Comittee (ESCC)"
186
- entity = RelatonBib::Organization.new(abbrev: "ESCC", name: "ESnet Site Coordinating Comittee")
187
- when "Energy Sciences Network (ESnet)"
188
- entity = RelatonBib::Organization.new(abbrev: "ESnet", name: "Energy Sciences Network")
189
- when "International Telegraph and Telephone Consultative Committee of the International Telecommunication Union"
190
- entity = RelatonBib::Organization.new(abbrev: "CCITT", name: n)
191
- else
192
- /^(?:(?<int>(?:\p{Lu}+(?:-\w|\(\w\))?\.{0,2}[-\s]?)+)\s)?(?<snm>[[:alnum:]\s'-.]+)$/ =~ n
193
- surname = RelatonBib::LocalizedString.new(snm, "en", "Latn")
194
- name = RelatonBib::LocalizedString.new(n, "en", "Latn")
195
- fname = RelatonBib::FullName.new(
196
- completename: name, initials: int, forename: forename(int), surname: surname,
197
- )
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"
198
158
  entity = RelatonBib::Person.new(name: fname)
199
159
  end
200
- RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib, desc))
160
+ RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib))
201
161
  end
202
162
  end
203
163
 
@@ -205,14 +165,12 @@ module RelatonIetf
205
165
  # Parse contributors role
206
166
  #
207
167
  # @param [Nokogiri::XML::Node] contrib contributor
208
- # @param [String, nil] desc contributor description
209
168
  #
210
169
  # @return [Array<Hash>] contributor's role
211
170
  #
212
- def parse_role(contrib, desc = nil)
171
+ def parse_role(contrib)
213
172
  type = contrib.at("./xmlns:title")&.text&.downcase || "author"
214
173
  role = { type: type }
215
- role[:description] = [desc] if desc
216
174
  [role]
217
175
  end
218
176
 
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.13.3".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.3
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-17 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: