metanorma-iec 2.0.7 → 2.1.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.
- checksums.yaml +4 -4
- data/lib/isodoc/iec/base_convert.rb +5 -5
- data/lib/isodoc/iec/html/html_iec_titlepage.html +1 -0
- data/lib/isodoc/iec/iec.international-standard.xsl +1596 -311
- data/lib/isodoc/iec/init.rb +6 -5
- data/lib/isodoc/iec/metadata.rb +2 -2
- data/lib/isodoc/iec/presentation_xml_convert.rb +3 -3
- data/lib/isodoc/iec/word_convert.rb +3 -3
- data/lib/isodoc/iec/xref.rb +4 -0
- data/lib/metanorma/iec/biblio.rng +62 -10
- data/lib/metanorma/iec/front.rb +1 -1
- data/lib/metanorma/iec/iec.rng +1 -0
- data/lib/metanorma/iec/isodoc.rng +56 -0
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +3 -2
- data/spec/isodoc/blocks_spec.rb +146 -202
- data/spec/isodoc/i18n_spec.rb +22 -7
- data/spec/isodoc/iev_spec.rb +8 -8
- data/spec/isodoc/inline_spec.rb +255 -249
- data/spec/isodoc/metadata_spec.rb +9 -9
- data/spec/isodoc/postproc_spec.rb +2 -2
- data/spec/isodoc/ref_spec.rb +14 -62
- data/spec/metanorma/base_spec.rb +2 -2
- data/spec/metanorma/blocks_spec.rb +2 -2
- data/spec/metanorma/cleanup_spec.rb +1 -1
- data/spec/metanorma/iev_spec.rb +1 -1
- data/spec/metanorma/inline_spec.rb +86 -70
- data/spec/metanorma/section_spec.rb +196 -183
- data/spec/spec_helper.rb +7 -0
- metadata +4 -4
@@ -1,12 +1,12 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe Metanorma::Iec do
|
4
|
-
|
5
|
-
|
6
|
-
end
|
4
|
+
before(:all) do
|
5
|
+
@blank_hdr = blank_hdr_gen
|
6
|
+
end
|
7
7
|
|
8
8
|
it "processes sections" do
|
9
|
-
|
9
|
+
input = <<~INPUT
|
10
10
|
#{ASCIIDOC_BLANK_HDR}
|
11
11
|
.Foreword
|
12
12
|
|
@@ -56,69 +56,72 @@ end
|
|
56
56
|
|
57
57
|
=== Bibliography Subsection
|
58
58
|
INPUT
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
59
|
+
output = <<~OUTPUT
|
60
|
+
#{@blank_hdr}
|
61
|
+
<preface><foreword id="_" obligation="informative">
|
62
|
+
<title>FOREWORD</title>
|
63
|
+
<p id="_">Text</p>
|
64
|
+
</foreword><introduction id="_" obligation="informative">
|
65
|
+
<title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
|
66
|
+
<title>Introduction Subsection</title>
|
67
|
+
</clause>
|
68
|
+
</introduction></preface><sections>
|
69
|
+
<clause id="_" obligation="normative" type="scope" inline-header='false'>
|
70
|
+
<title>Scope</title>
|
71
|
+
<p id="_">Text</p>
|
72
|
+
</clause>
|
73
|
+
|
74
|
+
<terms id="_" obligation="normative">
|
75
|
+
<title>Terms and definitions</title>
|
76
|
+
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
77
|
+
#{TERMS_BOILERPLATE}
|
78
|
+
<term id="term-Term1">
|
79
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
80
|
+
</term>
|
81
|
+
</terms>
|
82
|
+
<clause id="_" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="_" obligation="normative">
|
83
|
+
<title>Normal Terms</title>
|
84
|
+
<term id="term-Term2">
|
85
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
86
|
+
</term>
|
87
|
+
</terms>
|
88
|
+
<definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions></clause>
|
89
|
+
<definitions id="_" obligation="normative"><title>Symbols and abbreviated terms</title></definitions>
|
90
|
+
<clause id="_" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="_" inline-header="false" obligation="normative">
|
91
|
+
<title>Introduction</title>
|
92
|
+
</clause>
|
93
|
+
<clause id="_" inline-header="false" obligation="normative">
|
94
|
+
<title>Clause 4.2</title>
|
95
|
+
</clause></clause>
|
96
|
+
<clause id="_" inline-header="false" obligation="normative">
|
97
|
+
<title>Terms and Definitions</title>
|
98
|
+
</clause>
|
99
|
+
|
100
|
+
|
101
|
+
</sections><annex id="_" inline-header="false" obligation="normative">
|
102
|
+
<title>Annex</title>
|
103
|
+
<clause id="_" inline-header="false" obligation="normative">
|
104
|
+
<title>Annex A.1</title>
|
105
|
+
</clause>
|
106
|
+
<appendix id="_" inline-header="false" obligation="normative">
|
107
|
+
<title>Appendix 1</title>
|
108
|
+
</appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
|
109
|
+
<title>Normative references</title><p id="_">There are no normative references in this document.</p>
|
110
|
+
</references><clause id="_" obligation="informative">
|
111
|
+
<title>Bibliography</title>
|
112
|
+
<references id="_" obligation="informative" normative="false">
|
113
|
+
<title>Bibliography Subsection</title>
|
114
|
+
</references>
|
115
|
+
</clause>
|
116
|
+
</bibliography>
|
117
|
+
</iec-standard>
|
117
118
|
OUTPUT
|
119
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
120
|
+
.to be_equivalent_to xmlpp(output)
|
118
121
|
end
|
119
122
|
|
120
123
|
it "processes sections with title attributes" do
|
121
|
-
|
124
|
+
input = <<~INPUT
|
122
125
|
#{ASCIIDOC_BLANK_HDR}
|
123
126
|
.Foreword
|
124
127
|
|
@@ -174,84 +177,86 @@ end
|
|
174
177
|
|
175
178
|
=== Bibliography Subsection
|
176
179
|
INPUT
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<
|
185
|
-
|
186
|
-
|
187
|
-
</introduction>
|
188
|
-
</preface>
|
189
|
-
<sections>
|
190
|
-
<clause id="_" obligation="normative" type="scope" inline-header='false'>
|
191
|
-
<title>Scope</title>
|
192
|
-
<p id="_">Text</p>
|
193
|
-
</clause>
|
194
|
-
|
195
|
-
<terms id="_" obligation="normative">
|
196
|
-
<title>Terms and definitions</title>
|
197
|
-
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
198
|
-
#{TERMS_BOILERPLATE}
|
199
|
-
<term id="term-term1">
|
200
|
-
<preferred><expression><name>Term1</name></expression></preferred>
|
201
|
-
</term>
|
202
|
-
</terms>
|
203
|
-
<clause id='_' obligation='normative'>
|
204
|
-
<title>Terms, definitions, symbols and abbreviated terms</title>
|
205
|
-
<terms id='_' obligation='normative'>
|
206
|
-
<title>Normal Terms</title>
|
207
|
-
<term id='term-term2'>
|
208
|
-
<preferred><expression><name>Term2</name></expression></preferred>
|
209
|
-
</term>
|
210
|
-
</terms>
|
211
|
-
<definitions id='_' obligation="normative">
|
212
|
-
<title>Symbols and abbreviated terms</title>
|
213
|
-
</definitions>
|
214
|
-
</clause>
|
215
|
-
<definitions id='_' obligation="normative">
|
216
|
-
<title>Symbols and abbreviated terms</title>
|
217
|
-
</definitions>
|
218
|
-
<clause id='_' inline-header='false' obligation='normative'>
|
219
|
-
<title>Clause 4</title>
|
220
|
-
<clause id='_' inline-header='false' obligation='normative'>
|
221
|
-
<title>Introduction</title>
|
180
|
+
output = <<~OUTPUT
|
181
|
+
#{@blank_hdr}
|
182
|
+
<preface>
|
183
|
+
<foreword id="_" obligation="informative">
|
184
|
+
<title>FOREWORD</title>
|
185
|
+
<p id="_">Text</p>
|
186
|
+
</foreword>
|
187
|
+
<introduction id="_" obligation="informative">
|
188
|
+
<title>INTRODUCTION</title><clause id="_" inline-header="false" obligation="informative">
|
189
|
+
<title>Introduction Subsection</title>
|
222
190
|
</clause>
|
223
|
-
|
224
|
-
|
191
|
+
</introduction>
|
192
|
+
</preface>
|
193
|
+
<sections>
|
194
|
+
<clause id="_" obligation="normative" type="scope" inline-header='false'>
|
195
|
+
<title>Scope</title>
|
196
|
+
<p id="_">Text</p>
|
225
197
|
</clause>
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
<
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
198
|
+
<terms id="_" obligation="normative">
|
199
|
+
<title>Terms and definitions</title>
|
200
|
+
<p id="_">For the purposes of this document, the following terms and definitions apply.</p>
|
201
|
+
#{TERMS_BOILERPLATE}
|
202
|
+
<term id="term-Term1">
|
203
|
+
<preferred><expression><name>Term1</name></expression></preferred>
|
204
|
+
</term>
|
205
|
+
</terms>
|
206
|
+
<clause id='_' obligation='normative'>
|
207
|
+
<title>Terms, definitions, symbols and abbreviated terms</title>
|
208
|
+
<terms id='_' obligation='normative'>
|
209
|
+
<title>Normal Terms</title>
|
210
|
+
<term id='term-Term2'>
|
211
|
+
<preferred><expression><name>Term2</name></expression></preferred>
|
212
|
+
</term>
|
213
|
+
</terms>
|
214
|
+
<definitions id='_' obligation="normative">
|
215
|
+
<title>Symbols and abbreviated terms</title>
|
216
|
+
</definitions>
|
217
|
+
</clause>
|
218
|
+
<definitions id='_' obligation="normative">
|
219
|
+
<title>Symbols and abbreviated terms</title>
|
220
|
+
</definitions>
|
221
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
222
|
+
<title>Clause 4</title>
|
223
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
224
|
+
<title>Introduction</title>
|
225
|
+
</clause>
|
226
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
227
|
+
<title>Clause 4.2</title>
|
228
|
+
</clause>
|
229
|
+
</clause>
|
230
|
+
</sections>
|
231
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
232
|
+
<title>Annex</title>
|
233
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
234
|
+
<title>Annex A.1</title>
|
235
|
+
</clause>
|
236
|
+
<appendix id='_' inline-header='false' obligation='normative'>
|
237
|
+
<title>Appendx 1</title>
|
238
|
+
</appendix>
|
239
|
+
</annex>
|
240
|
+
<bibliography>
|
241
|
+
<references id='_' obligation='informative' normative="true">
|
242
|
+
<title>Normative references</title>
|
243
|
+
<p id="_">There are no normative references in this document.</p>
|
244
|
+
</references>
|
245
|
+
<clause id='_' obligation='informative'>
|
246
|
+
<title>Bibliography</title>
|
247
|
+
<references id='_' obligation='informative' normative="false">
|
248
|
+
<title>Bibliography Subsection</title>
|
249
|
+
</references>
|
250
|
+
</clause>
|
251
|
+
</bibliography>
|
252
|
+
</iec-standard>
|
250
253
|
OUTPUT
|
254
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
255
|
+
.to be_equivalent_to xmlpp(output)
|
251
256
|
end
|
252
257
|
|
253
258
|
it "processes section obligations" do
|
254
|
-
|
259
|
+
input = <<~INPUT
|
255
260
|
#{ASCIIDOC_BLANK_HDR}
|
256
261
|
[obligation=informative]
|
257
262
|
== Clause 1
|
@@ -263,26 +268,29 @@ end
|
|
263
268
|
|
264
269
|
[appendix,obligation=informative]
|
265
270
|
== Annex
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
271
|
+
INPUT
|
272
|
+
output = <<~OUTPUT
|
273
|
+
#{@blank_hdr}
|
274
|
+
<sections><clause id="_" inline-header="false" obligation="informative">
|
275
|
+
<title>Clause 1</title>
|
276
|
+
<clause id="_" inline-header="false" obligation="informative">
|
277
|
+
<title>Clause 1a</title>
|
278
|
+
</clause>
|
279
|
+
</clause>
|
280
|
+
<clause id="_" inline-header="false" obligation="normative">
|
281
|
+
<title>Clause 2</title>
|
282
|
+
</clause>
|
283
|
+
</sections><annex id="_" inline-header="false" obligation="informative">
|
284
|
+
<title>Annex</title>
|
285
|
+
</annex>
|
286
|
+
</iec-standard>
|
287
|
+
OUTPUT
|
288
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
289
|
+
.to be_equivalent_to xmlpp(output)
|
282
290
|
end
|
283
291
|
|
284
|
-
|
285
|
-
|
292
|
+
it "processes inline headers" do
|
293
|
+
input = <<~INPUT
|
286
294
|
#{ASCIIDOC_BLANK_HDR}
|
287
295
|
== Clause 1
|
288
296
|
|
@@ -294,42 +302,47 @@ end
|
|
294
302
|
|
295
303
|
[%inline-header]
|
296
304
|
=== Clause Aa
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
305
|
+
INPUT
|
306
|
+
output = <<~OUTPUT
|
307
|
+
#{@blank_hdr}
|
308
|
+
<sections><clause id="_" inline-header="false" obligation="normative">
|
309
|
+
<title>Clause 1</title>
|
310
|
+
<clause id="_" inline-header="true" obligation="normative">
|
311
|
+
<title>Clause 1a</title>
|
312
|
+
</clause>
|
313
|
+
</clause>
|
314
|
+
</sections><annex id="_" inline-header="false" obligation="normative">
|
315
|
+
<title>Annex A</title>
|
316
|
+
<clause id="_" inline-header="true" obligation="normative">
|
317
|
+
<title>Clause Aa</title>
|
318
|
+
</clause>
|
319
|
+
</annex>
|
320
|
+
</iec-standard>
|
321
|
+
OUTPUT
|
322
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
323
|
+
.to be_equivalent_to xmlpp(output)
|
324
|
+
end
|
314
325
|
|
315
326
|
it "processes blank headers" do
|
316
|
-
|
327
|
+
input = <<~INPUT
|
317
328
|
#{ASCIIDOC_BLANK_HDR}
|
318
329
|
== Clause 1
|
319
330
|
|
320
331
|
=== {blank}
|
321
332
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
+
INPUT
|
334
|
+
output = <<~OUTPUT
|
335
|
+
#{@blank_hdr}
|
336
|
+
<sections>
|
337
|
+
<clause id="_" inline-header="false" obligation="normative">
|
338
|
+
<title>Clause 1</title>
|
339
|
+
<clause id="_" inline-header="false" obligation="normative">
|
340
|
+
</clause>
|
341
|
+
</clause>
|
342
|
+
</sections>
|
343
|
+
</iec-standard>
|
344
|
+
OUTPUT
|
345
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
346
|
+
.to be_equivalent_to xmlpp(output)
|
333
347
|
end
|
334
|
-
|
335
348
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -37,6 +37,13 @@ def strip_guid(xml)
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def xmlpp(xml)
|
40
|
+
c = HTMLEntities.new
|
41
|
+
xml &&= xml.split(/(&\S+?;)/).map do |n|
|
42
|
+
if /^&\S+?;$/.match?(n)
|
43
|
+
c.encode(c.decode(n), :hexadecimal)
|
44
|
+
else n
|
45
|
+
end
|
46
|
+
end.join
|
40
47
|
s = ""
|
41
48
|
f = REXML::Formatters::Pretty.new(2)
|
42
49
|
f.compact = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-jing
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|