relaton-ietf 1.11.5 → 1.11.6

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: c8668aa18254f8c9c0dd9f0a6b47b8d8c3b83e9795ef2ece6d422962cb894e6a
4
- data.tar.gz: 5c47519efd521568f671c7e56148133f3d3155d3a3057829b6c735df6be887f5
3
+ metadata.gz: bb60963a99c05a4f4ce71a2f896e6f6a4ba4d5aca27affbb5a5f224671e2fa35
4
+ data.tar.gz: 11fedecf896b30c5fedf546eb683ef5f5cfc1c58eab735155a2d5a394b585733
5
5
  SHA512:
6
- metadata.gz: ffadb9d261290bc847c5ef4d56a85eaee3eee4d6ddab429e56b350dca0c30c78fb35c155e59c65dc00889cf7a33d7d821545215bd372a8457ec73cacabbdf8f3
7
- data.tar.gz: 6b5262d9b858af95a5c0afccb2c09f109bdd6edf3ad85c5552988c8193bd1107e00ee2ee4f1751334d0d5eccb50eef9b0d8f8494887cbdc1bb835f148563e2ba
6
+ metadata.gz: dfff8e3c6390dbeadc59c8a2e3779520e13042adc3b752556111ac61851bbd30612799bd9c9296d919d88ca79188454ecf292f9afe4979053d67a0a03b699d3a
7
+ data.tar.gz: 0f3224b2e6272bc570bdb9d705c9d3e3dfa3ec8f47019e46dee266ef11f8803a74be0fbbd8c604b9e84ae4fd7b473857dab03aac61a23a0df52a363a260620b7
@@ -10,27 +10,4 @@ on:
10
10
 
11
11
  jobs:
12
12
  rake:
13
- name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
- runs-on: ${{ matrix.os }}
15
- continue-on-error: ${{ matrix.experimental }}
16
- strategy:
17
- fail-fast: false
18
- matrix:
19
- ruby: ['3.0', '2.7', '2.6', '2.5' ]
20
- os: [ ubuntu-latest, windows-latest, macos-latest ]
21
- experimental: [ false ]
22
- steps:
23
- - uses: actions/checkout@v2
24
- with:
25
- submodules: true
26
-
27
- # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
28
- - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
29
- run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
30
-
31
- - uses: ruby/setup-ruby@v1
32
- with:
33
- ruby-version: ${{ matrix.ruby }}
34
- bundler-cache: true
35
-
36
- - run: bundle exec rake
13
+ uses: relaton/support/.github/workflows/rake.yml@master
data/README.adoc CHANGED
@@ -47,10 +47,10 @@ item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
47
47
  ...
48
48
 
49
49
  # Fetch Internet-Draft document
50
- RelatonIetf::IetfBibliography.get 'IETF I-D.abarth-cake-02'
51
- [relaton-ietf] ("IETF I-D.abarth-cake-02") fetching...
52
- [relaton-ietf] ("IETF I-D.abarth-cake-02") found I-D.abarth-cake
53
- => #<RelatonIetf::IetfBibliographicItem:0x00007fa7c81688f8
50
+ RelatonIetf::IetfBibliography.get 'IETF I-D.draft-abarth-cake-01'
51
+ [relaton-ietf] ("IETF I-D.draft-abarth-cake-01") fetching...
52
+ [relaton-ietf] ("IETF I-D.draft-abarth-cake-01") found draft-abarth-cake-01
53
+ => #<RelatonIetf::IetfBibliographicItem:0x00007fdd129bbeb8
54
54
  ...
55
55
 
56
56
  # Return nil if document doesn't exist.
@@ -65,12 +65,12 @@ RelatonIetf::IetfBibliography.get 'IETF 1111'
65
65
  [source,ruby]
66
66
  ----
67
67
  item.to_xml
68
- =>"<bibitem id="RFC8341">
69
- <fetched>2019-06-05</fetched>
70
- <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
68
+ =>"<bibitem id="RFC8341" type="standard">
69
+ <fetched>2022-06-10</fetched>
70
+ <title type="main" format="text/plain">Network Configuration Access Control Model</title>
71
71
  <uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
72
- <docidentifier type="IETF">RFC 8341</docidentifier>
73
- <docidentifier type=\"rfc-anchor\">RFC8341</docidentifier>
72
+ <docidentifier type="IETF" primary="true">RFC 8341</docidentifier>
73
+ <docidentifier type="IETF" scope="anchor">RFC8341</docidentifier>
74
74
  <docidentifier type="DOI">10.17487/RFC8341</docidentifier>
75
75
  ....
76
76
  </bibitem>"
@@ -79,13 +79,15 @@ With `bibdata: true` option XML output wrapped with `bibdata` element and `ext`
79
79
  [source,ruby]
80
80
  ----
81
81
  item.to_xml bibdata: true
82
- =>"<bibdata>
83
- <fetched>2019-06-05</fetched>
84
- <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
82
+ =>"<bibdata type="standard">
83
+ <fetched>2022-06-10</fetched>
84
+ <title type="main" format="text/plain">Network Configuration Access Control Model</title>
85
85
  <uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
86
86
  ...
87
87
  <ext>
88
- <doctype>rfc</doctype>
88
+ <editorialgroup>
89
+ <committee>netconf</committee>
90
+ </editorialgroup>
89
91
  </ext>
90
92
  </bibdata>"
91
93
  ----
@@ -9,6 +9,16 @@ module RelatonIetf
9
9
  def bib_item(item)
10
10
  IetfBibliographicItem.new(**item)
11
11
  end
12
+
13
+ # @param ret [Hash]
14
+ def editorialgroup_hash_to_bib(ret)
15
+ return unless ret[:editorialgroup]
16
+
17
+ technical_committee = array(ret[:editorialgroup]).map do |wg|
18
+ Committee.new RelatonBib::WorkGroup.new(**wg)
19
+ end
20
+ ret[:editorialgroup] = RelatonBib::EditorialGroup.new technical_committee
21
+ end
12
22
  end
13
23
  end
14
24
  end
@@ -6,7 +6,7 @@ module RelatonIetf
6
6
  def initialize # rubocop:disable Lint/MissingSuper
7
7
  @short = :relaton_ietf
8
8
  @prefix = "IETF"
9
- @defaultprefix = /^(IETF|RFC|BCP)\s/
9
+ @defaultprefix = /^(IETF|RFC|BCP|FYI|STD)\s/
10
10
  @idtype = "IETF"
11
11
  @datasets = %w[ietf-rfcsubseries ietf-internet-drafts ietf-rfc-entries]
12
12
  end
@@ -5,7 +5,9 @@ module RelatonIetf
5
5
  module Scrapper
6
6
  extend Scrapper
7
7
 
8
- GH_URL = "https://raw.githubusercontent.com/relaton/relaton-data-ietf/master/data/reference."
8
+ IDS = "https://raw.githubusercontent.com/ietf-ribose/relaton-data-ids/main/data/"
9
+ RFC = "https://raw.githubusercontent.com/ietf-ribose/relaton-data-rfcs/main/data/"
10
+ RSS = "https://raw.githubusercontent.com/ietf-ribose/relaton-data-rfcsubseries/main/data/"
9
11
 
10
12
  # @param text [String]
11
13
  # @param is_relation [TrueClass, FalseClass]
@@ -13,8 +15,7 @@ module RelatonIetf
13
15
  def scrape_page(text, is_relation: false)
14
16
  # Remove initial "IETF " string if specified
15
17
  ref = text.gsub(/^IETF /, "")
16
- /^(?:RFC|BCP|FYI|STD)\s(?<num>\d+)/ =~ ref
17
- ref.sub!(/(?<=^(?:RFC|BCP|FYI|STD)\s)(\d+)/, num.rjust(4, "0")) if num
18
+ ref.sub!(/(?<=^(?:RFC|BCP|FYI|STD))\s(\d+)/) { $1.rjust 4, "0" }
18
19
  rfc_item ref, is_relation
19
20
  rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
20
21
  Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
@@ -28,17 +29,19 @@ module RelatonIetf
28
29
  # @param is_relation [Boolen, nil]
29
30
  # @return [RelatonIetf::IetfBibliographicItem]
30
31
  def rfc_item(ref, is_relation)
31
- /(?<=-)(?<ver>\d{2})$/ =~ ref
32
- if /^I-D/.match? ref
33
- ref.sub!(/-\d{2}/, "") if ver
34
- ref.sub!(/(?<=I-D\.)draft-/, "")
35
- end
36
-
37
- uri = "#{GH_URL}#{ref.sub(/\s|\u00a0/, '.')}.xml"
38
- # doc = Nokogiri::XML get_page(uri)
39
- # r = doc.at("/referencegroup", "/reference")
40
- # fetch_rfc r, is_relation: is_relation, url: uri, ver: ver
41
- BibXMLParser.parse get_page(uri), is_relation: is_relation, ver: ver
32
+ ghurl = case ref
33
+ when /^RFC/ then RFC
34
+ when /^(?:BCP|FYI|STD)/ then RSS
35
+ when /^I-D/
36
+ ref.sub!(/^I-D\./, "")
37
+ IDS
38
+ else return
39
+ end
40
+
41
+ uri = "#{ghurl}#{ref.sub(/\s|\u00a0/, '.')}.yaml"
42
+ # BibXMLParser.parse get_page(uri), is_relation: is_relation, ver: ver
43
+ resp = get_page uri
44
+ IetfBibliographicItem.from_hash YAML.safe_load(resp) if resp
42
45
  end
43
46
 
44
47
  # @param uri [String]
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.11.5".freeze
2
+ VERSION = "1.11.6".freeze
3
3
  end
@@ -11,6 +11,21 @@ module RelatonIetf
11
11
  def bib_item(item_hash)
12
12
  IetfBibliographicItem.new(**item_hash)
13
13
  end
14
+
15
+ # @param ext [Nokogiri::XML::Element]
16
+ # @return [RelatonBib::EditorialGroup, nil]
17
+ def fetch_editorialgroup(ext)
18
+ return unless ext && (eg = ext.at "editorialgroup")
19
+
20
+ eg = eg.xpath("committee").map do |tc|
21
+ wg = RelatonBib::WorkGroup.new(
22
+ name: tc.text, number: tc[:number]&.to_i, type: tc[:type],
23
+ identifier: tc[:identifier], prefix: tc[:prefix]
24
+ )
25
+ Committee.new wg
26
+ end
27
+ RelatonBib::EditorialGroup.new eg if eg.any?
28
+ end
14
29
  end
15
30
  end
16
31
  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.11.5
4
+ version: 1.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-10 00:00:00.000000000 Z
11
+ date: 2022-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml