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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d38fb8a37a82452b362231a9c9c5b0424c736ed9b736590d89a486fad08b56e3
4
- data.tar.gz: 0af04bcb2a9573b6548442a2182a476de630f19ad10c1c6a492a9271fe905251
3
+ metadata.gz: 4d0245047f274549b9323c06fe9d63a5150a2fe44ea57d0525aaad767d3c38b8
4
+ data.tar.gz: dfc5d69ee70eec62f5fe6b43791ab9578db892439dfe296574098c58ae6ca304
5
5
  SHA512:
6
- metadata.gz: 28592296140fadf98b245fd0efdb62bf9e1c808a4487cd18e8025dcc1daf303cc90466ca0bf21b2c433652b4543265f866d0b83246a1764089be80e48dabb4e6
7
- data.tar.gz: cae243d8e3af11d86d7de6969442fbbcf5e9c08cdaa0839237ec8a2dd6222da58a57132e3cfa8060daa1385fe0668767aae4223c2b6f0000ba77365ddbfd841f
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
- === Fetching documents
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] ("IETF RFC 8341") fetching...
46
- [relaton-ietf] ("IETF RFC 8341") found RFC 8341
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] ("IETF I-D.draft-abarth-cake-01") fetching...
53
- [relaton-ietf] ("IETF I-D.draft-abarth-cake-01") found draft-abarth-cake-01
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] ("IETF 1111") fetching...
60
- [relaton-ietf] ("IETF 1111") not found
70
+ [relaton-ietf] (IETF 1111) Fetching from Relaton repository ...
71
+ [relaton-ietf] (IETF 1111) Not found.
61
72
  => nil
62
73
  ----
63
74
 
@@ -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
- <ref name="PureTextElement"/>
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
- <ref name="PureTextElement"/>
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
@@ -942,6 +942,7 @@
942
942
  <value>obsoleted</value>
943
943
  <value>confirmed</value>
944
944
  <value>updated</value>
945
+ <value>corrected</value>
945
946
  <value>issued</value>
946
947
  <value>transmitted</value>
947
948
  <value>copied</value>
@@ -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
- class HashConverter < RelatonBib::HashConverter
3
- class << self
4
- def hash_to_bib(hash)
5
- ret = super
6
- return unless ret
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
- stream_hash_to_bib ret
9
- ret
10
- end
9
+ stream_hash_to_bib ret
10
+ ret
11
+ end
11
12
 
12
- #
13
- # Ovverides superclass's method
14
- #
15
- # @param item [Hash]
16
- # @retirn [RelatonIetf::IetfBibliographicItem]
17
- def bib_item(item)
18
- IetfBibliographicItem.new(**item)
19
- end
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
- # @param ret [Hash]
22
- def editorialgroup_hash_to_bib(ret)
23
- return unless ret[:editorialgroup]
22
+ # @param ret [Hash]
23
+ def editorialgroup_hash_to_bib(ret)
24
+ return unless ret[:editorialgroup]
24
25
 
25
- technical_committee = RelatonBib.array(ret[:editorialgroup]).map do |wg|
26
- Committee.new RelatonBib::WorkGroup.new(**wg)
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
- def stream_hash_to_bib(ret)
32
- ret[:stream] = ret[:ext][:stream] if ret[:ext]&.key? :stream
33
- end
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 :doctype, :stream
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
- b.doctype doctype if doctype
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}) fetching..."
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}) found `#{docid.id}`"
25
+ Util.warn "(#{code}) Found: `#{docid.id}`"
26
26
  else
27
- Util.warn "(#{code}) not found"
27
+ Util.warn "(#{code}) Not found."
28
28
  end
29
29
  result
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.16.1".freeze
2
+ VERSION = "1.17.0".freeze
3
3
  end
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.16.0"
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.16.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-09-21 00:00:00.000000000 Z
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.16.0
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.16.0
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