relaton-ietf 1.14.4 → 1.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -0
- data/grammars/relaton-ietf.rng +15 -0
- data/lib/relaton_ietf/hash_converter.rb +12 -0
- data/lib/relaton_ietf/ietf_bibliographic_item.rb +34 -5
- data/lib/relaton_ietf/rfc_entry.rb +3 -2
- data/lib/relaton_ietf/rfc_index_entry.rb +2 -1
- data/lib/relaton_ietf/version.rb +1 -1
- data/lib/relaton_ietf/xml_parser.rb +6 -0
- data/relaton_ietf.gemspec +1 -5
- metadata +4 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa4b15e1b13a21f94aa87731fe6d49a83422a426b299ef3fa4378d65dbdf79a2
|
4
|
+
data.tar.gz: 6c3e630920810ca3bc881e794e36cd3e9898174eab83ed420fe18d36c8f641ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e6cb43373347a061abf880ee44691c7f0f324823290ae5dcb3deb93d5f8754034d34ccf1a2a1c27b2a176c6f7f3d6f6d160c22c53b91a87e939bea653af900a
|
7
|
+
data.tar.gz: fd4edf41ff906d5c5fdf3aea055a103e197deaf21d80af892428664abe078196ad49ca5c3521ae741d305c6e1f1eba7b6fd61e15d8aa55ae06d9adb020f926a2
|
data/Gemfile
CHANGED
@@ -5,6 +5,10 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
5
5
|
# Specify your gem's dependencies in relaton_ietf.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
gem "rspec", "~> 3.0"
|
10
|
+
|
11
|
+
gem "equivalent-xml"
|
8
12
|
gem "pry-byebug"
|
9
13
|
gem "ruby-jing"
|
10
14
|
gem "simplecov"
|
data/grammars/relaton-ietf.rng
CHANGED
@@ -26,6 +26,9 @@
|
|
26
26
|
<zeroOrMore>
|
27
27
|
<ref name="area"/>
|
28
28
|
</zeroOrMore>
|
29
|
+
<optional>
|
30
|
+
<ref name="stream"/>
|
31
|
+
</optional>
|
29
32
|
<optional>
|
30
33
|
<ref name="ipr"/>
|
31
34
|
</optional>
|
@@ -315,4 +318,16 @@
|
|
315
318
|
</optional>
|
316
319
|
</element>
|
317
320
|
</define>
|
321
|
+
<define name="stream">
|
322
|
+
<element name="stream">
|
323
|
+
<choice>
|
324
|
+
<value>IAB</value>
|
325
|
+
<value>IETF</value>
|
326
|
+
<value>Independent</value>
|
327
|
+
<value>IRTF</value>
|
328
|
+
<value>Legacy</value>
|
329
|
+
<value>Editorial</value>
|
330
|
+
</choice>
|
331
|
+
</element>
|
332
|
+
</define>
|
318
333
|
</grammar>
|
@@ -1,6 +1,14 @@
|
|
1
1
|
module RelatonIetf
|
2
2
|
class HashConverter < RelatonBib::HashConverter
|
3
3
|
class << self
|
4
|
+
def hash_to_bib(hash)
|
5
|
+
ret = super
|
6
|
+
return unless ret
|
7
|
+
|
8
|
+
stream_hash_to_bib ret
|
9
|
+
ret
|
10
|
+
end
|
11
|
+
|
4
12
|
#
|
5
13
|
# Ovverides superclass's method
|
6
14
|
#
|
@@ -19,6 +27,10 @@ module RelatonIetf
|
|
19
27
|
end
|
20
28
|
ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
|
21
29
|
end
|
30
|
+
|
31
|
+
def stream_hash_to_bib(ret)
|
32
|
+
ret[:stream] = ret[:ext][:stream] if ret[:ext]&.key? :stream
|
33
|
+
end
|
22
34
|
end
|
23
35
|
end
|
24
36
|
end
|
@@ -2,18 +2,20 @@ module RelatonIetf
|
|
2
2
|
class IetfBibliographicItem < RelatonBib::BibliographicItem
|
3
3
|
DOCTYPES = %w[rfc internet-draft].freeze
|
4
4
|
|
5
|
-
# @return [String,
|
6
|
-
attr_reader :doctype
|
5
|
+
# @return [String, nil]
|
6
|
+
attr_reader :doctype, :stream
|
7
7
|
|
8
8
|
# @return [Array<String>]
|
9
9
|
attr_reader :keyword
|
10
10
|
|
11
11
|
# @param doctype [String]
|
12
12
|
# @param keyword [Array<String>]
|
13
|
+
# @param stream [String, nil]
|
13
14
|
def initialize(**args)
|
14
15
|
if args[:doctype] && !DOCTYPES.include?(args[:doctype])
|
15
16
|
warn "[relaton-ietf] WARNING: invalid doctype #{args[:doctype]}"
|
16
17
|
end
|
18
|
+
@stream = args.delete(:stream)
|
17
19
|
super
|
18
20
|
end
|
19
21
|
|
@@ -36,12 +38,39 @@ module RelatonIetf
|
|
36
38
|
# @param opts [Hash]
|
37
39
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
38
40
|
# @option opts [Boolean] :bibdata
|
39
|
-
# @option opts [Symbol,
|
41
|
+
# @option opts [Symbol, nil] :date_format (:short), :full
|
40
42
|
# @option opts [String, Symbol] :lang language
|
41
43
|
# @return [String] XML
|
42
|
-
def to_xml(**opts)
|
44
|
+
def to_xml(**opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
|
43
45
|
opts[:date_format] ||= :short
|
44
|
-
super(**opts)
|
46
|
+
super(**opts) do |builder|
|
47
|
+
if opts[:bibdata] && (doctype || editorialgroup || ics&.any? ||
|
48
|
+
structuredidentifier&.presence? || stream)
|
49
|
+
ext = builder.ext do |b|
|
50
|
+
b.doctype doctype if doctype
|
51
|
+
b.subdoctype subdoctype if subdoctype
|
52
|
+
editorialgroup&.to_xml b
|
53
|
+
ics.each { |i| i.to_xml b }
|
54
|
+
b.stream stream if stream
|
55
|
+
structuredidentifier&.to_xml b
|
56
|
+
end
|
57
|
+
ext["schema-version"] = ext_schema if !opts[:embedded] && respond_to?(:ext_schema)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# Render hash
|
64
|
+
#
|
65
|
+
# @return [Hash] docunent hash representation
|
66
|
+
#
|
67
|
+
def to_hash(embedded: false)
|
68
|
+
hash = super
|
69
|
+
return hash unless stream
|
70
|
+
|
71
|
+
hash["ext"] ||= {}
|
72
|
+
hash["ext"]["stream"] = stream
|
73
|
+
hash
|
45
74
|
end
|
46
75
|
|
47
76
|
#
|
@@ -41,6 +41,7 @@ module RelatonIetf
|
|
41
41
|
relation: parse_relation,
|
42
42
|
status: parse_status,
|
43
43
|
series: parse_series,
|
44
|
+
stream: @doc.at("./xmlns:stream")&.text,
|
44
45
|
editorialgroup: parse_editorialgroup,
|
45
46
|
)
|
46
47
|
end
|
@@ -52,7 +53,7 @@ module RelatonIetf
|
|
52
53
|
#
|
53
54
|
def parse_series
|
54
55
|
title = RelatonBib::TypedTitleString.new(content: "RFC")
|
55
|
-
series_is_also +
|
56
|
+
series_is_also + [RelatonBib::Series.new(title: title, number: docnum)] + seires_stream
|
56
57
|
end
|
57
58
|
|
58
59
|
def series_is_also
|
@@ -134,7 +135,7 @@ module RelatonIetf
|
|
134
135
|
#
|
135
136
|
# Create link
|
136
137
|
#
|
137
|
-
# @return [Array<RelatonBib::TypedUri>]
|
138
|
+
# @return [Array<RelatonBib::TypedUri>]
|
138
139
|
#
|
139
140
|
def parse_link
|
140
141
|
url = "https://www.rfc-editor.org/info/rfc#{docnum}"
|
@@ -10,7 +10,7 @@ module RelatonIetf
|
|
10
10
|
def initialize(doc, doc_id, is_also)
|
11
11
|
@doc = doc
|
12
12
|
@name = doc.name.split("-").first
|
13
|
-
@shortnum = doc_id[-4
|
13
|
+
@shortnum = doc_id[-4..].sub(/^0+/, "")
|
14
14
|
@doc_id = doc_id
|
15
15
|
@is_also = is_also
|
16
16
|
end
|
@@ -47,6 +47,7 @@ module RelatonIetf
|
|
47
47
|
formattedref: formattedref,
|
48
48
|
relation: parse_relation,
|
49
49
|
series: parse_series,
|
50
|
+
stream: @doc.at("./xmlns:stream")&.text,
|
50
51
|
)
|
51
52
|
end
|
52
53
|
|
data/lib/relaton_ietf/version.rb
CHANGED
@@ -5,6 +5,12 @@ module RelatonIetf
|
|
5
5
|
class << self
|
6
6
|
private
|
7
7
|
|
8
|
+
def item_data(doc)
|
9
|
+
data = super
|
10
|
+
data[:stream] = doc.at("ext/stream")&.text
|
11
|
+
data
|
12
|
+
end
|
13
|
+
|
8
14
|
# override RelatonBib::BibliographicItem.bib_item method
|
9
15
|
# @param item_hash [Hash]
|
10
16
|
# @return [RelatonIetf::IetfBibliographicItem]
|
data/relaton_ietf.gemspec
CHANGED
@@ -29,10 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
31
31
|
|
32
|
-
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
33
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
34
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
-
|
36
32
|
spec.add_dependency "relaton-bib", "~> 1.14.0"
|
37
|
-
spec.add_dependency "relaton-index", "~> 0.2.
|
33
|
+
spec.add_dependency "relaton-index", "~> 0.2.3"
|
38
34
|
end
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ietf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.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: 2023-
|
11
|
+
date: 2023-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: equivalent-xml
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.6'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0.6'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '13.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '13.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
13
|
- !ruby/object:Gem::Dependency
|
56
14
|
name: relaton-bib
|
57
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +30,14 @@ dependencies:
|
|
72
30
|
requirements:
|
73
31
|
- - "~>"
|
74
32
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.2.
|
33
|
+
version: 0.2.3
|
76
34
|
type: :runtime
|
77
35
|
prerelease: false
|
78
36
|
version_requirements: !ruby/object:Gem::Requirement
|
79
37
|
requirements:
|
80
38
|
- - "~>"
|
81
39
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.2.
|
40
|
+
version: 0.2.3
|
83
41
|
description: |
|
84
42
|
RelatonIetf: retrieve IETF Standards for bibliographic use
|
85
43
|
using the BibliographicItem model.
|