relaton-ietf 1.13.4 → 1.13.6

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: 8d5d9ec768b99a9f7dc61438afe510562005322438b5fff41fe04069111d73e0
4
+ data.tar.gz: 410398ba75786d32f94fb8e90303f507e6842b5eee84d57c3647bee8d539975c
5
5
  SHA512:
6
- metadata.gz: cc5e578aa8f3669bd0a4edea2de81ec2b4413d4c35c569458bf8b30ac4f8d05e777aaf7180d4c2488041cfc8f0963e4730cb7364668e95c0f166bd81f189e84d
7
- data.tar.gz: 64ff855b716bc70c09c3790bf7bb24fb2d208aee7ef92080d74d72e1a4425183d4ccf0d3ed33530c8a63fe41260cbac589618e82b3f0c12280dfcd4715e2f4fb
6
+ metadata.gz: 2bf9b65a7fd0e7b4702ddf9b35e8be78a308dccfaa85b83b9def4ea37192718abced81fb02e58d356ee600b421cde8deb190e8e3ffa10adc5882fad10b6db92b
7
+ data.tar.gz: 1edd378c32a456117f226dbef2b851f761e50e618b8962e022df096ac1557f7f081b1010c5e1cd22986b92b3bb593d58848703105631eb4f01b612f5e8fe3456
@@ -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,107 @@ 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, name = 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, name, lang, script),
114
+ surname: localized_string(surname, lang, script)
87
115
  )
88
116
  end
89
117
 
90
- def parse_surname_initials(author)
91
- 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]
118
+ #
119
+ # Create forenames with initials
120
+ #
121
+ # @param [String] initials initials
122
+ # @param [String] lang language
123
+ #
124
+ # @return [Array<RelatonBib::Forename>] forenames
125
+ #
126
+ def forename(initials, name, lang = nil, script = nil)
127
+ fnames = []
128
+ if name
129
+ fnames << RelatonBib::Forename.new(content: name, language: lang, script: script)
130
+ end
131
+ return fnames unless initials
132
+
133
+ initials.split(/\.-?\s?|\s/).each_with_object(fnames) do |i, a|
134
+ a << RelatonBib::Forename.new(initial: i, language: lang, script: script)
135
+ end
136
+ end
137
+
138
+ #
139
+ # Parse name, surname, and initials from full name
140
+ #
141
+ # @param [String] fname full name
142
+ # @param [String, nil] sname surname
143
+ # @param [String, nil] inits
144
+ #
145
+ # @return [Array<String, nil>] surname, initials, forename
146
+ #
147
+ def parse_surname_initials(fname, sname, inits)
148
+ regex = /(?:(?<name>\w{3,})\s)?(?<inits>(?:[A-Z]{1,2}(?:\.[\s-]?|\s))+)?/
149
+ match = fname.match(regex)
150
+ surname = sname || fname.sub(regex, "").strip
151
+ initials = inits || match[:inits]&.strip
152
+ [surname, initials, match[:name]]
95
153
  end
96
154
  end
97
155
  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.6".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.6
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-29 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: