relaton-iec 1.9.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -142,14 +142,9 @@
142
142
  </optional>
143
143
  <choice>
144
144
  <choice>
145
- <group>
146
- <oneOrMore>
147
- <ref name="BasicBlock"/>
148
- </oneOrMore>
149
- <zeroOrMore>
150
- <ref name="note"/>
151
- </zeroOrMore>
152
- </group>
145
+ <oneOrMore>
146
+ <ref name="BasicBlock"/>
147
+ </oneOrMore>
153
148
  <ref name="amend"/>
154
149
  </choice>
155
150
  <oneOrMore>
@@ -164,6 +159,20 @@
164
159
  <data type="ID"/>
165
160
  </attribute>
166
161
  </optional>
162
+ <optional>
163
+ <attribute name="language"/>
164
+ </optional>
165
+ <optional>
166
+ <attribute name="script"/>
167
+ </optional>
168
+ <optional>
169
+ <attribute name="tag"/>
170
+ </optional>
171
+ <optional>
172
+ <attribute name="multilingual-rendering">
173
+ <ref name="MultilingualRenderingType"/>
174
+ </attribute>
175
+ </optional>
167
176
  <ref name="preferred"/>
168
177
  <zeroOrMore>
169
178
  <ref name="admitted"/>
@@ -174,7 +183,7 @@
174
183
  <optional>
175
184
  <ref name="termdomain"/>
176
185
  </optional>
177
- <ref name="definition"/>
186
+ <ref name="termdefinition"/>
178
187
  <zeroOrMore>
179
188
  <ref name="termnote"/>
180
189
  </zeroOrMore>
@@ -184,6 +193,9 @@
184
193
  <zeroOrMore>
185
194
  <ref name="termsource"/>
186
195
  </zeroOrMore>
196
+ <zeroOrMore>
197
+ <ref name="term"/>
198
+ </zeroOrMore>
187
199
  </element>
188
200
  </define>
189
201
  <define name="annex">
@@ -222,9 +234,6 @@
222
234
  -->
223
235
  <ref name="BasicBlock"/>
224
236
  </zeroOrMore>
225
- <zeroOrMore>
226
- <ref name="note"/>
227
- </zeroOrMore>
228
237
  <zeroOrMore>
229
238
  <ref name="clause-hanging-paragraph-with-footnote"/>
230
239
  </zeroOrMore>
@@ -348,14 +357,9 @@
348
357
  <ref name="section-title"/>
349
358
  </optional>
350
359
  <choice>
351
- <group>
352
- <zeroOrMore>
353
- <ref name="BasicBlock"/>
354
- </zeroOrMore>
355
- <zeroOrMore>
356
- <ref name="note"/>
357
- </zeroOrMore>
358
- </group>
360
+ <zeroOrMore>
361
+ <ref name="BasicBlock"/>
362
+ </zeroOrMore>
359
363
  <oneOrMore>
360
364
  <ref name="content-subsection"/>
361
365
  </oneOrMore>
@@ -472,9 +476,6 @@
472
476
  <!-- allow hanging paragraphs in annexes: they introduce lists -->
473
477
  <ref name="BasicBlock"/>
474
478
  </zeroOrMore>
475
- <zeroOrMore>
476
- <ref name="note"/>
477
- </zeroOrMore>
478
479
  <zeroOrMore>
479
480
  <ref name="clause-hanging-paragraph-with-footnote"/>
480
481
  </zeroOrMore>
data/grammars/reqt.rng CHANGED
@@ -58,15 +58,23 @@
58
58
  <optional>
59
59
  <attribute name="type"/>
60
60
  </optional>
61
+ <optional>
62
+ <attribute name="tag"/>
63
+ </optional>
64
+ <optional>
65
+ <attribute name="multilingual-rendering">
66
+ <ref name="MultilingualRenderingType"/>
67
+ </attribute>
68
+ </optional>
61
69
  <optional>
62
70
  <ref name="reqtitle"/>
63
71
  </optional>
64
72
  <optional>
65
73
  <ref name="label"/>
66
74
  </optional>
67
- <optional>
75
+ <zeroOrMore>
68
76
  <ref name="subject"/>
69
- </optional>
77
+ </zeroOrMore>
70
78
  <zeroOrMore>
71
79
  <ref name="reqinherit"/>
72
80
  </zeroOrMore>
@@ -80,6 +88,7 @@
80
88
  <ref name="verification"/>
81
89
  <ref name="import"/>
82
90
  <ref name="description"/>
91
+ <ref name="component"/>
83
92
  </choice>
84
93
  </zeroOrMore>
85
94
  <optional>
@@ -100,17 +109,23 @@
100
109
  </define>
101
110
  <define name="label">
102
111
  <element name="label">
103
- <text/>
112
+ <oneOrMore>
113
+ <ref name="TextElement"/>
114
+ </oneOrMore>
104
115
  </element>
105
116
  </define>
106
117
  <define name="subject">
107
118
  <element name="subject">
108
- <text/>
119
+ <oneOrMore>
120
+ <ref name="TextElement"/>
121
+ </oneOrMore>
109
122
  </element>
110
123
  </define>
111
124
  <define name="reqinherit">
112
125
  <element name="inherit">
113
- <text/>
126
+ <oneOrMore>
127
+ <ref name="TextElement"/>
128
+ </oneOrMore>
114
129
  </element>
115
130
  </define>
116
131
  <define name="measurementtarget">
@@ -138,6 +153,12 @@
138
153
  <ref name="RequirementSubpart"/>
139
154
  </element>
140
155
  </define>
156
+ <define name="component">
157
+ <element name="component">
158
+ <attribute name="class"/>
159
+ <ref name="RequirementSubpart"/>
160
+ </element>
161
+ </define>
141
162
  <define name="reqt_references">
142
163
  <element name="references">
143
164
  <oneOrMore>
@@ -164,6 +185,14 @@
164
185
  <data type="boolean"/>
165
186
  </attribute>
166
187
  </optional>
188
+ <optional>
189
+ <attribute name="tag"/>
190
+ </optional>
191
+ <optional>
192
+ <attribute name="multilingual-rendering">
193
+ <ref name="MultilingualRenderingType"/>
194
+ </attribute>
195
+ </optional>
167
196
  <oneOrMore>
168
197
  <ref name="BasicBlock"/>
169
198
  </oneOrMore>
@@ -9,6 +9,11 @@ module RelatonIec
9
9
  # Scrapper.
10
10
  module Scrapper
11
11
  DOMAIN = "https://webstore.iec.ch"
12
+ ABBREVS = {
13
+ "ISO" => ["International Organization for Standardization", "www.iso.org"],
14
+ "IEC" => ["International Electrotechnical Commission", "www.iec.ch"],
15
+ "CISPR" => ["International special committee on radio interference", "www.iec.ch"],
16
+ }.freeze
12
17
 
13
18
  TYPES = {
14
19
  "ISO" => "international-standard",
@@ -36,7 +41,7 @@ module RelatonIec
36
41
 
37
42
  # Fetch edition.
38
43
  edition = doc.at(
39
- "//th[contains(., 'Edition')]/following-sibling::td/span"
44
+ "//th[contains(., 'Edition')]/following-sibling::td/span",
40
45
  ).text
41
46
 
42
47
  status, relations = fetch_status_relations hit_data[:url]
@@ -59,7 +64,7 @@ module RelatonIec
59
64
  copyright: fetch_copyright(hit_data[:code], doc),
60
65
  link: fetch_link(doc, hit_data[:url]),
61
66
  relation: relations,
62
- place: ["Geneva"]
67
+ place: ["Geneva"],
63
68
  )
64
69
  end
65
70
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -71,7 +76,7 @@ module RelatonIec
71
76
  def fetch_docid(hit)
72
77
  urn = RelatonIec.code_to_urn hit[:code], "en"
73
78
  [
74
- RelatonBib::DocumentIdentifier.new(id: hit[:code], type: "IEC"),
79
+ RelatonBib::DocumentIdentifier.new(id: hit[:code], type: "IEC", primary: true),
75
80
  RelatonBib::DocumentIdentifier.new(id: urn, type: "URN"),
76
81
  ]
77
82
  end
@@ -121,12 +126,12 @@ module RelatonIec
121
126
  item_ref = doc.at("//span[@itemprop='productID']")
122
127
  unless item_ref
123
128
  return RelatonIsoBib::StructuredIdentifier.new(
124
- project_number: "?", part_number: "", prefix: nil, id: "?"
129
+ project_number: "?", part_number: "", prefix: nil, id: "?",
125
130
  )
126
131
  end
127
132
 
128
133
  m = item_ref.text.match(
129
- /(?<=\s)(?<project>\d+)-?(?<part>(?<=-)\d+|)-?(?<subpart>(?<=-)\d+|)/
134
+ /(?<=\s)(?<project>\d+)-?(?<part>(?<=-)\d+|)-?(?<subpart>(?<=-)\d+|)/,
130
135
  )
131
136
  RelatonIsoBib::StructuredIdentifier.new(
132
137
  project_number: m[:project],
@@ -134,7 +139,7 @@ module RelatonIec
134
139
  subpart_number: m[:subpart],
135
140
  prefix: nil,
136
141
  type: "IEC",
137
- id: item_ref.text
142
+ id: item_ref.text,
138
143
  )
139
144
  end
140
145
 
@@ -190,7 +195,7 @@ module RelatonIec
190
195
  else r_type
191
196
  end
192
197
  fref = RelatonBib::FormattedRef.new(
193
- content: r.at("FULL_NAME").text, format: "text/plain"
198
+ content: r.at("FULL_NAME").text, format: "text/plain",
194
199
  )
195
200
  bibitem = IecBibliographicItem.new(formattedref: fref)
196
201
  { type: type, bibitem: bibitem }
@@ -199,8 +204,8 @@ module RelatonIec
199
204
 
200
205
  def fetch_status_relations(url)
201
206
  pubid = url.match(/\d+$/).to_s
202
- uri = URI DOMAIN + "/webstore/webstore.nsf/AjaxRequestXML?"\
203
- "Openagent&url=" + pubid
207
+ uri = URI "#{DOMAIN}/webstore/webstore.nsf/AjaxRequestXML?"\
208
+ "Openagent&url=#{pubid}"
204
209
  resp = Net::HTTP.get_response uri
205
210
  doc = Nokogiri::XML resp.body
206
211
  status = fetch_status doc
@@ -214,7 +219,7 @@ module RelatonIec
214
219
  # @return [String]
215
220
  def fetch_type(doc)
216
221
  doc.at(
217
- '//th[contains(., "Publication type")]/following-sibling::td/span'
222
+ '//th[contains(., "Publication type")]/following-sibling::td/span',
218
223
  ).text.downcase.tr " ", "-"
219
224
  end
220
225
 
@@ -253,9 +258,9 @@ module RelatonIec
253
258
  # @return [Array<Hash>]
254
259
  def fetch_ics(doc)
255
260
  doc.xpath(
256
- '//th[contains(text(), "ICS")]/following-sibling::td/a'
261
+ '//th[contains(text(), "ICS")]/following-sibling::td/a',
257
262
  ).map do |i|
258
- code = i.text.match(/[\d\.]+/).to_s.split "."
263
+ code = i.text.match(/[\d.]+/).to_s.split "."
259
264
  { field: code[0], group: code[1], subgroup: code[2] }
260
265
  end
261
266
  end
@@ -292,11 +297,7 @@ module RelatonIec
292
297
  # rubocop:enable Metrics/MethodLength
293
298
 
294
299
  def name_url(abbrev)
295
- case abbrev
296
- when "ISO" then ["International Organization for Standardization", "www.iso.org"]
297
- when "IEC" then ["International Electrotechnical Commission", "www.iec.ch"]
298
- when "CISPR" then ["International special committee on radio interference", "www.iec.ch"]
299
- end
300
+ ABBREVS[abbrev]
300
301
  end
301
302
  end
302
303
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.9.0".freeze
2
+ VERSION = "1.11.0".freeze
3
3
  end
data/relaton_iec.gemspec CHANGED
@@ -33,5 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "webmock"
34
34
 
35
35
  spec.add_dependency "addressable"
36
- spec.add_dependency "relaton-iso-bib", "~> 1.9.0"
36
+ spec.add_dependency "relaton-iso-bib", "~> 1.11.0"
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.11.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-08-26 00:00:00.000000000 Z
11
+ date: 2022-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.9.0
145
+ version: 1.11.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.9.0
152
+ version: 1.11.0
153
153
  description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
154
154
  model'
155
155
  email: