relaton-ietf 1.16.1 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +18 -7
- data/grammars/basicdoc.rng +18 -2
- data/grammars/biblio.rng +1 -0
- data/lib/relaton_ietf/document_type.rb +16 -0
- data/lib/relaton_ietf/hash_converter.rb +30 -26
- data/lib/relaton_ietf/ietf_bibliographic_item.rb +2 -8
- data/lib/relaton_ietf/ietf_bibliography.rb +3 -3
- data/lib/relaton_ietf/version.rb +1 -1
- data/lib/relaton_ietf.rb +1 -0
- data/relaton_ietf.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d0245047f274549b9323c06fe9d63a5150a2fe44ea57d0525aaad767d3c38b8
|
4
|
+
data.tar.gz: dfc5d69ee70eec62f5fe6b43791ab9578db892439dfe296574098c58ae6ca304
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f119f7ac88ecefa74a6baabd10dd410bcd3ad6cae78fe1fc5afebf562cc325d28097174608dacf9a47cb33e08eea1f034442ff38235dc2b44d6721b197c034ee
|
7
|
+
data.tar.gz: 4b7767b7a07caf39cd7c37db98a03ea426149a5f848389d367ce8230c6afd2b92e2dd6e2272899a5726092a3a50f1c183e5e0e186e33e75f59a43fdf48a6ffab
|
data/README.adoc
CHANGED
@@ -33,31 +33,42 @@ Or install it yourself as:
|
|
33
33
|
|
34
34
|
== Usage
|
35
35
|
|
36
|
-
===
|
36
|
+
=== Configuration
|
37
|
+
|
38
|
+
Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonIetf.configure` block.
|
37
39
|
|
38
40
|
[source,ruby]
|
39
41
|
----
|
40
42
|
require 'relaton_ietf'
|
41
43
|
=> true
|
42
44
|
|
45
|
+
RelatonIetf.configure do |config|
|
46
|
+
config.logger.level = Logger::DEBUG
|
47
|
+
end
|
48
|
+
----
|
49
|
+
|
50
|
+
=== Fetching documents
|
51
|
+
|
52
|
+
[source,ruby]
|
53
|
+
----
|
43
54
|
# Fetch RFC document
|
44
55
|
item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
|
45
|
-
[relaton-ietf] (
|
46
|
-
[relaton-ietf] (
|
56
|
+
[relaton-ietf] (IETF RFC 8341) Fetching from Relaton repository ...
|
57
|
+
[relaton-ietf] (IETF RFC 8341) Found: `RFC 8341`
|
47
58
|
=> #<RelatonIetf::IetfBibliographicItem:0x007fd1875e7f58
|
48
59
|
...
|
49
60
|
|
50
61
|
# Fetch Internet-Draft document
|
51
62
|
RelatonIetf::IetfBibliography.get 'IETF I-D.draft-abarth-cake-01'
|
52
|
-
[relaton-ietf] (
|
53
|
-
[relaton-ietf] (
|
63
|
+
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Fetching from Relaton repository ...
|
64
|
+
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Found: `draft-abarth-cake-01`
|
54
65
|
=> #<RelatonIetf::IetfBibliographicItem:0x00007fdd129bbeb8
|
55
66
|
...
|
56
67
|
|
57
68
|
# Return nil if a document doesn't exist.
|
58
69
|
RelatonIetf::IetfBibliography.get 'IETF 1111'
|
59
|
-
[relaton-ietf] (
|
60
|
-
[relaton-ietf] (
|
70
|
+
[relaton-ietf] (IETF 1111) Fetching from Relaton repository ...
|
71
|
+
[relaton-ietf] (IETF 1111) Not found.
|
61
72
|
=> nil
|
62
73
|
----
|
63
74
|
|
data/grammars/basicdoc.rng
CHANGED
@@ -346,6 +346,8 @@
|
|
346
346
|
<ref name="keyword"/>
|
347
347
|
<ref name="xref"/>
|
348
348
|
<ref name="hyperlink"/>
|
349
|
+
<ref name="index"/>
|
350
|
+
<ref name="index-xref"/>
|
349
351
|
</choice>
|
350
352
|
</oneOrMore>
|
351
353
|
</element>
|
@@ -623,6 +625,8 @@
|
|
623
625
|
<ref name="eref"/>
|
624
626
|
<ref name="xref"/>
|
625
627
|
<ref name="hyperlink"/>
|
628
|
+
<ref name="index"/>
|
629
|
+
<ref name="index-xref"/>
|
626
630
|
</choice>
|
627
631
|
</zeroOrMore>
|
628
632
|
</element>
|
@@ -636,6 +640,8 @@
|
|
636
640
|
<ref name="eref"/>
|
637
641
|
<ref name="xref"/>
|
638
642
|
<ref name="hyperlink"/>
|
643
|
+
<ref name="index"/>
|
644
|
+
<ref name="index-xref"/>
|
639
645
|
</choice>
|
640
646
|
</zeroOrMore>
|
641
647
|
</element>
|
@@ -648,6 +654,8 @@
|
|
648
654
|
<ref name="eref"/>
|
649
655
|
<ref name="xref"/>
|
650
656
|
<ref name="hyperlink"/>
|
657
|
+
<ref name="index"/>
|
658
|
+
<ref name="index-xref"/>
|
651
659
|
</choice>
|
652
660
|
</zeroOrMore>
|
653
661
|
</element>
|
@@ -655,7 +663,11 @@
|
|
655
663
|
<define name="keyword">
|
656
664
|
<element name="keyword">
|
657
665
|
<zeroOrMore>
|
658
|
-
<
|
666
|
+
<choice>
|
667
|
+
<ref name="PureTextElement"/>
|
668
|
+
<ref name="index"/>
|
669
|
+
<ref name="index-xref"/>
|
670
|
+
</choice>
|
659
671
|
</zeroOrMore>
|
660
672
|
</element>
|
661
673
|
</define>
|
@@ -676,7 +688,11 @@
|
|
676
688
|
<define name="strike">
|
677
689
|
<element name="strike">
|
678
690
|
<zeroOrMore>
|
679
|
-
<
|
691
|
+
<choice>
|
692
|
+
<ref name="PureTextElement"/>
|
693
|
+
<ref name="index"/>
|
694
|
+
<ref name="index-xref"/>
|
695
|
+
</choice>
|
680
696
|
</zeroOrMore>
|
681
697
|
</element>
|
682
698
|
</define>
|
data/grammars/biblio.rng
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module RelatonIetf
|
2
|
+
class DocumentType < RelatonBib::DocumentType
|
3
|
+
DOCTYPES = %w[rfc internet-draft].freeze
|
4
|
+
|
5
|
+
def initialize(type:, abbreviation: nil)
|
6
|
+
check_type type
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def check_type(type)
|
11
|
+
unless DOCTYPES.include? type
|
12
|
+
Util.warn "WARNING: Invalid doctype: `#{type}`"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,36 +1,40 @@
|
|
1
1
|
module RelatonIetf
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
module HashConverter
|
3
|
+
include RelatonBib::HashConverter
|
4
|
+
extend self
|
5
|
+
def hash_to_bib(hash)
|
6
|
+
ret = super
|
7
|
+
return unless ret
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
stream_hash_to_bib ret
|
10
|
+
ret
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
#
|
14
|
+
# Ovverides superclass's method
|
15
|
+
#
|
16
|
+
# @param item [Hash]
|
17
|
+
# @retirn [RelatonIetf::IetfBibliographicItem]
|
18
|
+
def bib_item(item)
|
19
|
+
IetfBibliographicItem.new(**item)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
# @param ret [Hash]
|
23
|
+
def editorialgroup_hash_to_bib(ret)
|
24
|
+
return unless ret[:editorialgroup]
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
|
26
|
+
technical_committee = RelatonBib.array(ret[:editorialgroup]).map do |wg|
|
27
|
+
Committee.new RelatonBib::WorkGroup.new(**wg)
|
29
28
|
end
|
29
|
+
ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def stream_hash_to_bib(ret)
|
33
|
+
ret[:stream] = ret[:ext][:stream] if ret[:ext]&.key? :stream
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_doctype(**args)
|
37
|
+
DocumentType.new(**args)
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -1,20 +1,14 @@
|
|
1
1
|
module RelatonIetf
|
2
2
|
class IetfBibliographicItem < RelatonBib::BibliographicItem
|
3
|
-
DOCTYPES = %w[rfc internet-draft].freeze
|
4
|
-
|
5
3
|
# @return [String, nil]
|
6
|
-
attr_reader :
|
4
|
+
attr_reader :stream
|
7
5
|
|
8
6
|
# @return [Array<String>]
|
9
7
|
attr_reader :keyword
|
10
8
|
|
11
|
-
# @param doctype [String]
|
12
9
|
# @param keyword [Array<String>]
|
13
10
|
# @param stream [String, nil]
|
14
11
|
def initialize(**args)
|
15
|
-
if args[:doctype] && !DOCTYPES.include?(args[:doctype])
|
16
|
-
Util.warn "WARNING: invalid doctype `#{args[:doctype]}`"
|
17
|
-
end
|
18
12
|
@stream = args.delete(:stream)
|
19
13
|
super
|
20
14
|
end
|
@@ -47,7 +41,7 @@ module RelatonIetf
|
|
47
41
|
if opts[:bibdata] && (doctype || editorialgroup || ics&.any? ||
|
48
42
|
structuredidentifier&.presence? || stream)
|
49
43
|
ext = builder.ext do |b|
|
50
|
-
|
44
|
+
doctype&.to_xml b
|
51
45
|
b.subdoctype subdoctype if subdoctype
|
52
46
|
editorialgroup&.to_xml b
|
53
47
|
ics.each { |i| i.to_xml b }
|
@@ -18,13 +18,13 @@ module RelatonIetf
|
|
18
18
|
# reference is required
|
19
19
|
# @return [RelatonIetf::IetfBibliographicItem] Relaton of reference
|
20
20
|
def get(code, _year = nil, _opts = {})
|
21
|
-
Util.warn "(#{code})
|
21
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
22
22
|
result = search code
|
23
23
|
if result
|
24
24
|
docid = result.docidentifier.detect(&:primary) || result.docidentifier.first
|
25
|
-
Util.warn "(#{code})
|
25
|
+
Util.warn "(#{code}) Found: `#{docid.id}`"
|
26
26
|
else
|
27
|
-
Util.warn "(#{code})
|
27
|
+
Util.warn "(#{code}) Not found."
|
28
28
|
end
|
29
29
|
result
|
30
30
|
end
|
data/lib/relaton_ietf/version.rb
CHANGED
data/lib/relaton_ietf.rb
CHANGED
@@ -6,6 +6,7 @@ require "relaton_bib"
|
|
6
6
|
require "relaton_ietf/version"
|
7
7
|
require "relaton_ietf/config"
|
8
8
|
require "relaton_ietf/util"
|
9
|
+
require "relaton_ietf/document_type"
|
9
10
|
require "relaton_ietf/bibxml_parser"
|
10
11
|
require "relaton_ietf/ietf_bibliography"
|
11
12
|
require "relaton_ietf/xml_parser"
|
data/relaton_ietf.gemspec
CHANGED
@@ -29,6 +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_dependency "relaton-bib", "~> 1.
|
32
|
+
spec.add_dependency "relaton-bib", "~> 1.17.0"
|
33
33
|
spec.add_dependency "relaton-index", "~> 0.2.3"
|
34
34
|
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.
|
4
|
+
version: 1.17.0
|
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-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: relaton-bib
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.17.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.17.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: relaton-index
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/relaton_ietf/committee.rb
|
74
74
|
- lib/relaton_ietf/config.rb
|
75
75
|
- lib/relaton_ietf/data_fetcher.rb
|
76
|
+
- lib/relaton_ietf/document_type.rb
|
76
77
|
- lib/relaton_ietf/hash_converter.rb
|
77
78
|
- lib/relaton_ietf/ietf_bibliographic_item.rb
|
78
79
|
- lib/relaton_ietf/ietf_bibliography.rb
|