relaton-iec 1.13.0 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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]
@@ -39,6 +39,15 @@ module RelatonIec
39
39
  super
40
40
  end
41
41
 
42
+ #
43
+ # Fetch flavor schema version
44
+ #
45
+ # @return [String] schema version
46
+ #
47
+ def ext_schema
48
+ schema_versions["relaton-model-iec"]
49
+ end
50
+
42
51
  # @param hash [Hash]
43
52
  # @return [RelatonIsoBib::IecBibliographicItem]
44
53
  def self.from_hash(hash)
@@ -54,7 +63,7 @@ module RelatonIec
54
63
  def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
55
64
  super(**opts) do |b|
56
65
  if opts[:bibdata]
57
- b.ext do
66
+ ext = b.ext do
58
67
  b.doctype doctype if doctype
59
68
  b.horizontal horizontal unless horizontal.nil?
60
69
  b.function function if function
@@ -75,6 +84,7 @@ module RelatonIec
75
84
  b.send(:"interest-to-committees", interest_to_committees)
76
85
  end
77
86
  end
87
+ ext["schema-version"] = ext_schema unless opts[:embedded]
78
88
  end
79
89
  end
80
90
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.13.0".freeze
2
+ VERSION = "1.14.0".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.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: 2022-08-21 00:00:00.000000000 Z
11
+ date: 2022-12-04 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
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>