relaton-un 1.7.1 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/grammars/reqt.rng CHANGED
@@ -30,9 +30,22 @@
30
30
  <data type="boolean"/>
31
31
  </attribute>
32
32
  </optional>
33
+ <optional>
34
+ <attribute name="number"/>
35
+ </optional>
33
36
  <optional>
34
37
  <attribute name="subsequence"/>
35
38
  </optional>
39
+ <optional>
40
+ <attribute name="keep-with-next">
41
+ <data type="boolean"/>
42
+ </attribute>
43
+ </optional>
44
+ <optional>
45
+ <attribute name="keep-lines-together">
46
+ <data type="boolean"/>
47
+ </attribute>
48
+ </optional>
36
49
  <attribute name="id">
37
50
  <data type="ID"/>
38
51
  </attribute>
@@ -40,17 +53,23 @@
40
53
  <attribute name="filename"/>
41
54
  </optional>
42
55
  <optional>
43
- <ref name="reqtitle"/>
56
+ <attribute name="model"/>
44
57
  </optional>
45
58
  <optional>
46
- <ref name="label"/>
59
+ <attribute name="type"/>
47
60
  </optional>
48
61
  <optional>
49
- <ref name="subject"/>
62
+ <ref name="reqtitle"/>
50
63
  </optional>
51
64
  <optional>
52
- <ref name="reqinherit"/>
65
+ <ref name="label"/>
53
66
  </optional>
67
+ <zeroOrMore>
68
+ <ref name="subject"/>
69
+ </zeroOrMore>
70
+ <zeroOrMore>
71
+ <ref name="reqinherit"/>
72
+ </zeroOrMore>
54
73
  <zeroOrMore>
55
74
  <ref name="classification"/>
56
75
  </zeroOrMore>
@@ -61,6 +80,7 @@
61
80
  <ref name="verification"/>
62
81
  <ref name="import"/>
63
82
  <ref name="description"/>
83
+ <ref name="component"/>
64
84
  </choice>
65
85
  </zeroOrMore>
66
86
  <optional>
@@ -86,12 +106,16 @@
86
106
  </define>
87
107
  <define name="subject">
88
108
  <element name="subject">
89
- <text/>
109
+ <oneOrMore>
110
+ <ref name="TextElement"/>
111
+ </oneOrMore>
90
112
  </element>
91
113
  </define>
92
114
  <define name="reqinherit">
93
115
  <element name="inherit">
94
- <text/>
116
+ <oneOrMore>
117
+ <ref name="TextElement"/>
118
+ </oneOrMore>
95
119
  </element>
96
120
  </define>
97
121
  <define name="measurementtarget">
@@ -119,6 +143,12 @@
119
143
  <ref name="RequirementSubpart"/>
120
144
  </element>
121
145
  </define>
146
+ <define name="component">
147
+ <element name="component">
148
+ <attribute name="class"/>
149
+ <ref name="RequirementSubpart"/>
150
+ </element>
151
+ </define>
122
152
  <define name="reqt_references">
123
153
  <element name="references">
124
154
  <oneOrMore>
@@ -135,6 +165,16 @@
135
165
  <data type="boolean"/>
136
166
  </attribute>
137
167
  </optional>
168
+ <optional>
169
+ <attribute name="keep-with-next">
170
+ <data type="boolean"/>
171
+ </attribute>
172
+ </optional>
173
+ <optional>
174
+ <attribute name="keep-lines-together">
175
+ <data type="boolean"/>
176
+ </attribute>
177
+ </optional>
138
178
  <oneOrMore>
139
179
  <ref name="BasicBlock"/>
140
180
  </oneOrMore>
data/grammars/un.rng CHANGED
@@ -96,7 +96,10 @@
96
96
  <define name="sections">
97
97
  <element name="sections">
98
98
  <oneOrMore>
99
- <ref name="clause"/>
99
+ <choice>
100
+ <ref name="clause"/>
101
+ <ref name="floating-title"/>
102
+ </choice>
100
103
  </oneOrMore>
101
104
  </element>
102
105
  </define>
@@ -104,6 +107,9 @@
104
107
  <optional>
105
108
  <ref name="doctype"/>
106
109
  </optional>
110
+ <optional>
111
+ <ref name="docsubtype"/>
112
+ </optional>
107
113
  <zeroOrMore>
108
114
  <ref name="submissionlanguage"/>
109
115
  </zeroOrMore>
@@ -175,19 +181,15 @@
175
181
  <ref name="section-title"/>
176
182
  </optional>
177
183
  <group>
178
- <group>
179
- <zeroOrMore>
180
- <ref name="BasicBlock"/>
181
- </zeroOrMore>
182
- <zeroOrMore>
183
- <ref name="note"/>
184
- </zeroOrMore>
185
- </group>
184
+ <zeroOrMore>
185
+ <ref name="BasicBlock"/>
186
+ </zeroOrMore>
186
187
  <zeroOrMore>
187
188
  <choice>
188
189
  <ref name="clause-subsection"/>
189
190
  <ref name="terms"/>
190
191
  <ref name="definitions"/>
192
+ <ref name="floating-title"/>
191
193
  </choice>
192
194
  </zeroOrMore>
193
195
  </group>
@@ -226,20 +228,16 @@
226
228
  <ref name="section-title"/>
227
229
  </optional>
228
230
  <group>
229
- <group>
230
- <zeroOrMore>
231
- <ref name="BasicBlock"/>
232
- </zeroOrMore>
233
- <zeroOrMore>
234
- <ref name="note"/>
235
- </zeroOrMore>
236
- </group>
231
+ <zeroOrMore>
232
+ <ref name="BasicBlock"/>
233
+ </zeroOrMore>
237
234
  <zeroOrMore>
238
235
  <choice>
239
236
  <ref name="annex-subsection"/>
240
237
  <ref name="terms"/>
241
238
  <ref name="definitions"/>
242
239
  <ref name="references"/>
240
+ <ref name="floating-title"/>
243
241
  </choice>
244
242
  </zeroOrMore>
245
243
  </group>
@@ -348,6 +346,9 @@
348
346
  </choice>
349
347
  </attribute>
350
348
  <ref name="bibdata"/>
349
+ <optional>
350
+ <ref name="misccontainer"/>
351
+ </optional>
351
352
  <optional>
352
353
  <ref name="boilerplate"/>
353
354
  </optional>
@@ -358,6 +359,9 @@
358
359
  <zeroOrMore>
359
360
  <ref name="annex"/>
360
361
  </zeroOrMore>
362
+ <zeroOrMore>
363
+ <ref name="indexsect"/>
364
+ </zeroOrMore>
361
365
  </element>
362
366
  </define>
363
367
  </grammar>
@@ -75,7 +75,7 @@ module RelatonUn
75
75
  distribution: fetch_distribution,
76
76
  editorialgroup: fetch_editorialgroup,
77
77
  classification: fetch_classification,
78
- job_number: hit[:job_number]
78
+ job_number: hit[:job_number],
79
79
  )
80
80
  end
81
81
  # rubocop:enable Metrics/MethodLength
@@ -109,7 +109,7 @@ module RelatonUn
109
109
 
110
110
  # @return [Array<RelatonBib::TypedUri>]
111
111
  def fetch_link
112
- hit[:link].map { |l| RelatonBib::TypedUri.new **l }
112
+ hit[:link].map { |l| RelatonBib::TypedUri.new(**l) }
113
113
  end
114
114
 
115
115
  # @return [Array<String>]
@@ -128,10 +128,10 @@ module RelatonUn
128
128
  end
129
129
 
130
130
  # @return [RelatonUn::EditorialGroup, NilClass]
131
- def fetch_editorialgroup
132
- tc = hit[:ref].match(/^[\S]+/).to_s.split(/\/|-/).reduce([]) do |m, v|
131
+ def fetch_editorialgroup # rubocop:disable Metrics/AbcSize
132
+ tc = hit[:ref].match(/^\S+/).to_s.split(/\/|-/).reduce([]) do |m, v|
133
133
  if BODY[v] then m << BODY[v]
134
- elsif v.match? /(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/ then m << v
134
+ elsif v.match?(/(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/) then m << v
135
135
  else m
136
136
  end
137
137
  end.uniq
@@ -29,7 +29,7 @@ module RelatonUn
29
29
  # @return [RelatonIsoBib::IsoBibliographicItem]
30
30
  def hash_to_bib(hash)
31
31
  item_hash = ::RelatonUn::HashConverter.hash_to_bib(hash)
32
- ::RelatonUn::UnBibliographicItem.new item_hash
32
+ ::RelatonUn::UnBibliographicItem.new(**item_hash)
33
33
  end
34
34
 
35
35
  # Returns hash of XML grammar
@@ -25,13 +25,13 @@ module RelatonUn
25
25
  def initialize(**args)
26
26
  if args[:distribution] && !DISTRIBUTIONS.has_value?(args[:distribution])
27
27
  warn "[relaton-un] WARNING: invalid distribution: "\
28
- "#{args[:distribution]}"
28
+ "#{args[:distribution]}"
29
29
  end
30
30
  @submissionlanguage = args.delete :submissionlanguage
31
31
  @distribution = args.delete :distribution
32
32
  @session = args.delete :session
33
33
  @job_number = args.delete :job_number
34
- super **args
34
+ super(**args)
35
35
  end
36
36
 
37
37
  # @param opts [Hash]
@@ -40,7 +40,7 @@ module RelatonUn
40
40
  # @option opts [String] :lang language
41
41
  # @return [String] XML
42
42
  def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
43
- super **opts do |b|
43
+ super(**opts) do |b|
44
44
  b.ext do
45
45
  b.doctype doctype if doctype
46
46
  submissionlanguage&.each { |sl| b.submissionlanguage sl }
@@ -68,7 +68,7 @@ module RelatonUn
68
68
  # @param prefix [String]
69
69
  # @return [String]
70
70
  def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize
71
- pref = prefix.empty? ? prefix : prefix + "."
71
+ pref = prefix.empty? ? prefix : "#{prefix}."
72
72
  out = super
73
73
  submissionlanguage.each do |sl|
74
74
  out += "#{pref}submissionlanguage:: #{sl}\n"
@@ -10,8 +10,8 @@ module RelatonUn
10
10
  HitCollection.new text
11
11
  rescue SocketError, Errno::EINVAL, Errno::ECONNRESET, EOFError,
12
12
  Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
13
- Net::ProtocolError, Net::ReadTimeout, OpenSSL::SSL::SSLError,
14
- Errno::ETIMEDOUT => e
13
+ Net::ProtocolError, Net::ReadTimeout, Net::OpenTimeout,
14
+ OpenSSL::SSL::SSLError, Errno::ETIMEDOUT => e
15
15
  raise RelatonBib::RequestError,
16
16
  "Could not access #{HitCollection::DOMAIN}: #{e.message}"
17
17
  end
@@ -22,7 +22,7 @@ module RelatonUn
22
22
  # @return [RelatonUn::UnBibliographicItem]
23
23
  def get(ref, _year = nil, _opts = {})
24
24
  warn "[relaton-un] (\"#{ref}\") fetching..."
25
- /^(UN\s)?(?<code>.*)/ =~ ref
25
+ /^(?:UN\s)?(?<code>.*)/ =~ ref
26
26
  result = isobib_search_filter(code)
27
27
  if result
28
28
  warn "[relaton-un] (\"#{ref}\") "\
@@ -1,3 +1,3 @@
1
1
  module RelatonUn
2
- VERSION = "1.7.1".freeze
2
+ VERSION = "1.10.0".freeze
3
3
  end
@@ -6,7 +6,7 @@ module RelatonUn
6
6
  # @param item_hash [Hash]
7
7
  # @return [RelatonBib::BibliographicItem]
8
8
  def bib_item(item_hash)
9
- UnBibliographicItem.new **item_hash
9
+ UnBibliographicItem.new(**item_hash)
10
10
  end
11
11
 
12
12
  # @param item [Nokogiri::XML::Element]
@@ -27,7 +27,7 @@ module RelatonUn
27
27
 
28
28
  # @param ext [Nokogiri::XML::Element]
29
29
  # @return [RelatonUn::Session]
30
- def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity
30
+ def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
31
31
  session = ext.at "./session"
32
32
  RelatonUn::Session.new(
33
33
  session_number: session.at("number")&.text,
@@ -37,7 +37,7 @@ module RelatonUn
37
37
  subitem_name: session.xpath("subitem-name").map(&:text),
38
38
  collaborator: session.at("collaborator")&.text,
39
39
  agenda_id: session.at("agenda-id")&.text,
40
- item_footnote: session.at("item-footnote")&.text
40
+ item_footnote: session.at("item-footnote")&.text,
41
41
  )
42
42
  end
43
43
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
data/relaton_un.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  "use using the IsoBibliographicItem model"
16
16
  spec.homepage = "https://github.com/relaton/relaton-un"
17
17
  spec.license = "BSD-2-Clause"
18
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
18
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
19
19
 
20
20
  spec.metadata["homepage_uri"] = spec.homepage
21
21
  spec.metadata["source_code_uri"] = spec.homepage
@@ -32,10 +32,8 @@ Gem::Specification.new do |spec|
32
32
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
33
  spec.require_paths = ["lib"]
34
34
 
35
- # spec.add_development_dependency "debase"
36
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
37
36
  spec.add_development_dependency "rake", "~> 10.0"
38
- # spec.add_development_dependency "ruby-debug-ide"
39
37
  spec.add_development_dependency "ruby-jing"
40
38
  spec.add_development_dependency "simplecov"
41
39
  spec.add_development_dependency "vcr"
@@ -43,7 +41,7 @@ Gem::Specification.new do |spec|
43
41
 
44
42
  spec.add_dependency "faraday"
45
43
  spec.add_dependency "http-cookie"
46
- spec.add_dependency "relaton-bib", "~> 1.7.0"
44
+ spec.add_dependency "relaton-bib", "~> 1.10.0"
47
45
  spec.add_dependency "unf_ext", ">= 0.0.7.7"
48
46
  end
49
47
  # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.10.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: 2021-03-17 00:00:00.000000000 Z
11
+ date: 2022-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.7.0
131
+ version: 1.10.0
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.7.0
138
+ version: 1.10.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: unf_ext
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -201,14 +201,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
201
  requirements:
202
202
  - - ">="
203
203
  - !ruby/object:Gem::Version
204
- version: 2.4.0
204
+ version: 2.5.0
205
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  requirements:
207
207
  - - ">="
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
- rubygems_version: 3.0.6
211
+ rubygems_version: 3.2.3
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: 'RelatonIso: retrieve CC Standards for bibliographic use using the IsoBibliographicItem