relaton-bib 2.0.0.pre.alpha.1 → 2.0.0

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +1 -1
  4. data/CLAUDE.md +96 -0
  5. data/Gemfile +1 -0
  6. data/README.adoc +14 -2
  7. data/grammars/basicdoc.rng +75 -45
  8. data/grammars/biblio-standoc.rng +37 -56
  9. data/grammars/biblio.rng +68 -36
  10. data/grammars/versions.json +25 -25
  11. data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
  12. data/lib/relaton/bib/converter/asciibib.rb +13 -0
  13. data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
  14. data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
  15. data/lib/relaton/bib/converter/bibtex.rb +23 -0
  16. data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +383 -0
  17. data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
  18. data/lib/relaton/bib/{renderer/rfc.rb → converter/bibxml/to_rfcxml.rb} +100 -92
  19. data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
  20. data/lib/relaton/bib/converter/bibxml.rb +51 -0
  21. data/lib/relaton/bib/hash_parser_v1.rb +121 -78
  22. data/lib/relaton/bib/item_data.rb +83 -22
  23. data/lib/relaton/bib/model/abstract.rb +16 -0
  24. data/lib/relaton/bib/model/date.rb +6 -4
  25. data/lib/relaton/bib/model/depiction.rb +2 -0
  26. data/lib/relaton/bib/model/ext.rb +0 -3
  27. data/lib/relaton/bib/model/formattedref.rb +43 -0
  28. data/lib/relaton/bib/model/ics.rb +9 -0
  29. data/lib/relaton/bib/model/item.rb +12 -4
  30. data/lib/relaton/bib/model/item_base.rb +17 -9
  31. data/lib/relaton/bib/model/keyword.rb +3 -3
  32. data/lib/relaton/bib/model/logo.rb +2 -0
  33. data/lib/relaton/bib/model/organization_type.rb +1 -1
  34. data/lib/relaton/bib/model/relation.rb +2 -2
  35. data/lib/relaton/bib/model/series.rb +5 -3
  36. data/lib/relaton/bib/model/subdivision.rb +2 -0
  37. data/lib/relaton/bib/model/title.rb +38 -0
  38. data/lib/relaton/bib/model/type/string_date.rb +48 -0
  39. data/lib/relaton/bib/model/validity.rb +3 -3
  40. data/lib/relaton/bib/namespace_helper.rb +21 -0
  41. data/lib/relaton/bib/version.rb +1 -1
  42. data/lib/relaton/bib.rb +5 -82
  43. data/relaton-bib.gemspec +5 -2
  44. metadata +63 -29
  45. data/lib/relaton/bib/model/editorial_group.rb +0 -14
  46. data/lib/relaton/bib/model/technical_committee.rb +0 -14
  47. data/lib/relaton/bib/model/workgroup.rb +0 -20
  48. data/lib/relaton/bib/parser/rfc_address.rb +0 -60
  49. data/lib/relaton/bib/parser/rfc_contacts.rb +0 -35
  50. data/lib/relaton/bib/parser/rfc_docidentifier.rb +0 -70
  51. data/lib/relaton/bib/parser/rfc_organization.rb +0 -31
  52. data/lib/relaton/bib/parser/rfc_person.rb +0 -42
  53. data/lib/relaton/bib/parser/rfc_reference.rb +0 -143
  54. data/lib/relaton/bib/parser/rfc_referencegroup.rb +0 -45
  55. data/lib/relaton/bib/parser/rfc_shared.rb +0 -23
  56. data/lib/relaton/bib/renderer/bibtex_builder.rb +0 -348
  57. data/lib/relaton/bibtex_parser.rb +0 -243
  58. data/lib/relaton/bibxml_parser.rb +0 -419
  59. data/lib/relaton/deep_dup.rb +0 -30
  60. data/lib/relaton/hit.rb +0 -52
  61. data/lib/relaton/hit_collection.rb +0 -105
  62. data/lib/relaton/workers_pool.rb +0 -43
  63. data/lib/relaton/xml_parser.rb +0 -716
data/lib/relaton/bib.rb CHANGED
@@ -4,18 +4,18 @@ require "forwardable"
4
4
  require "bibtex"
5
5
  require "iso639"
6
6
  require "rfcxml"
7
+ require "relaton/core"
7
8
  require_relative "bib/version"
8
9
  require_relative "bib/util"
10
+ require_relative "bib/namespace_helper"
9
11
  require_relative "bib/item_data"
10
12
  require_relative "bib/model/item"
11
13
  require_relative "bib/model/item_base"
12
14
  require_relative "bib/model/bibitem"
13
15
  require_relative "bib/model/bibdata"
14
- require_relative "bibxml_parser"
15
- require_relative "bib/renderer/bibtex_builder"
16
- require_relative "bib/renderer/rfc"
17
- require_relative "bib/parser/rfc_reference"
18
- require_relative "bib/parser/rfc_referencegroup"
16
+ require_relative "bib/converter/bibxml"
17
+ require_relative "bib/converter/bibtex"
18
+ require_relative "bib/converter/asciibib"
19
19
  require_relative "bib/model/relation"
20
20
 
21
21
  module Relaton
@@ -32,71 +32,6 @@ module Relaton
32
32
  def schema_versions
33
33
  @@schema_versions ||= JSON.parse File.read(File.join(__dir__, "../../grammars/versions.json"))
34
34
  end
35
-
36
- # @param date [String, Integer, Date] date
37
- # @param str [Boolean] return string or Date
38
- # @return [Date, String, nil] date
39
- def parse_date(date, str: true) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength
40
- return date if date.is_a?(Date)
41
-
42
- case date.to_s
43
- when /(?<date>\w+\s\d{4})/ # February 2012
44
- format_date $~[:date], "%B %Y", str, "%Y-%m"
45
- when /(?<date>\w+\s\d{1,2},\s\d{4})/ # February 11, 2012
46
- format_date $~[:date], "%B %d, %Y", str, "%Y-%m-%d"
47
- when /(?<date>\d{4}-\d{1,2}-\d{1,2})/ # 2012-02-03 or 2012-2-3
48
- format_date $~[:date], "%Y-%m-%d", str
49
- when /(?<date>\d{4}-\d{1,2})/ # 2012-02 or 2012-2
50
- format_date $~[:date], "%Y-%m", str
51
- when /(?<date>\d{4})/ # 2012
52
- format_date $~[:date], "%Y", str
53
- end
54
- end
55
-
56
- #
57
- # Parse date string to Date object and format it
58
- #
59
- # @param [String] date date string
60
- # @param [String] format format string
61
- # @param [Boolean] str return string if true in other case return Date
62
- # @param [String, nil] outformat output format
63
- #
64
- # @return [Date, String] date object or formatted date string
65
- #
66
- def format_date(date, format, str, outformat = nil)
67
- date = Date.strptime(date, format)
68
- str ? date.strftime(outformat || format) : date
69
- rescue Date::Error => e
70
- Bib::Util.warn "#{date} #{e.message}"
71
- date
72
- end
73
-
74
- # @param arr [nil, Array, #is_a?]
75
- # @return [Array]
76
- def array(arr)
77
- return [] unless arr
78
- return [arr] unless arr.is_a?(Array)
79
-
80
- arr
81
- end
82
-
83
- #
84
- # Parse yaml content
85
- #
86
- # @param [String] yaml content
87
- # @param [Array] classes classes to be allowed
88
- # @param [Boolean] symbolize_names symbolize names if true (default: false)
89
- #
90
- # @return [Hash] data
91
- #
92
- def parse_yaml(yaml, classes = [], symbolize_names: false)
93
- # Newer versions of Psych uses the `permitted_classes:` parameter
94
- if YAML.method(:safe_load).parameters.map(&:last).include? :permitted_classes
95
- YAML.safe_load(yaml, permitted_classes: classes, symbolize_names: symbolize_names)
96
- else
97
- YAML.safe_load(yaml, classes, symbolize_names: symbolize_names)
98
- end
99
- end
100
35
  end
101
36
 
102
37
  module Bib
@@ -107,16 +42,4 @@ module Relaton
107
42
  Digest::MD5.hexdigest Relaton::Bib::VERSION # grammars
108
43
  end
109
44
  end
110
-
111
- # private
112
-
113
- # # @param array [Array]
114
- # # @return [Array<String>, String]
115
- # def single_element_array(array)
116
- # # if array.size > 1
117
- # array.map { |e| e.is_a?(String) ? e : e.to_hash }
118
- # # else
119
- # # array.first.is_a?(String) ? array[0] : array.first&.to_hash
120
- # # end
121
- # end
122
45
  end
data/relaton-bib.gemspec CHANGED
@@ -21,12 +21,15 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = "exe"
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
- spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
24
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
25
25
 
26
26
  spec.add_dependency "bibtex-ruby"
27
27
  spec.add_dependency "iso639"
28
+ spec.add_dependency "isoics", "~> 0.1.0"
28
29
  spec.add_dependency "lutaml-model", "~> 0.7"
29
- spec.add_dependency "nokogiri", "~> 1.16.0"
30
+ spec.add_dependency "nokogiri", ">= 1.16"
31
+ spec.add_dependency "psych", "~> 5.2.0" # versin 5.3.0 crashes
32
+ spec.add_dependency "relaton-core", "~> 0.0.8"
30
33
  spec.add_dependency "relaton-logger", "~> 0.2.0"
31
34
  spec.add_dependency "rfcxml", "~> 0.2.1"
32
35
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-04-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bibtex-ruby
@@ -38,6 +37,20 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: isoics
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: 0.1.0
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.1.0
41
54
  - !ruby/object:Gem::Dependency
42
55
  name: lutaml-model
43
56
  requirement: !ruby/object:Gem::Requirement
@@ -54,18 +67,46 @@ dependencies:
54
67
  version: '0.7'
55
68
  - !ruby/object:Gem::Dependency
56
69
  name: nokogiri
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '1.16'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '1.16'
82
+ - !ruby/object:Gem::Dependency
83
+ name: psych
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 5.2.0
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: 5.2.0
96
+ - !ruby/object:Gem::Dependency
97
+ name: relaton-core
57
98
  requirement: !ruby/object:Gem::Requirement
58
99
  requirements:
59
100
  - - "~>"
60
101
  - !ruby/object:Gem::Version
61
- version: 1.16.0
102
+ version: 0.0.8
62
103
  type: :runtime
63
104
  prerelease: false
64
105
  version_requirements: !ruby/object:Gem::Requirement
65
106
  requirements:
66
107
  - - "~>"
67
108
  - !ruby/object:Gem::Version
68
- version: 1.16.0
109
+ version: 0.0.8
69
110
  - !ruby/object:Gem::Dependency
70
111
  name: relaton-logger
71
112
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +150,7 @@ files:
109
150
  - ".hound.yml"
110
151
  - ".rspec"
111
152
  - ".rubocop.yml"
153
+ - CLAUDE.md
112
154
  - Gemfile
113
155
  - LICENSE.txt
114
156
  - README.adoc
@@ -123,8 +165,19 @@ files:
123
165
  - grammars/biblio.rng
124
166
  - grammars/versions.json
125
167
  - lib/relaton/bib.rb
168
+ - lib/relaton/bib/converter/asciibib.rb
169
+ - lib/relaton/bib/converter/asciibib/to_asciibib.rb
170
+ - lib/relaton/bib/converter/bibtex.rb
171
+ - lib/relaton/bib/converter/bibtex/from_bibtex.rb
172
+ - lib/relaton/bib/converter/bibtex/to_bibtex.rb
173
+ - lib/relaton/bib/converter/bibxml.rb
174
+ - lib/relaton/bib/converter/bibxml/from_rfcxml.rb
175
+ - lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb
176
+ - lib/relaton/bib/converter/bibxml/to_rfcxml.rb
177
+ - lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb
126
178
  - lib/relaton/bib/hash_parser_v1.rb
127
179
  - lib/relaton/bib/item_data.rb
180
+ - lib/relaton/bib/model/abstract.rb
128
181
  - lib/relaton/bib/model/address.rb
129
182
  - lib/relaton/bib/model/affiliation.rb
130
183
  - lib/relaton/bib/model/bibdata.rb
@@ -138,9 +191,9 @@ files:
138
191
  - lib/relaton/bib/model/docidentifier.rb
139
192
  - lib/relaton/bib/model/doctype.rb
140
193
  - lib/relaton/bib/model/edition.rb
141
- - lib/relaton/bib/model/editorial_group.rb
142
194
  - lib/relaton/bib/model/ext.rb
143
195
  - lib/relaton/bib/model/extent.rb
196
+ - lib/relaton/bib/model/formattedref.rb
144
197
  - lib/relaton/bib/model/full_name_type.rb
145
198
  - lib/relaton/bib/model/fullname.rb
146
199
  - lib/relaton/bib/model/ics.rb
@@ -168,37 +221,19 @@ files:
168
221
  - lib/relaton/bib/model/status.rb
169
222
  - lib/relaton/bib/model/structured_identifier.rb
170
223
  - lib/relaton/bib/model/subdivision.rb
171
- - lib/relaton/bib/model/technical_committee.rb
172
224
  - lib/relaton/bib/model/title.rb
225
+ - lib/relaton/bib/model/type/string_date.rb
173
226
  - lib/relaton/bib/model/uri.rb
174
227
  - lib/relaton/bib/model/validity.rb
175
228
  - lib/relaton/bib/model/version.rb
176
- - lib/relaton/bib/model/workgroup.rb
177
- - lib/relaton/bib/parser/rfc_address.rb
178
- - lib/relaton/bib/parser/rfc_contacts.rb
179
- - lib/relaton/bib/parser/rfc_docidentifier.rb
180
- - lib/relaton/bib/parser/rfc_organization.rb
181
- - lib/relaton/bib/parser/rfc_person.rb
182
- - lib/relaton/bib/parser/rfc_reference.rb
183
- - lib/relaton/bib/parser/rfc_referencegroup.rb
184
- - lib/relaton/bib/parser/rfc_shared.rb
185
- - lib/relaton/bib/renderer/bibtex_builder.rb
186
- - lib/relaton/bib/renderer/rfc.rb
229
+ - lib/relaton/bib/namespace_helper.rb
187
230
  - lib/relaton/bib/util.rb
188
231
  - lib/relaton/bib/version.rb
189
- - lib/relaton/bibtex_parser.rb
190
- - lib/relaton/bibxml_parser.rb
191
- - lib/relaton/deep_dup.rb
192
- - lib/relaton/hit.rb
193
- - lib/relaton/hit_collection.rb
194
- - lib/relaton/workers_pool.rb
195
- - lib/relaton/xml_parser.rb
196
232
  - relaton-bib.gemspec
197
233
  homepage: https://github.com/relaton/relaton-bib
198
234
  licenses:
199
235
  - BSD-2-Clause
200
236
  metadata: {}
201
- post_install_message:
202
237
  rdoc_options: []
203
238
  require_paths:
204
239
  - lib
@@ -206,15 +241,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
241
  requirements:
207
242
  - - ">="
208
243
  - !ruby/object:Gem::Version
209
- version: 3.1.0
244
+ version: 3.2.0
210
245
  required_rubygems_version: !ruby/object:Gem::Requirement
211
246
  requirements:
212
247
  - - ">="
213
248
  - !ruby/object:Gem::Version
214
249
  version: '0'
215
250
  requirements: []
216
- rubygems_version: 3.5.11
217
- signing_key:
251
+ rubygems_version: 3.6.9
218
252
  specification_version: 4
219
253
  summary: 'Relaton::Bib: Ruby XMLDOC impementation.'
220
254
  test_files: []
@@ -1,14 +0,0 @@
1
- require_relative "workgroup"
2
-
3
- module Relaton
4
- module Bib
5
- class EditorialGroup < Lutaml::Model::Serializable
6
- attribute :technical_committee, WorkGroup, collection: true, initialize_empty: true
7
-
8
- xml do
9
- root "editorialgroup"
10
- map_element "technical-committee", to: :technical_committee
11
- end
12
- end
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- require_relative "workgroup"
2
-
3
- module Relaton
4
- module Bib
5
- class TechnicalCommittee < Lutaml::Model::Serializable
6
- attribute :workgroup, WorkGroup
7
-
8
- xml do
9
- root "technical-committee"
10
- map_content to: :workgroup
11
- end
12
- end
13
- end
14
- end
@@ -1,20 +0,0 @@
1
- module Relaton
2
- module Bib
3
- class WorkGroup < Lutaml::Model::Serializable
4
- attribute :number, :integer
5
- attribute :type, :string
6
- attribute :identifier, :string
7
- attribute :prefix, :string
8
- attribute :content, :string
9
-
10
- xml do
11
- root "workgroup"
12
- map_attribute "number", to: :number
13
- map_attribute "type", to: :type
14
- map_attribute "identifier", to: :identifier
15
- map_attribute "prefix", to: :prefix
16
- map_content to: :content
17
- end
18
- end
19
- end
20
- end
@@ -1,60 +0,0 @@
1
- module Relaton
2
- module Bib
3
- module Parser
4
- # Class for transforming RFC Postal to Relaton Address
5
- class RfcAddress
6
- def initialize(postal)
7
- @postal = postal
8
- end
9
-
10
- #
11
- # Transform address from RFC Postal to Relaton Address
12
- #
13
- # @param [Rfcxml::V3::Address] address RFC Address
14
- #
15
- # @return [Array<Relaton::Bib::Address>]
16
- #
17
- def self.transform(address)
18
- return [] unless address&.postal
19
-
20
- new(address.postal).transform
21
- end
22
-
23
- def transform # rubocop:disable Metrics/CyclomaticComplexity
24
- street = @postal.street || []
25
- city = @postal.city || []
26
- region = @postal.region || []
27
- country = @postal.country || []
28
- code = @postal.code || []
29
- postal_line = @postal.postal_line || []
30
- transform_args(
31
- street: street, city: city, region: region, country: country, code: code, postal_line: postal_line,
32
- )
33
- end
34
-
35
- def transform_args(**args)
36
- i = 0
37
- addrs = []
38
- while args.values.any? { |v| v[i] }
39
- addrs << create_address(**args.transform_values { |v| v[i] })
40
- i += 1
41
- end
42
- addrs
43
- end
44
-
45
- def create_address(**args) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/AbcSize,Metrics/PerceivedComplexity
46
- street = []
47
- street << args[:street]&.content if args[:street]
48
- Address.new(
49
- street: street,
50
- city: args[:city]&.content,
51
- state: args[:region]&.content,
52
- country: args[:country]&.content,
53
- postcode: args[:code]&.content,
54
- formatted_address: args[:postal_line]&.content,
55
- )
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,35 +0,0 @@
1
- require_relative "rfc_address"
2
-
3
- module Relaton
4
- module Bib
5
- module Parser
6
- module RfcContacts
7
- def initialize(author)
8
- @author = author
9
- end
10
-
11
- def address
12
- RfcAddress.transform(@author.address)
13
- end
14
-
15
- def phone
16
- return [] unless @author.address&.phone
17
-
18
- [Phone.new(content: @author.address.phone.content)]
19
- end
20
-
21
- def email
22
- return [] unless @author.address&.email
23
-
24
- @author.address.email.map(&:content)
25
- end
26
-
27
- def uri
28
- return [] unless @author.address&.uri
29
-
30
- [Uri.new(content: @author.address.uri.content)]
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,70 +0,0 @@
1
- module Relaton
2
- module Bib
3
- module Parser
4
- class RfcDocidentifier
5
- RFCPREFIXES = %w[RFC BCP FYI STD].freeze
6
-
7
- def initialize(reference)
8
- @reference = reference
9
- end
10
-
11
- def transform
12
- docids = [create_docid(@reference.anchor, primary: true)]
13
- create_internet_draft_id { |id| docids << id }
14
- docids + docid_from_sereies_info
15
- end
16
-
17
- def create_docid(id, primary: false) # , ver) # rubocop:disable Metrics/MethodLength
18
- pref, num = id_to_pref_num(id)
19
- if RFCPREFIXES.include?(pref)
20
- pid = "#{pref} #{num.sub(/^-?0+/, '')}"
21
- type = pubid_type id
22
- elsif %w[I-D draft].include?(pref)
23
- pid = "draft-#{num}"
24
- type = "Internet-Draft"
25
- else
26
- pid = pref ? "#{pref} #{num}" : id
27
- type = pubid_type id
28
- end
29
- Docidentifier.new(type: type, content: pid, primary: primary)
30
- end
31
-
32
- def pubid_type(id)
33
- id_to_pref_num(id)&.first
34
- end
35
-
36
- def id_to_pref_num(id)
37
- tn = /^(?<pref>I-D|draft|3GPP|W3C|[A-Z]{2,})[._-]?(?<num>.+)/.match id
38
- tn && tn.to_a[1..2]
39
- end
40
-
41
- def create_internet_draft_id
42
- return unless @reference.respond_to?(:front) && @reference.front
43
-
44
- si = internet_draft_series_info(@reference.front) || internet_draft_series_info(@reference)
45
- if si
46
- content = si.value
47
- yield Docidentifier.new(type: "Internet-Draft", content: content)
48
- end
49
- end
50
-
51
- def internet_draft_series_info(parent)
52
- (parent.series_info || []).find { |si| si.name == "Internet-Draft" }
53
- end
54
-
55
- def docid_from_sereies_info # rubocop:disable Metrics/CyclomaticComplexity
56
- return [] unless @reference.respond_to?(:front) && @reference.front
57
-
58
- si = (@reference.front.series_info || []) + (@reference.series_info || [])
59
- si.reduce([]) do |acc, s|
60
- next acc unless s.name.casecmp("doi").zero?
61
-
62
- acc << Docidentifier.new(type: "DOI", content: s.value)
63
- end
64
- end
65
-
66
- def create_docidentifier(**args) = Docidentifier.new(**args)
67
- end
68
- end
69
- end
70
- end
@@ -1,31 +0,0 @@
1
- module Relaton
2
- module Bib
3
- module Parser
4
- class RfcOrganization
5
- ORGNAMES = {
6
- "IEEE" => "Institute of Electrical and Electronics Engineers",
7
- "W3C" => "World Wide Web Consortium",
8
- "3GPP" => "3rd Generation Partnership Project",
9
- }.freeze
10
-
11
- include RfcContacts
12
-
13
- def self.transform(author)
14
- org = author.organization
15
- return if org.nil? || org.content.empty?
16
-
17
- new(author).transform
18
- end
19
-
20
- def transform
21
- name = ORGNAMES[@author.organization.content] || @author.organization.content
22
- orgname = TypedLocalizedString.new(content: name, language: "en")
23
- abbrev = LocalizedString.new(content: @author.organization.abbrev, language: "en")
24
- Organization.new(
25
- name: [orgname], abbreviation: abbrev, address: address, phone: phone, email: email, uri: uri,
26
- )
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,42 +0,0 @@
1
- module Relaton
2
- module Bib
3
- module Parser
4
- class RfcPerson
5
- include RfcContacts
6
-
7
- def self.transform(author)
8
- return unless author.fullname || author.surname
9
-
10
- new(author).transform
11
- end
12
-
13
- def transform
14
- Person.new(
15
- name: name, affiliation: affiliation, address: address, phone: phone, email: email, uri: uri,
16
- )
17
- end
18
-
19
- def name
20
- FullName.new(
21
- completename: LocalizedString.new(content: @author.fullname, language: "en"),
22
- formatted_initials: initials,
23
- surname: LocalizedString.new(content: @author.surname, language: "en"),
24
- )
25
- end
26
-
27
- def initials
28
- return unless @author.initials
29
-
30
- LocalizedString.new(content: @author.initials, language: "en")
31
- end
32
-
33
- def affiliation
34
- org = RfcOrganization.transform(@author)
35
- return [] unless org
36
-
37
- [Affiliation.new(organization: org)]
38
- end
39
- end
40
- end
41
- end
42
- end