relaton-iec 1.13.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,284 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <include href="biblio-standoc.rng">
4
+ <define name="BibDataExtensionType">
5
+ <optional>
6
+ <attribute name="schema-version"/>
7
+ </optional>
8
+ <ref name="doctype"/>
9
+ <optional>
10
+ <ref name="docsubtype"/>
11
+ </optional>
12
+ <optional>
13
+ <ref name="horizontal"/>
14
+ </optional>
15
+ <optional>
16
+ <ref name="function"/>
17
+ </optional>
18
+ <ref name="editorialgroup"/>
19
+ <zeroOrMore>
20
+ <ref name="ics"/>
21
+ </zeroOrMore>
22
+ <ref name="structuredidentifier"/>
23
+ <optional>
24
+ <ref name="stagename"/>
25
+ </optional>
26
+ <optional>
27
+ <ref name="updates_document_type"/>
28
+ </optional>
29
+ <optional>
30
+ <ref name="accessibility-color-inside"/>
31
+ </optional>
32
+ <optional>
33
+ <ref name="price-code"/>
34
+ </optional>
35
+ <optional>
36
+ <ref name="cen-processing"/>
37
+ </optional>
38
+ <optional>
39
+ <ref name="secretary"/>
40
+ </optional>
41
+ <optional>
42
+ <ref name="interest-to-committees"/>
43
+ </optional>
44
+ <optional>
45
+ <ref name="tc-sc-officers-note"/>
46
+ </optional>
47
+ </define>
48
+ <define name="bdate">
49
+ <element name="date">
50
+ <attribute name="type">
51
+ <choice>
52
+ <ref name="BibliographicDateType"/>
53
+ <text/>
54
+ </choice>
55
+ </attribute>
56
+ <choice>
57
+ <group>
58
+ <element name="from">
59
+ <ref name="ISO8601Date"/>
60
+ </element>
61
+ <optional>
62
+ <element name="to">
63
+ <ref name="ISO8601Date"/>
64
+ </element>
65
+ </optional>
66
+ </group>
67
+ <element name="on">
68
+ <choice>
69
+ <ref name="ISO8601Date"/>
70
+ <value>--</value>
71
+ <value>–</value>
72
+ </choice>
73
+ </element>
74
+ </choice>
75
+ </element>
76
+ </define>
77
+ <define name="organization">
78
+ <element name="organization">
79
+ <oneOrMore>
80
+ <ref name="orgname"/>
81
+ </oneOrMore>
82
+ <optional>
83
+ <ref name="abbreviation"/>
84
+ </optional>
85
+ <optional>
86
+ <ref name="uri"/>
87
+ </optional>
88
+ <zeroOrMore>
89
+ <ref name="org-identifier"/>
90
+ </zeroOrMore>
91
+ <zeroOrMore>
92
+ <ref name="contact"/>
93
+ </zeroOrMore>
94
+ <optional>
95
+ <ref name="technical-committee"/>
96
+ </optional>
97
+ <optional>
98
+ <ref name="subcommittee"/>
99
+ </optional>
100
+ <optional>
101
+ <ref name="workgroup"/>
102
+ </optional>
103
+ <optional>
104
+ <ref name="secretariat"/>
105
+ </optional>
106
+ </element>
107
+ </define>
108
+ <define name="DocumentType">
109
+ <choice>
110
+ <value>international-standard</value>
111
+ <value>technical-specification</value>
112
+ <value>technical-report</value>
113
+ <value>publicly-available-specification</value>
114
+ <value>international-workshop-agreement</value>
115
+ <value>guide</value>
116
+ <value>industry-technical-agreement</value>
117
+ <value>system-reference-deliverable</value>
118
+ </choice>
119
+ </define>
120
+ <define name="DocumentSubtype">
121
+ <choice>
122
+ <value>specification</value>
123
+ <value>method-of-test</value>
124
+ <value>vocabulary</value>
125
+ <value>code-of-practice</value>
126
+ </choice>
127
+ </define>
128
+ <define name="structuredidentifier">
129
+ <element name="structuredidentifier">
130
+ <optional>
131
+ <attribute name="type"/>
132
+ </optional>
133
+ <group>
134
+ <ref name="documentnumber"/>
135
+ <optional>
136
+ <ref name="tc-documentnumber"/>
137
+ </optional>
138
+ </group>
139
+ </element>
140
+ </define>
141
+ <define name="editorialgroup">
142
+ <element name="editorialgroup">
143
+ <ref name="ISOProjectGroup"/>
144
+ </element>
145
+ </define>
146
+ </include>
147
+ <define name="updates_document_type">
148
+ <element name="updates-document-type">
149
+ <ref name="DocumentType"/>
150
+ </element>
151
+ </define>
152
+ <define name="ISOProjectGroup">
153
+ <zeroOrMore>
154
+ <ref name="agency"/>
155
+ </zeroOrMore>
156
+ <oneOrMore>
157
+ <ref name="technical-committee"/>
158
+ </oneOrMore>
159
+ <zeroOrMore>
160
+ <ref name="subcommittee"/>
161
+ </zeroOrMore>
162
+ <zeroOrMore>
163
+ <ref name="workgroup"/>
164
+ </zeroOrMore>
165
+ <optional>
166
+ <ref name="secretariat"/>
167
+ </optional>
168
+ </define>
169
+ <define name="approvalgroup">
170
+ <element name="approvalgroup">
171
+ <ref name="ISOProjectGroup"/>
172
+ </element>
173
+ </define>
174
+ <define name="agency">
175
+ <element name="agency">
176
+ <text/>
177
+ </element>
178
+ </define>
179
+ <define name="horizontal">
180
+ <element name="horizontal">
181
+ <data type="boolean"/>
182
+ </element>
183
+ </define>
184
+ <define name="documentnumber">
185
+ <element name="project-number">
186
+ <optional>
187
+ <attribute name="part">
188
+ <data type="int"/>
189
+ </attribute>
190
+ </optional>
191
+ <optional>
192
+ <attribute name="subpart">
193
+ <data type="int"/>
194
+ </attribute>
195
+ </optional>
196
+ <optional>
197
+ <attribute name="amendment">
198
+ <data type="int"/>
199
+ </attribute>
200
+ </optional>
201
+ <optional>
202
+ <attribute name="corrigendum">
203
+ <data type="int"/>
204
+ </attribute>
205
+ </optional>
206
+ <optional>
207
+ <attribute name="origyr">
208
+ <ref name="ISO8601Date"/>
209
+ </attribute>
210
+ </optional>
211
+ <text/>
212
+ </element>
213
+ </define>
214
+ <define name="tc-documentnumber">
215
+ <element name="tc-document-number">
216
+ <data type="int"/>
217
+ </element>
218
+ </define>
219
+ <define name="subcommittee">
220
+ <element name="subcommittee">
221
+ <ref name="IsoWorkgroup"/>
222
+ </element>
223
+ </define>
224
+ <define name="workgroup">
225
+ <element name="workgroup">
226
+ <ref name="IsoWorkgroup"/>
227
+ </element>
228
+ </define>
229
+ <define name="secretariat">
230
+ <element name="secretariat">
231
+ <text/>
232
+ </element>
233
+ </define>
234
+ <define name="stagename">
235
+ <element name="stagename">
236
+ <optional>
237
+ <attribute name="abbreviation"/>
238
+ </optional>
239
+ <text/>
240
+ </element>
241
+ </define>
242
+ <define name="function">
243
+ <element name="function">
244
+ <choice>
245
+ <value>emc</value>
246
+ <value>safety</value>
247
+ <value>environment</value>
248
+ <value>quality-assurance</value>
249
+ </choice>
250
+ </element>
251
+ </define>
252
+ <define name="accessibility-color-inside">
253
+ <element name="accessibility-color-inside">
254
+ <data type="boolean"/>
255
+ </element>
256
+ </define>
257
+ <define name="price-code">
258
+ <element name="price-code">
259
+ <text/>
260
+ </element>
261
+ </define>
262
+ <define name="cen-processing">
263
+ <element name="cen-processing">
264
+ <data type="boolean"/>
265
+ </element>
266
+ </define>
267
+ <define name="secretary">
268
+ <element name="secretary">
269
+ <text/>
270
+ </element>
271
+ </define>
272
+ <define name="interest-to-committees">
273
+ <element name="interest-to-committees">
274
+ <text/>
275
+ </element>
276
+ </define>
277
+ <define name="tc-sc-officers-note">
278
+ <element name="tc-sc-officers-note">
279
+ <zeroOrMore>
280
+ <ref name="BasicBlock"/>
281
+ </zeroOrMore>
282
+ </element>
283
+ </define>
284
+ </grammar>
@@ -66,10 +66,11 @@ module RelatonIec
66
66
  end
67
67
 
68
68
  def fetch_from_gh(ref)
69
- file = ref.sub(/^IEC\s/, "").gsub(/[\s\/]/, "_").upcase
69
+ file = ref.sub(/^IEC\s(?=ISO|CISPR)/, "").gsub(/[\s\/]/, "_").upcase
70
70
  url = "https://raw.githubusercontent.com/relaton/relaton-data-iec/main/data/#{file}.yaml"
71
71
  resp = Net::HTTP.get URI(url)
72
72
  hash = YAML.safe_load resp
73
+ hash["fetched"] = Date.today.to_s
73
74
  hit = Hit.new({ code: ref }, self)
74
75
  hit.fetch = IecBibliographicItem.from_hash hash
75
76
  [hit]
@@ -1,11 +1,13 @@
1
1
  module RelatonIec
2
2
  class IecBibliographicItem < RelatonIsoBib::IsoBibliographicItem
3
- TYPES = %w[
3
+ DOCTYPES = %w[
4
4
  international-standard technical-specification technical-report
5
5
  publicly-available-specification international-workshop-agreement
6
- guide industry-technical-agreement system-reference-delivrabble
6
+ guide industry-technical-agreement system-reference-deliverable
7
7
  ].freeze
8
8
 
9
+ DOCSUBTYPES = %w[specification method-of-test vocabulary code-of-practice].freeze
10
+
9
11
  FUNCTION = %w[emc safety enviroment quality-assurance].freeze
10
12
 
11
13
  # @return [String, nil]
@@ -17,17 +19,28 @@ module RelatonIec
17
19
 
18
20
  # attr_reader :tc_sc_officers_note
19
21
 
22
+ #
23
+ # Initialize instance of RelatonIec::IecBibliographicItem
24
+ #
25
+ # @param [Hash] **args hash of attributes
26
+ # @option args [String, nil] :function function
27
+ # @option args [String, nil] :updates_document_type updates document type
28
+ # @option args [String, nil] :price_code price code
29
+ # @option args [String, nil] :secretary secretary
30
+ # @option args [String, nil] :interest_to_committees interest to committees
31
+ # @option args [Boolean, nil] :accessibility_color_inside accessibility color inside
32
+ #
20
33
  def initialize(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
21
34
  if args[:function] && !FUNCTION.include?(args[:function])
22
35
  warn "[relaton-iec] WARNING: invalid function \"#{args[:function]}\""
23
36
  warn "[relaton-iec] allowed function values are: #{FUNCTION.join(', ')}"
24
37
  end
25
38
  if args[:updates_document_type] &&
26
- !TYPES.include?(args[:updates_document_type])
39
+ !DOCTYPES.include?(args[:updates_document_type])
27
40
  warn "[relaton-iec] WARNING: invalid updates_document_type "\
28
41
  "\"#{args[:updates_document_type]}\""
29
42
  warn "[relaton-iec] allowed updates_document_type values are: "\
30
- "#{TYPES.join(', ')}"
43
+ "#{DOCTYPES.join(', ')}"
31
44
  end
32
45
  @function = args.delete :function
33
46
  @updates_document_type = args.delete :updates_document_type
@@ -39,6 +52,15 @@ module RelatonIec
39
52
  super
40
53
  end
41
54
 
55
+ #
56
+ # Fetch flavor schema version
57
+ #
58
+ # @return [String] schema version
59
+ #
60
+ def ext_schema
61
+ schema_versions["relaton-model-iec"]
62
+ end
63
+
42
64
  # @param hash [Hash]
43
65
  # @return [RelatonIsoBib::IecBibliographicItem]
44
66
  def self.from_hash(hash)
@@ -54,7 +76,7 @@ module RelatonIec
54
76
  def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
55
77
  super(**opts) do |b|
56
78
  if opts[:bibdata]
57
- b.ext do
79
+ ext = b.ext do
58
80
  b.doctype doctype if doctype
59
81
  b.horizontal horizontal unless horizontal.nil?
60
82
  b.function function if function
@@ -75,6 +97,7 @@ module RelatonIec
75
97
  b.send(:"interest-to-committees", interest_to_committees)
76
98
  end
77
99
  end
100
+ ext["schema-version"] = ext_schema unless opts[:embedded]
78
101
  end
79
102
  end
80
103
  end
@@ -28,7 +28,7 @@ module RelatonIec
28
28
  "WD" => "working-draft",
29
29
  "R" => "recommendation",
30
30
  "Guide" => "guide",
31
- "SRD" => "system-reference-delivrabble",
31
+ "SRD" => "system-reference-deliverable",
32
32
  }.freeze
33
33
 
34
34
  class << self
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.13.0".freeze
2
+ VERSION = "1.14.1".freeze
3
3
  end
data/lib/relaton_iec.rb CHANGED
@@ -2,6 +2,8 @@ require "relaton_iso_bib"
2
2
  require "relaton_iec/hit"
3
3
  require "nokogiri"
4
4
  require "net/http"
5
+ require "open-uri"
6
+ require "jing"
5
7
  require "relaton_iec/version"
6
8
  require "relaton_iec/iec_bibliography"
7
9
  require "relaton_iec/iec_bibliographic_item"
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.13.0"
36
+ spec.add_dependency "relaton-iso-bib", "~> 1.14.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.13.0
4
+ version: 1.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-21 00:00:00.000000000 Z
11
+ date: 2022-12-21 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.13.0
145
+ version: 1.14.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.13.0
152
+ version: 1.14.0
153
153
  description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
154
154
  model'
155
155
  email:
@@ -159,6 +159,7 @@ extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
161
  - ".github/workflows/rake.yml"
162
+ - ".github/workflows/release.yml"
162
163
  - ".gitignore"
163
164
  - ".rspec"
164
165
  - ".rubocop.yml"
@@ -170,11 +171,10 @@ files:
170
171
  - bin/rspec
171
172
  - bin/setup
172
173
  - grammars/basicdoc.rng
174
+ - grammars/biblio-standoc.rng
173
175
  - grammars/biblio.rng
174
- - grammars/iec.rng
175
- - grammars/isodoc.rng
176
- - grammars/isostandard.rng
177
- - grammars/reqt.rng
176
+ - grammars/relaton-iec-compile.rng
177
+ - grammars/relaton-iec.rng
178
178
  - lib/relaton_iec.rb
179
179
  - lib/relaton_iec/basic_block/alignment.rb
180
180
  - lib/relaton_iec/basic_block/basic_block.rb
@@ -209,7 +209,7 @@ homepage: https://github.com/metanorma/relaton-iec
209
209
  licenses:
210
210
  - MIT
211
211
  metadata: {}
212
- post_install_message:
212
+ post_install_message:
213
213
  rdoc_options: []
214
214
  require_paths:
215
215
  - lib
@@ -224,8 +224,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  requirements: []
227
- rubygems_version: 3.2.3
228
- signing_key:
227
+ rubygems_version: 3.1.6
228
+ signing_key:
229
229
  specification_version: 4
230
230
  summary: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
231
231
  model'
data/grammars/iec.rng DELETED
@@ -1,194 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- default namespace = "https://www.metanorma.com/ns/iec" -->
4
- <include href="isostandard.rng">
5
- <start>
6
- <ref name="iec-standard"/>
7
- </start>
8
- <define name="DocumentType">
9
- <choice>
10
- <value>international-standard</value>
11
- <value>technical-specification</value>
12
- <value>technical-report</value>
13
- <value>publicly-available-specification</value>
14
- <value>international-workshop-agreement</value>
15
- <value>guide</value>
16
- <value>industry-technical-agreement</value>
17
- <value>system-reference-delivrabble</value>
18
- </choice>
19
- </define>
20
- <define name="BibDataExtensionType">
21
- <ref name="doctype"/>
22
- <optional>
23
- <ref name="docsubtype"/>
24
- </optional>
25
- <optional>
26
- <ref name="horizontal"/>
27
- </optional>
28
- <optional>
29
- <ref name="function"/>
30
- </optional>
31
- <ref name="editorialgroup"/>
32
- <zeroOrMore>
33
- <ref name="ics"/>
34
- </zeroOrMore>
35
- <ref name="structuredidentifier"/>
36
- <optional>
37
- <ref name="stagename"/>
38
- </optional>
39
- <optional>
40
- <ref name="updates_document_type"/>
41
- </optional>
42
- <optional>
43
- <ref name="accessibility-color-inside"/>
44
- </optional>
45
- <optional>
46
- <ref name="price-code"/>
47
- </optional>
48
- <optional>
49
- <ref name="cen-processing"/>
50
- </optional>
51
- <optional>
52
- <ref name="secretary"/>
53
- </optional>
54
- <optional>
55
- <ref name="interest-to-committees"/>
56
- </optional>
57
- <optional>
58
- <ref name="tc-sc-officers-note"/>
59
- </optional>
60
- </define>
61
- <define name="term">
62
- <element name="term">
63
- <optional>
64
- <attribute name="id">
65
- <data type="ID"/>
66
- </attribute>
67
- </optional>
68
- <optional>
69
- <attribute name="language"/>
70
- </optional>
71
- <optional>
72
- <attribute name="script"/>
73
- </optional>
74
- <optional>
75
- <attribute name="tag"/>
76
- </optional>
77
- <optional>
78
- <attribute name="multilingual-rendering">
79
- <ref name="MultilingualRenderingType"/>
80
- </attribute>
81
- </optional>
82
- <oneOrMore>
83
- <ref name="preferred"/>
84
- </oneOrMore>
85
- <zeroOrMore>
86
- <ref name="admitted"/>
87
- </zeroOrMore>
88
- <zeroOrMore>
89
- <ref name="deprecates"/>
90
- </zeroOrMore>
91
- <optional>
92
- <ref name="termdomain"/>
93
- </optional>
94
- <ref name="termdefinition"/>
95
- <zeroOrMore>
96
- <ref name="termnote"/>
97
- </zeroOrMore>
98
- <zeroOrMore>
99
- <ref name="termexample"/>
100
- </zeroOrMore>
101
- <zeroOrMore>
102
- <ref name="termsource"/>
103
- </zeroOrMore>
104
- <zeroOrMore>
105
- <ref name="term"/>
106
- </zeroOrMore>
107
- </element>
108
- </define>
109
- </include>
110
- <!-- end overrides -->
111
- <define name="function">
112
- <element name="function">
113
- <choice>
114
- <value>emc</value>
115
- <value>safety</value>
116
- <value>environment</value>
117
- <value>quality-assurance</value>
118
- </choice>
119
- </element>
120
- </define>
121
- <define name="accessibility-color-inside">
122
- <element name="accessibility-color-inside">
123
- <data type="boolean"/>
124
- </element>
125
- </define>
126
- <define name="price-code">
127
- <element name="price-code">
128
- <text/>
129
- </element>
130
- </define>
131
- <define name="cen-processing">
132
- <element name="cen-processing">
133
- <data type="boolean"/>
134
- </element>
135
- </define>
136
- <define name="secretary">
137
- <element name="secretary">
138
- <text/>
139
- </element>
140
- </define>
141
- <define name="interest-to-committees">
142
- <element name="interest-to-committees">
143
- <text/>
144
- </element>
145
- </define>
146
- <define name="tc-sc-officers-note">
147
- <element name="tc-sc-officers-note">
148
- <zeroOrMore>
149
- <ref name="BasicBlock"/>
150
- </zeroOrMore>
151
- </element>
152
- </define>
153
- <!--
154
- We display the Normative References between scope and terms; but to keep the
155
- grammar simple, we keep the references together
156
- -->
157
- <define name="iec-standard">
158
- <element name="iec-standard">
159
- <attribute name="version"/>
160
- <attribute name="type">
161
- <choice>
162
- <value>semantic</value>
163
- <value>presentation</value>
164
- </choice>
165
- </attribute>
166
- <ref name="bibdata"/>
167
- <zeroOrMore>
168
- <ref name="termdocsource"/>
169
- </zeroOrMore>
170
- <optional>
171
- <ref name="misccontainer"/>
172
- </optional>
173
- <optional>
174
- <ref name="boilerplate"/>
175
- </optional>
176
- <ref name="preface"/>
177
- <oneOrMore>
178
- <ref name="sections"/>
179
- </oneOrMore>
180
- <zeroOrMore>
181
- <ref name="annex"/>
182
- </zeroOrMore>
183
- <ref name="bibliography"/>
184
- <zeroOrMore>
185
- <ref name="indexsect"/>
186
- </zeroOrMore>
187
- </element>
188
- </define>
189
- <define name="updates_document_type">
190
- <element name="updates-document-type">
191
- <ref name="DocumentType"/>
192
- </element>
193
- </define>
194
- </grammar>