relaton-ietf 1.13.1 → 1.13.3

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: e6fed6cd142a3168d65cfd06e4e1ff063dfd4e7bb2437ce7c1c332631307d369
4
- data.tar.gz: 5af1d834979a4f2ae447865fa898da361b01019b37e113e087ce18402f9ba71b
3
+ metadata.gz: 6fe51d3e7f18e3e3b6c093ee78a24c917cdfd95d88bab7035078c8627a35f0fb
4
+ data.tar.gz: 29b83fa09d9a1b403fdeef78ef77297b8911d7ab222a2b4cf47a60ffd5b7a8d6
5
5
  SHA512:
6
- metadata.gz: 4051003063ece4084190e58e16b5b5e75cd9d8b38790bbf6d3844e1d57e7a5e6df2bfeba1d346cb777c442ce310dc10f296952099f239652c6d070e845992aef
7
- data.tar.gz: 5e4fb7efd0c16218fc675c0a3b1bca4299606fa992608dc3a165108679abf391d24d5d7cdacd38d31752aa96019408ac7e9b4c39ec22244fe1914d4f3c4f50b1
6
+ metadata.gz: 98e68d59cc3b1c53c6c3ed3a845a05b9f2f2ceca3a60b6f63bb952fc51dcf81cfe8ebe7e62e9fbfaadd30a2268ded0dbf1c947e6c6c3f17e91bf76bd0feb4a70
7
+ data.tar.gz: ccf02324637a7da4cb8b960c5ed05363e399dd4da11578f50254dc783662aa82b4da87b4ca031bd8cc9de9c5500bc41741d98e9c63314e29771bd1ef7a62be2c
@@ -5,7 +5,6 @@ name: rake
5
5
  on:
6
6
  push:
7
7
  branches: [ master, main ]
8
- tags: [ v* ]
9
8
  pull_request:
10
9
 
11
10
  jobs:
@@ -0,0 +1,22 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: release
4
+
5
+ on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ next_version:
9
+ description: |
10
+ Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
11
+ required: true
12
+ default: 'skip'
13
+ push:
14
+ tags: [ v* ]
15
+
16
+ jobs:
17
+ release:
18
+ uses: relaton/support/.github/workflows/release.yml@master
19
+ with:
20
+ next_version: ${{ github.event.inputs.next_version }}
21
+ secrets:
22
+ rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
@@ -3,11 +3,30 @@ 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
+
6
25
  # @param attrs [Hash]
7
26
  # @return [RelatonIetf::IetfBibliographicItem]
8
27
  def bib_item(**attrs)
9
28
  unless attrs.delete(:is_relation)
10
- attrs[:fetched] = Date.today.to_s
29
+ # attrs[:fetched] = Date.today.to_s
11
30
  # attrs[:place] = ["Fremont, CA"]
12
31
  end
13
32
  RelatonIetf::IetfBibliographicItem.new(**attrs)
@@ -46,7 +65,40 @@ module RelatonIetf
46
65
  }
47
66
  end
48
67
  contribs + super
49
- # persons(reference) + organizations(reference)
68
+ end
69
+
70
+ #
71
+ # Overrade RelatonBib::BibXMLParser#full_name method
72
+ #
73
+ # @param author [Nokogiri::XML::Element]
74
+ # @param reference [Nokogiri::XML::Element]
75
+ #
76
+ # @return [RelatonBib::FullName]
77
+ #
78
+ def full_name(author, reference)
79
+ lang = language reference
80
+ sname, inits = parse_surname_initials author
81
+ initials = localized_string(inits, lang)
82
+ RelatonBib::FullName.new(
83
+ completename: localized_string(author[:fullname], lang),
84
+ initials: initials, forename: forename(inits, lang),
85
+ surname: localized_string(sname, lang)
86
+ )
87
+ end
88
+
89
+ def parse_surname_initials(author)
90
+ 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
50
102
  end
51
103
  end
52
104
  end
@@ -122,7 +122,7 @@ module RelatonIetf
122
122
  last_v = HashConverter.hash_to_bib YAML.load_file("#{@output}/#{vs.last}.#{@ext}")
123
123
  bib = IetfBibliographicItem.new(
124
124
  title: last_v[:title], abstract: last_v[:abstract], formattedref: fref,
125
- fetched: Date.today.to_s, docid: [docid], relation: rel
125
+ docid: [docid], relation: rel
126
126
  )
127
127
  save_doc bib
128
128
  end
@@ -30,7 +30,6 @@ module RelatonIetf
30
30
  type: "standard",
31
31
  language: ["en"],
32
32
  script: ["Latn"],
33
- fetched: Date.today.to_s,
34
33
  docid: parse_docid,
35
34
  docnumber: code,
36
35
  title: parse_title,
@@ -150,7 +149,7 @@ module RelatonIetf
150
149
  #
151
150
  # @return [Array<RelatonBib::ContributionInfo>] document contributors
152
151
  #
153
- def parse_contributor # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
152
+ def parse_contributor # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
154
153
  @doc.xpath("./xmlns:author").map do |contrib| # rubocop:disable Metrics/BlockLength
155
154
  n = contrib.at("./xmlns:name").text
156
155
  case n
@@ -158,12 +157,16 @@ module RelatonIetf
158
157
  entity = RelatonBib::Organization.new(abbrev: n, name: "International Organization for Standardization")
159
158
  when "International Organization for Standardization"
160
159
  entity = RelatonBib::Organization.new(abbrev: "ISO", name: n)
161
- when "IAB"
162
- entity = RelatonBib::Organization.new(abbrev: n, name: "Internet Architecture Board")
163
- when "IESG"
164
- entity = RelatonBib::Organization.new(abbrev: n, name: "Internet Engineering Steering Group")
165
- when "Internet Engineering Steering Group", "Federal Networking Council", "Internet Architecture Board",
166
- "Internet Activities Board", "Defense Advanced Research Projects Agency", "National Science Foundation",
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",
167
170
  "National Research Council", "National Bureau of Standards"
168
171
  abbr = n.split.map { |w| w[0] if w[0] == w[0].upcase }.join
169
172
  entity = RelatonBib::Organization.new(abbrev: abbr, name: n)
@@ -194,20 +197,23 @@ module RelatonIetf
194
197
  )
195
198
  entity = RelatonBib::Person.new(name: fname)
196
199
  end
197
- RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib))
200
+ RelatonBib::ContributionInfo.new(entity: entity, role: parse_role(contrib, desc))
198
201
  end
199
202
  end
200
203
 
201
204
  #
202
205
  # Parse contributors role
203
206
  #
204
- # @param [Nokogiri::XML::Node] contrib <description>
207
+ # @param [Nokogiri::XML::Node] contrib contributor
208
+ # @param [String, nil] desc contributor description
205
209
  #
206
- # @return [Array<Hash>] contributors role
210
+ # @return [Array<Hash>] contributor's role
207
211
  #
208
- def parse_role(contrib)
212
+ def parse_role(contrib, desc = nil)
209
213
  type = contrib.at("./xmlns:title")&.text&.downcase || "author"
210
- [{ type: type }]
214
+ role = { type: type }
215
+ role[:description] = [desc] if desc
216
+ [role]
211
217
  end
212
218
 
213
219
  #
@@ -37,7 +37,6 @@ module RelatonIetf
37
37
  #
38
38
  def parse # rubocop:disable Metrics/MethodLength
39
39
  IetfBibliographicItem.new(
40
- fetched: Date.today.to_s,
41
40
  title: make_title,
42
41
  docnumber: docnumber,
43
42
  type: "standard",
@@ -39,7 +39,11 @@ module RelatonIetf
39
39
  uri = "#{ghurl}#{ref.sub(/\s|\u00a0/, '.')}.yaml"
40
40
  # BibXMLParser.parse get_page(uri), is_relation: is_relation, ver: ver
41
41
  resp = get_page uri
42
- IetfBibliographicItem.from_hash YAML.safe_load(resp) if resp
42
+ return unless resp
43
+
44
+ hash = YAML.safe_load resp
45
+ hash["fetched"] = Date.today.to_s
46
+ IetfBibliographicItem.from_hash hash
43
47
  end
44
48
 
45
49
  # @param uri [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.13.1".freeze
2
+ VERSION = "1.13.3".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.0"
41
+ spec.add_dependency "relaton-bib", "~> 1.13.10"
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.1
4
+ version: 1.13.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-24 00:00:00.000000000 Z
11
+ date: 2022-10-17 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.0
131
+ version: 1.13.10
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.0
138
+ version: 1.13.10
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:
@@ -145,6 +145,7 @@ extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - ".github/workflows/rake.yml"
148
+ - ".github/workflows/release.yml"
148
149
  - ".gitignore"
149
150
  - ".hound.yml"
150
151
  - ".rspec"
@@ -180,7 +181,7 @@ homepage: https://github.com/metanorma/relaton-ietf
180
181
  licenses:
181
182
  - BSD-2-Clause
182
183
  metadata: {}
183
- post_install_message:
184
+ post_install_message:
184
185
  rdoc_options: []
185
186
  require_paths:
186
187
  - lib
@@ -195,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
196
  - !ruby/object:Gem::Version
196
197
  version: '0'
197
198
  requirements: []
198
- rubygems_version: 3.2.3
199
- signing_key:
199
+ rubygems_version: 3.1.6
200
+ signing_key:
200
201
  specification_version: 4
201
202
  summary: 'RelatonIetf: retrieve IETF Standards for bibliographic use using the BibliographicItem
202
203
  model'