relaton-ietf 1.9.13 → 1.10.3

Sign up to get free protection for your applications and to get access to all the features.
data/grammars/reqt.rng CHANGED
@@ -64,9 +64,9 @@
64
64
  <optional>
65
65
  <ref name="label"/>
66
66
  </optional>
67
- <optional>
67
+ <zeroOrMore>
68
68
  <ref name="subject"/>
69
- </optional>
69
+ </zeroOrMore>
70
70
  <zeroOrMore>
71
71
  <ref name="reqinherit"/>
72
72
  </zeroOrMore>
@@ -80,6 +80,7 @@
80
80
  <ref name="verification"/>
81
81
  <ref name="import"/>
82
82
  <ref name="description"/>
83
+ <ref name="component"/>
83
84
  </choice>
84
85
  </zeroOrMore>
85
86
  <optional>
@@ -105,12 +106,16 @@
105
106
  </define>
106
107
  <define name="subject">
107
108
  <element name="subject">
108
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
109
112
  </element>
110
113
  </define>
111
114
  <define name="reqinherit">
112
115
  <element name="inherit">
113
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
114
119
  </element>
115
120
  </define>
116
121
  <define name="measurementtarget">
@@ -138,6 +143,12 @@
138
143
  <ref name="RequirementSubpart"/>
139
144
  </element>
140
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
141
152
  <define name="reqt_references">
142
153
  <element name="references">
143
154
  <oneOrMore>
@@ -3,18 +3,31 @@ module RelatonIetf
3
3
  include RelatonBib::BibXMLParser
4
4
  extend BibXMLParser
5
5
 
6
- FLAVOR = "IETF".freeze
7
-
8
6
  # @param attrs [Hash]
9
7
  # @return [RelatonIetf::IetfBibliographicItem]
10
8
  def bib_item(**attrs)
11
9
  unless attrs.delete(:is_relation)
12
10
  attrs[:fetched] = Date.today.to_s
13
- attrs[:place] = ["Fremont, CA"]
11
+ # attrs[:place] = ["Fremont, CA"]
14
12
  end
15
13
  RelatonIetf::IetfBibliographicItem.new(**attrs)
16
14
  end
17
15
 
16
+ #
17
+ # Extract document identifier type form identifier
18
+ #
19
+ # @param [String] id identifier
20
+ #
21
+ # @return [String] type
22
+ #
23
+ def pubid_type(id)
24
+ type = super
25
+ case type
26
+ when "BCP", "FYI", "STD", "RFC" then "RFC"
27
+ else "IETF"
28
+ end
29
+ end
30
+
18
31
  # @param [RelatonBib::WorkGroup]
19
32
  # @return [RelatonIetf::Committee]
20
33
  def committee(wgr)
@@ -24,7 +37,14 @@ module RelatonIetf
24
37
  # @param reference [Nokogiri::XML::Element]
25
38
  # @return [Array<Hash>]
26
39
  def contributors(reference)
27
- [{ entity: new_org("Internet Engineering Task Force", "IETF"), role: [type: "publisher"] }] + super
40
+ contribs = []
41
+ unless reference[:anchor]&.match?(/^I-D/)
42
+ contribs << {
43
+ entity: new_org("Internet Engineering Task Force", "IETF"),
44
+ role: [type: "publisher"],
45
+ }
46
+ end
47
+ contribs + super
28
48
  # persons(reference) + organizations(reference)
29
49
  end
30
50
  end
@@ -64,17 +64,6 @@ module RelatonIetf
64
64
  # Fetches ietf-internet-drafts documents
65
65
  #
66
66
  def fetch_ieft_internet_drafts # rubocop:disable Metrics/MethodLength
67
- # gz = OpenURI.open_uri("https://www.ietf.org/lib/dt/sprint/bibxml-ids.tgz")
68
- # z = Zlib::GzipReader.new(gz)
69
- # io = StringIO.new(z.read)
70
- # z.close
71
- # Gem::Package::TarReader.new io do |tar|
72
- # tar.each do |tarfile|
73
- # next if tarfile.directory?
74
-
75
- # save_doc BibXMLParser.parse(tarfile.read)
76
- # end
77
- # end
78
67
  Dir["bibxml-ids/*.xml"].each do |file|
79
68
  save_doc BibXMLParser.parse(File.read(file, encoding: "UTF-8"))
80
69
  end
@@ -67,7 +67,7 @@ module RelatonIetf
67
67
  #
68
68
  def parse_docid
69
69
  ids = [
70
- RelatonBib::DocumentIdentifier.new(id: pub_id, type: "IETF"),
70
+ RelatonBib::DocumentIdentifier.new(id: pub_id, type: "IETF", primary: true),
71
71
  RelatonBib::DocumentIdentifier.new(id: code, type: "IETF", scope: "anchor"),
72
72
  ]
73
73
  doi = @doc.at("./xmlns:doi").text
@@ -256,11 +256,13 @@ module RelatonIetf
256
256
  # @return [RelatonBib::EditorialGroup] document editorial group
257
257
  #
258
258
  def parse_editorialgroup
259
- tc = @doc.xpath("./xmlns:wg_acronym").map do |wg|
259
+ tc = @doc.xpath("./xmlns:wg_acronym").each_with_object([]) do |wg, arr|
260
+ next if wg.text == "NON WORKING GROUP"
261
+
260
262
  wg = RelatonBib::WorkGroup.new(name: wg.text)
261
- RelatonBib::TechnicalCommittee.new(wg)
263
+ arr << RelatonBib::TechnicalCommittee.new(wg)
262
264
  end
263
- RelatonBib::EditorialGroup.new(tc)
265
+ RelatonBib::EditorialGroup.new(tc) if tc.any?
264
266
  end
265
267
  end
266
268
  end
@@ -54,7 +54,7 @@ module RelatonIetf
54
54
 
55
55
  def parse_docid
56
56
  [
57
- RelatonBib::DocumentIdentifier.new(type: "IETF", id: pub_id),
57
+ RelatonBib::DocumentIdentifier.new(type: "IETF", id: pub_id, primary: true),
58
58
  RelatonBib::DocumentIdentifier.new(type: "IETF", scope: "anchor", id: @doc_id),
59
59
  ]
60
60
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIetf
2
- VERSION = "1.9.13".freeze
2
+ VERSION = "1.10.3".freeze
3
3
  end
data/relaton_ietf.gemspec CHANGED
@@ -38,6 +38,6 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "vcr"
39
39
  spec.add_development_dependency "webmock"
40
40
 
41
- spec.add_dependency "relaton-bib", ">= 1.9.19"
41
+ spec.add_dependency "relaton-bib", "~> 1.10.1"
42
42
  # spec.add_dependency "zlib", "~> 1.1.0"
43
43
  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.9.13
4
+ version: 1.10.3
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-01-23 00:00:00.000000000 Z
11
+ date: 2022-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -126,16 +126,16 @@ dependencies:
126
126
  name: relaton-bib
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.9.19
131
+ version: 1.10.1
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 1.9.19
138
+ version: 1.10.1
139
139
  description: "RelatonIetf: retrieve IETF Standards for bibliographic use \nusing the
140
140
  BibliographicItem model.\n\nFormerly known as rfcbib.\n"
141
141
  email: