metanorma-iec 2.1.11 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iec/html/htmlstyle.css +6 -0
  3. data/lib/isodoc/iec/iec.international-standard.xsl +460 -152
  4. data/lib/isodoc/iec/presentation_xml_convert.rb +8 -6
  5. data/lib/isodoc/iec/word_convert.rb +9 -35
  6. data/lib/metanorma/iec/biblio.rng +5 -0
  7. data/lib/metanorma/iec/iec_intro_en.xml +11 -12
  8. data/lib/metanorma/iec/iec_intro_fr.xml +11 -11
  9. data/lib/metanorma/iec/isodoc.rng +47 -13
  10. data/lib/metanorma/iec/version.rb +1 -1
  11. data/metanorma-iec.gemspec +5 -2
  12. metadata +4 -36
  13. data/.github/workflows/automerge.yml +0 -31
  14. data/.github/workflows/rake.yml +0 -15
  15. data/.github/workflows/release.yml +0 -24
  16. data/Rakefile +0 -8
  17. data/bin/rspec +0 -18
  18. data/spec/assets/header.html +0 -7
  19. data/spec/assets/html.css +0 -2
  20. data/spec/assets/iso.xml +0 -71
  21. data/spec/assets/rice_image1.png +0 -0
  22. data/spec/assets/word.css +0 -2
  23. data/spec/assets/wordintro.html +0 -4
  24. data/spec/assets/xref_error.adoc +0 -7
  25. data/spec/isodoc/blocks_spec.rb +0 -200
  26. data/spec/isodoc/i18n_spec.rb +0 -607
  27. data/spec/isodoc/iev_spec.rb +0 -888
  28. data/spec/isodoc/inline_spec.rb +0 -256
  29. data/spec/isodoc/iso_spec.rb +0 -211
  30. data/spec/isodoc/metadata_spec.rb +0 -251
  31. data/spec/isodoc/postproc_spec.rb +0 -303
  32. data/spec/isodoc/ref_spec.rb +0 -335
  33. data/spec/isodoc/section_spec.rb +0 -566
  34. data/spec/isodoc/terms_spec.rb +0 -192
  35. data/spec/metanorma/base_spec.rb +0 -1041
  36. data/spec/metanorma/blocks_spec.rb +0 -470
  37. data/spec/metanorma/cleanup_spec.rb +0 -372
  38. data/spec/metanorma/iev_spec.rb +0 -254
  39. data/spec/metanorma/inline_spec.rb +0 -145
  40. data/spec/metanorma/lists_spec.rb +0 -194
  41. data/spec/metanorma/processor_spec.rb +0 -171
  42. data/spec/metanorma/section_spec.rb +0 -348
  43. data/spec/metanorma/validate_spec.rb +0 -56
  44. data/spec/spec_helper.rb +0 -305
@@ -1,372 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Iec do
4
- before(:all) do
5
- @blank_hdr = blank_hdr_gen
6
- end
7
-
8
- it "moves note from TC/SC officers to metadata" do
9
- input = <<~INPUT
10
- #{ASCIIDOC_BLANK_HDR}
11
- == {blank}
12
-
13
- [NOTE]
14
- .Note from TC/SC Officers
15
- ====
16
- This FDIS is the result of the discussion between the IEC SC21A experts WG 3 during the meeting held in
17
- Chicago (USA) on April 9th
18
-
19
- This document is also of interest for ISO/ TC114/ WG1 Requirements for Watch batteries
20
- ====
21
- INPUT
22
- output = <<~OUTPUT
23
- <iec-standard xmlns="https://www.metanorma.org/ns/iec" type="semantic" version="#{Metanorma::Iec::VERSION}">
24
- <bibdata type="standard">
25
- <contributor>
26
- <role type="author"/>
27
- <organization>
28
- <name>International Electrotechnical Commission</name>
29
- <abbreviation>IEC</abbreviation>
30
- </organization>
31
- </contributor>
32
- <contributor>
33
- <role type="publisher"/>
34
- <organization>
35
- <name>International Electrotechnical Commission</name>
36
- <abbreviation>IEC</abbreviation>
37
- </organization>
38
- </contributor>
39
- <language>en</language>
40
- <script>Latn</script>
41
- <status>
42
- <stage abbreviation="PPUB">60</stage>
43
- <substage abbreviation="PPUB">60</substage>
44
- </status>
45
- <copyright>
46
- <from>#{Time.new.year}</from>
47
- <owner>
48
- <organization>
49
- <name>International Electrotechnical Commission</name>
50
- <abbreviation>IEC</abbreviation>
51
- </organization>
52
- </owner>
53
- </copyright>
54
- <ext>
55
- <doctype>standard</doctype>
56
- <editorialgroup>
57
- <agency>IEC</agency>
58
- </editorialgroup>
59
- <stagename>International standard</stagename>
60
- <tc-sc-officers-note>
61
- <p id='_'>
62
- This FDIS is the result of the discussion between the IEC SC21A
63
- experts WG 3 during the meeting held in Chicago (USA) on April 9th
64
- </p>
65
- <p id='_'>
66
- This document is also of interest for ISO/ TC114/ WG1 Requirements for
67
- Watch batteries
68
- </p>
69
- </tc-sc-officers-note>
70
- </ext>
71
- </bibdata>
72
- #{boilerplate(Nokogiri::XML(BLANK_HDR + '</iec-standard>'))}
73
- <sections>
74
- <clause id="_" inline-header="false" obligation="normative">
75
-
76
- </clause>
77
- </sections>
78
- </iec-standard>
79
- OUTPUT
80
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
81
- .to be_equivalent_to xmlpp(output)
82
- end
83
-
84
- it "removes empty text elements" do
85
- input = <<~INPUT
86
- #{ASCIIDOC_BLANK_HDR}
87
- == {blank}
88
- INPUT
89
- output = <<~OUTPUT
90
- #{@blank_hdr}
91
- <sections>
92
- <clause id="_" inline-header="false" obligation="normative">
93
-
94
- </clause>
95
- </sections>
96
- </iec-standard>
97
- OUTPUT
98
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
99
- .to be_equivalent_to xmlpp(output)
100
- end
101
-
102
- it "keeps any initial boilerplate from terms and definitions" do
103
- input = <<~INPUT
104
- #{ASCIIDOC_BLANK_HDR}
105
- == Terms and Definitions
106
-
107
- I am boilerplate
108
-
109
- * So am I
110
-
111
- === Time
112
-
113
- This paragraph is extraneous
114
- INPUT
115
- output = <<~OUTPUT
116
- #{@blank_hdr}
117
- <sections>
118
- <terms id="_" obligation="normative"><title>Terms and definitions</title>
119
- <p id="_">For the purposes of this document,
120
- the following terms and definitions apply.</p>
121
- #{TERMS_BOILERPLATE}
122
- <p id='_'>I am boilerplate</p>
123
- <ul id='_'>
124
- <li>
125
- <p id='_'>So am I</p>
126
- </li>
127
- </ul>
128
- <term id="term-Time">
129
- <preferred><expression><name>Time</name></expression></preferred>
130
- <definition><verbal-definition><p id="_">This paragraph is extraneous</p></verbal-definition></definition>
131
- </term></terms>
132
- </sections>
133
- </iec-standard>
134
- OUTPUT
135
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
136
- .to be_equivalent_to xmlpp(output)
137
- end
138
-
139
- it "strips type from xrefs" do
140
- input = <<~INPUT
141
- #{ASCIIDOC_BLANK_HDR}
142
- <<iso216>>
143
-
144
- [bibliography]
145
- == Clause
146
- * [[[iso216,ISO 216]]], _Reference_
147
- INPUT
148
- output = <<~OUTPUT
149
- #{@blank_hdr}
150
- <preface>
151
- <foreword id="_" obligation="informative">
152
- <title>FOREWORD</title>
153
- <p id="_">
154
- <eref type="inline" bibitemid="iso216" citeas="ISO 216"/>
155
- </p>
156
- </foreword></preface><sections>
157
- </sections><bibliography><references id="_" obligation="informative" normative="false">
158
- <title>Bibliography</title>
159
- <bibitem id="iso216" type="standard">
160
- <title format="text/plain">Reference</title>
161
- <docidentifier>ISO 216</docidentifier>
162
- <docnumber>216</docnumber>
163
- <contributor>
164
- <role type="publisher"/>
165
- <organization>
166
- <name>International Organization for Standardization</name>
167
- <abbreviation>ISO</abbreviation>
168
- </organization>
169
- </contributor>
170
- </bibitem>
171
- </references></bibliography>
172
- </iec-standard>
173
- OUTPUT
174
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
175
- .to be_equivalent_to xmlpp(output)
176
- end
177
-
178
- it "removes extraneous material from Normative References" do
179
- input = <<~INPUT
180
- #{ASCIIDOC_BLANK_HDR}
181
- [bibliography]
182
- == Normative References
183
-
184
- This is extraneous information
185
-
186
- * [[[iso216,ISO 216]]], _Reference_
187
- INPUT
188
- output = <<~OUTPUT
189
- #{@blank_hdr}
190
- <sections></sections>
191
- <bibliography><references id="_" obligation="informative" normative="true"><title>Normative references</title>
192
- <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
193
- <bibitem id="iso216" type="standard">
194
- <title format="text/plain">Reference</title>
195
- <docidentifier>ISO 216</docidentifier>
196
- <docnumber>216</docnumber>
197
- <contributor>
198
- <role type="publisher"/>
199
- <organization>
200
- <name>International Organization for Standardization</name>
201
- <abbreviation>ISO</abbreviation>
202
- </organization>
203
- </contributor>
204
- </bibitem>
205
- </references>
206
- </bibliography>
207
- </iec-standard>
208
- OUTPUT
209
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
210
- .to be_equivalent_to xmlpp(output)
211
- end
212
-
213
- it "inserts IDs into paragraphs" do
214
- input = <<~INPUT
215
- #{ASCIIDOC_BLANK_HDR}
216
- Paragraph
217
- INPUT
218
- output = <<~OUTPUT
219
- #{@blank_hdr}
220
- <sections>
221
- <p id="_">Paragraph</p>
222
- </sections>
223
- </iec-standard>
224
- OUTPUT
225
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
226
- .to be_equivalent_to xmlpp(output)
227
- end
228
-
229
- it "inserts IDs into notes" do
230
- input = <<~INPUT
231
- #{ASCIIDOC_BLANK_HDR}
232
- [example]
233
- ====
234
- NOTE: This note has no ID
235
- ====
236
- INPUT
237
- output = <<~OUTPUT
238
- #{@blank_hdr}
239
- <sections>
240
- <example id="_">
241
- <note id="_">
242
- <p id="_">This note has no ID</p>
243
- </note>
244
- </example>
245
- </sections>
246
- </iec-standard>
247
- OUTPUT
248
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
249
- .to be_equivalent_to xmlpp(output)
250
- end
251
-
252
- it "moves footnotes inside figures" do
253
- input = <<~INPUT
254
- #{ASCIIDOC_BLANK_HDR}
255
- image::spec/examples/rice_images/rice_image1.png[]
256
-
257
- footnote:[This is a footnote to a figure]
258
-
259
- footnote:[This is another footnote to a figure]
260
- INPUT
261
- output = <<~OUTPUT
262
- #{@blank_hdr}
263
- <sections><figure id="_">
264
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
265
- <fn reference="a">
266
- <p id="_">This is a footnote to a figure</p>
267
- </fn><fn reference="b">
268
- <p id="_">This is another footnote to a figure</p>
269
- </fn></figure>
270
-
271
- </sections>
272
-
273
- </iec-standard>
274
- OUTPUT
275
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
276
- .to be_equivalent_to xmlpp(output)
277
- end
278
-
279
- it "defaults section obligations" do
280
- input = <<~INPUT
281
- #{ASCIIDOC_BLANK_HDR}
282
-
283
- == Clause
284
- Text
285
-
286
- [appendix]
287
- == Clause
288
-
289
- Text
290
- INPUT
291
- output = <<~OUTPUT
292
- #{@blank_hdr}
293
- <sections><clause id="_" inline-header="false" obligation="normative">
294
- <title>Clause</title>
295
- <p id="_">Text</p>
296
- </clause>
297
- </sections><annex id="_" inline-header="false" obligation="normative">
298
- <title>Clause</title>
299
- <p id="_">Text</p>
300
- </annex>
301
- </iec-standard>
302
- OUTPUT
303
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
304
- .to be_equivalent_to xmlpp(output)
305
- end
306
-
307
- it "extends clause levels past 5" do
308
- input = <<~INPUT
309
- #{ASCIIDOC_BLANK_HDR}
310
-
311
- == Clause1
312
-
313
- === Clause2
314
-
315
- ==== Clause3
316
-
317
- ===== Clause4
318
-
319
- ====== Clause 5
320
-
321
- [level=6]
322
- ====== Clause 6
323
-
324
- [level=7]
325
- ====== Clause 7A
326
-
327
- [level=7]
328
- ====== Clause 7B
329
-
330
- [level=6]
331
- ====== Clause 6B
332
-
333
- ====== Clause 5B
334
-
335
- INPUT
336
- output = <<~OUTPUT
337
- #{@blank_hdr}
338
- <sections>
339
- <clause id="_" inline-header="false" obligation="normative">
340
- <title>Clause1</title>
341
- <clause id="_" inline-header="false" obligation="normative">
342
- <title>Clause2</title>
343
- <clause id="_" inline-header="false" obligation="normative">
344
- <title>Clause3</title>
345
- <clause id="_" inline-header="false" obligation="normative"><title>Clause4</title><clause id="_" inline-header="false" obligation="normative">
346
- <title>Clause 5</title>
347
- <clause id="_" inline-header="false" obligation="normative">
348
- <title>Clause 6</title>
349
- <clause id="_" inline-header="false" obligation="normative">
350
- <title>Clause 7A</title>
351
- </clause><clause id="_" inline-header="false" obligation="normative">
352
- <title>Clause 7B</title>
353
- </clause></clause><clause id="_" inline-header="false" obligation="normative">
354
- <title>Clause 6B</title>
355
- </clause></clause>
356
-
357
-
358
-
359
-
360
- <clause id="_" inline-header="false" obligation="normative">
361
- <title>Clause 5B</title>
362
- </clause></clause>
363
- </clause>
364
- </clause>
365
- </clause>
366
- </sections>
367
- </iec-standard>
368
- OUTPUT
369
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
370
- .to be_equivalent_to xmlpp(output)
371
- end
372
- end
@@ -1,254 +0,0 @@
1
- require "spec_helper"
2
- require "fileutils"
3
-
4
- RSpec.describe Metanorma::Iec do
5
- before(:all) do
6
- @boilerplate = boilerplate(Nokogiri::XML("#{BLANK_HDR}</iec-standard>"))
7
- end
8
-
9
- it "generates reference boilerplate for IEV" do
10
- input = <<~INPUT
11
- = Document title
12
- Author
13
- :docfile: test.adoc
14
- :nodoc:
15
- :novalid:
16
- :no-isobib:
17
- :docnumber: 60050
18
-
19
- [bibliography]
20
- == Normative References
21
-
22
- * [[[A,B]]], _TITLE_
23
- INPUT
24
- output = <<~OUTPUT
25
- <?xml version='1.0' encoding='UTF-8'?>
26
- <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
27
- <bibdata type='standard'>
28
- <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
29
- <docnumber>60050</docnumber>
30
- <contributor>
31
- <role type='author'/>
32
- <organization>
33
- <name>International Electrotechnical Commission</name>
34
- <abbreviation>IEC</abbreviation>
35
- </organization>
36
- </contributor>
37
- <contributor>
38
- <role type='publisher'/>
39
- <organization>
40
- <name>International Electrotechnical Commission</name>
41
- <abbreviation>IEC</abbreviation>
42
- </organization>
43
- </contributor>
44
- <language>en</language>
45
- <script>Latn</script>
46
- <status>
47
- <stage abbreviation="PPUB">60</stage>
48
- <substage abbreviation="PPUB">60</substage>
49
- </status>
50
- <copyright>
51
- <from>#{Time.now.year}</from>
52
- <owner>
53
- <organization>
54
- <name>International Electrotechnical Commission</name>
55
- <abbreviation>IEC</abbreviation>
56
- </organization>
57
- </owner>
58
- </copyright>
59
- <ext>
60
- <doctype>standard</doctype>
61
- <subdoctype>vocabulary</subdoctype>
62
- <editorialgroup>
63
- <agency>IEC</agency>
64
- </editorialgroup>
65
- <structuredidentifier>
66
- <project-number>IEC 60050</project-number>
67
- </structuredidentifier>
68
- <stagename>International standard</stagename>
69
- </ext>
70
- </bibdata>
71
- #{@boilerplate}
72
- <sections> </sections>
73
- <bibliography>
74
- <references id='_' obligation='informative' normative="true">
75
- <title>Normative references</title>
76
- <p id='_'>
77
- The following documents are referred to in the text in such a way that
78
- some or all of their content constitutes requirements of this document.
79
- For dated references, only the edition cited applies. For undated
80
- references, the latest edition of the referenced document (including any
81
- amendments) applies.
82
- </p>
83
- <bibitem id='A'>
84
- <formattedref format='application/x-isodoc+xml'>
85
- <em>TITLE</em>
86
- </formattedref>
87
- <docidentifier>B</docidentifier>
88
- </bibitem>
89
- </references>
90
- </bibliography>
91
- </iec-standard>
92
- OUTPUT
93
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
94
- .to be_equivalent_to xmlpp(output)
95
- end
96
-
97
- it "generates terms boilerplate for IEV" do
98
- input = <<~INPUT
99
- = Document title
100
- Author
101
- :docfile: test.adoc
102
- :nodoc:
103
- :novalid:
104
- :no-isobib:
105
- :docnumber: 60050
106
-
107
- == Terms and definitions
108
- === General
109
- ==== Term 1
110
- INPUT
111
- output = <<~OUTPUT
112
- <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
113
- <bibdata type='standard'>
114
- <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
115
- <docnumber>60050</docnumber>
116
- <contributor>
117
- <role type='author'/>
118
- <organization>
119
- <name>International Electrotechnical Commission</name>
120
- <abbreviation>IEC</abbreviation>
121
- </organization>
122
- </contributor>
123
- <contributor>
124
- <role type='publisher'/>
125
- <organization>
126
- <name>International Electrotechnical Commission</name>
127
- <abbreviation>IEC</abbreviation>
128
- </organization>
129
- </contributor>
130
- <language>en</language>
131
- <script>Latn</script>
132
- <status>
133
- <stage abbreviation="PPUB">60</stage>
134
- <substage abbreviation="PPUB">60</substage>
135
- </status>
136
- <copyright>
137
- <from>#{Time.now.year}</from>
138
- <owner>
139
- <organization>
140
- <name>International Electrotechnical Commission</name>
141
- <abbreviation>IEC</abbreviation>
142
- </organization>
143
- </owner>
144
- </copyright>
145
- <ext>
146
- <doctype>standard</doctype>
147
- <subdoctype>vocabulary</subdoctype>
148
- <editorialgroup>
149
- <agency>IEC</agency>
150
- </editorialgroup>
151
- <structuredidentifier>
152
- <project-number>IEC 60050</project-number>
153
- </structuredidentifier>
154
- <stagename>International standard</stagename>
155
- </ext>
156
- </bibdata>
157
- #{@boilerplate}
158
- <sections>
159
- <terms id='_' obligation='normative'>
160
- <title>Terms and definitions</title>
161
- <term id='term-General'>
162
- <preferred>
163
- <expression>
164
- <name>General</name>
165
- </expression>
166
- </preferred>
167
- <term id='term-Term-1'>
168
- <preferred><expression><name>Term 1</name></expression></preferred>
169
- </term>
170
- </term>
171
- </terms>
172
- </sections>
173
- </iec-standard>
174
-
175
- OUTPUT
176
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
177
- .to be_equivalent_to xmlpp(output)
178
- end
179
-
180
- it "uses IEV introduction title" do
181
- input = <<~INPUT
182
- = Document title
183
- Author
184
- :docfile: test.adoc
185
- :nodoc:
186
- :novalid:
187
- :no-isobib:
188
- :docnumber: 60050
189
-
190
- == Introduction
191
-
192
- Text
193
- INPUT
194
- output = <<~OUTPUT
195
- <?xml version='1.0' encoding='UTF-8'?>
196
- <iec-standard xmlns='https://www.metanorma.org/ns/iec' type="semantic" version="#{Metanorma::Iec::VERSION}">
197
- <bibdata type='standard'>
198
- <docidentifier type='ISO'>IEC 60050 ED 1</docidentifier>
199
- <docnumber>60050</docnumber>
200
- <contributor>
201
- <role type='author'/>
202
- <organization>
203
- <name>International Electrotechnical Commission</name>
204
- <abbreviation>IEC</abbreviation>
205
- </organization>
206
- </contributor>
207
- <contributor>
208
- <role type='publisher'/>
209
- <organization>
210
- <name>International Electrotechnical Commission</name>
211
- <abbreviation>IEC</abbreviation>
212
- </organization>
213
- </contributor>
214
- <language>en</language>
215
- <script>Latn</script>
216
- <status>
217
- <stage abbreviation='PPUB'>60</stage>
218
- <substage abbreviation='PPUB'>60</substage>
219
- </status>
220
- <copyright>
221
- <from>#{Time.now.year}</from>
222
- <owner>
223
- <organization>
224
- <name>International Electrotechnical Commission</name>
225
- <abbreviation>IEC</abbreviation>
226
- </organization>
227
- </owner>
228
- </copyright>
229
- <ext>
230
- <doctype>standard</doctype>
231
- <subdoctype>vocabulary</subdoctype>
232
- <editorialgroup>
233
- <agency>IEC</agency>
234
- </editorialgroup>
235
- <structuredidentifier>
236
- <project-number>IEC 60050</project-number>
237
- </structuredidentifier>
238
- <stagename>International standard</stagename>
239
- </ext>
240
- </bibdata>
241
- #{@boilerplate}
242
- <preface>
243
- <introduction id='_' obligation='informative'>
244
- <title>INTRODUCTION<br/>Principles and rules followed</title>
245
- <p id='_'>Text</p>
246
- </introduction>
247
- </preface>
248
- <sections> </sections>
249
- </iec-standard>
250
- OUTPUT
251
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
252
- .to be_equivalent_to xmlpp(output)
253
- end
254
- end