metanorma-iec 2.1.11 → 2.1.13

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.
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,470 +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 "processes open blocks" do
9
- input = <<~INPUT
10
- #{ASCIIDOC_BLANK_HDR}
11
- --
12
- x
13
-
14
- y
15
-
16
- z
17
- --
18
- INPUT
19
- output = <<~OUTPUT
20
- #{@blank_hdr}
21
- <sections><p id="_">x</p>
22
- <p id="_">y</p>
23
- <p id="_">z</p></sections>
24
- </iec-standard>
25
- OUTPUT
26
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
27
- .to be_equivalent_to xmlpp(output)
28
- end
29
-
30
- it "processes stem blocks" do
31
- input = <<~INPUT
32
- #{ASCIIDOC_BLANK_HDR}
33
- [stem]
34
- ++++
35
- r = 1 %
36
- r = 1 %
37
- ++++
38
-
39
- [stem]
40
- ++++
41
- <mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">&#x0391;</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>
42
- ++++
43
- INPUT
44
- output = <<~OUTPUT
45
- #{@blank_hdr}
46
- <sections>
47
- <formula id="_">
48
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo><mi>r</mi><mo>=</mo><mn>1</mn><mo>%</mo></math></stem>
49
- </formula>
50
-
51
- <formula id="_">
52
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
53
- </formula>
54
- </sections>
55
- </iec-standard>
56
- OUTPUT
57
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
58
- .to be_equivalent_to xmlpp(output)
59
- end
60
-
61
- it "ignores review blocks unless document is in draft mode" do
62
- input = <<~INPUT
63
- #{ASCIIDOC_BLANK_HDR}
64
- [[foreword]]
65
- .Foreword
66
- Foreword
67
-
68
- [reviewer=ISO,date=20170101,from=foreword,to=foreword]
69
- ****
70
- A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
71
-
72
- For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
73
- ****
74
- INPUT
75
- output = <<~OUTPUT
76
- #{@blank_hdr}
77
- <sections><p id="foreword">Foreword</p>
78
- </sections>
79
- </iec-standard>
80
- OUTPUT
81
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
82
- .to be_equivalent_to xmlpp(output)
83
- end
84
-
85
- it "processes review blocks if document is in draft mode" do
86
- input = <<~INPUT
87
- = Document title
88
- Author
89
- :docfile: test.adoc
90
- :nodoc:
91
- :novalid:
92
- :draft: 1.2
93
- :no-isobib:
94
-
95
- [[foreword]]
96
- .Foreword
97
- Foreword
98
-
99
- [reviewer=ISO,date=20170101,from=foreword,to=foreword]
100
- ****
101
- A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.
102
-
103
- For further information on the Foreword, see *ISO/IEC Directives, Part 2, 2016, Clause 12.*
104
- ****
105
- INPUT
106
- output = <<~OUTPUT
107
- <sections>
108
- <p id="foreword">Foreword</p>
109
- <review reviewer="ISO" id="_" date="20170101T00:00:00Z" from="foreword" to="foreword"><p id="_">A Foreword shall appear in each document. The generic text is shown here. It does not contain requirements, recommendations or permissions.</p>
110
- <p id="_">For further information on the Foreword, see <strong>ISO/IEC Directives, Part 2, 2016, Clause 12.</strong></p></review></sections>
111
-
112
- OUTPUT
113
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
114
- .sub(/^.+<sections>/m, "<sections>")
115
- .sub(%r{</sections>.*$}m, "</sections>")))
116
- .to be_equivalent_to xmlpp(output)
117
- end
118
-
119
- it "processes term notes" do
120
- input = <<~INPUT
121
- #{ASCIIDOC_BLANK_HDR}
122
- == Terms and Definitions
123
-
124
- === Term1
125
-
126
- NOTE: This is a note
127
- INPUT
128
- output = <<~OUTPUT
129
- #{@blank_hdr}
130
- <sections>
131
- <terms id="_" obligation="normative">
132
- <title>Terms and definitions</title>
133
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
134
- #{TERMS_BOILERPLATE}
135
- <term id="term-Term1">
136
- <preferred><expression><name>Term1</name></expression></preferred>
137
- <termnote id="_">
138
- <p id="_">This is a note</p>
139
- </termnote>
140
- </term>
141
- </terms>
142
- </sections>
143
- </iec-standard>
144
- OUTPUT
145
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
146
- .to be_equivalent_to xmlpp(output)
147
- end
148
-
149
- it "processes notes" do
150
- input = <<~INPUT
151
- #{ASCIIDOC_BLANK_HDR}
152
- NOTE: This is a note
153
- INPUT
154
- output = <<~OUTPUT
155
- #{@blank_hdr}
156
- <sections>
157
- <note id="_">
158
- <p id="_">This is a note</p>
159
- </note>
160
- </sections>
161
- </iec-standard>
162
- OUTPUT
163
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
164
- .to be_equivalent_to xmlpp(output)
165
- end
166
-
167
- it "processes literals" do
168
- input = <<~INPUT
169
- #{ASCIIDOC_BLANK_HDR}
170
- ....
171
- LITERAL
172
- ....
173
- INPUT
174
- output = <<~OUTPUT
175
- #{@blank_hdr}
176
- <sections>
177
- <figure id="_">
178
- <pre id="_">LITERAL</pre>
179
- </figure>
180
- </sections>
181
- </iec-standard>
182
- OUTPUT
183
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
184
- .to be_equivalent_to xmlpp(output)
185
- end
186
-
187
- it "processes simple admonitions with Asciidoc names" do
188
- input = <<~INPUT
189
- #{ASCIIDOC_BLANK_HDR}
190
- CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
191
- INPUT
192
- output = <<~OUTPUT
193
- #{@blank_hdr}
194
- <sections>
195
- <admonition id="_" type="caution">
196
- <p id="_">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
197
- </admonition>
198
- </sections>
199
- </iec-standard>
200
- OUTPUT
201
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
202
- .to be_equivalent_to xmlpp(output)
203
- end
204
-
205
- it "processes complex admonitions with non-Asciidoc names" do
206
- input = <<~INPUT
207
- #{ASCIIDOC_BLANK_HDR}
208
- [CAUTION,type=Safety Precautions]
209
- .Safety Precautions
210
- ====
211
- While werewolves are hardy community members, keep in mind the following dietary concerns:
212
-
213
- . They are allergic to cinnamon.
214
- . More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
215
- . Celery makes them sad.
216
- ====
217
- INPUT
218
- output = <<~OUTPUT
219
- #{@blank_hdr}
220
- <sections>
221
- <admonition id="_" type="safety precautions"><name>Safety Precautions</name><p id="_">While werewolves are hardy community members, keep in mind the following dietary concerns:</p>
222
- <ol id="_">
223
- <li>
224
- <p id="_">They are allergic to cinnamon.</p>
225
- </li>
226
- <li>
227
- <p id="_">More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.</p>
228
- </li>
229
- <li>
230
- <p id="_">Celery makes them sad.</p>
231
- </li>
232
- </ol></admonition>
233
- </sections>
234
- </iec-standard>
235
- OUTPUT
236
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
237
- .to be_equivalent_to xmlpp(output)
238
- end
239
-
240
- it "processes term examples" do
241
- input = <<~INPUT
242
- #{ASCIIDOC_BLANK_HDR}
243
- == Terms and Definitions
244
-
245
- === Term1
246
-
247
- [example]
248
- This is an example
249
- INPUT
250
- output = <<~OUTPUT
251
- #{@blank_hdr}
252
- <sections>
253
- <terms id="_" obligation="normative">
254
- <title>Terms and definitions</title>
255
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
256
- #{TERMS_BOILERPLATE}
257
- <term id="term-Term1">
258
- <preferred><expression><name>Term1</name></expression></preferred>
259
- <termexample id="_">
260
- <p id="_">This is an example</p>
261
- </termexample>
262
- </term>
263
- </terms>
264
- </sections>
265
- </iec-standard>
266
- OUTPUT
267
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
268
- .to be_equivalent_to xmlpp(output)
269
- end
270
-
271
- it "processes examples" do
272
- input = <<~INPUT
273
- #{ASCIIDOC_BLANK_HDR}
274
- [example]
275
- ====
276
- This is an example
277
-
278
- Amen
279
- ====
280
- INPUT
281
- output = <<~OUTPUT
282
- #{@blank_hdr}
283
- <sections>
284
- <example id="_"><p id="_">This is an example</p>
285
- <p id="_">Amen</p></example>
286
- </sections>
287
- </iec-standard>
288
- OUTPUT
289
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
290
- .to be_equivalent_to xmlpp(output)
291
- end
292
-
293
- it "processes preambles" do
294
- input = <<~INPUT
295
- #{ASCIIDOC_BLANK_HDR}
296
- This is a preamble
297
-
298
- == Section 1
299
- INPUT
300
- output = <<~OUTPUT
301
- #{@blank_hdr}
302
- <preface><foreword id="_" obligation="informative">
303
- <title>FOREWORD</title>
304
- <p id="_">This is a preamble</p>
305
- </foreword></preface><sections>
306
- <clause id="_" inline-header="false" obligation="normative">
307
- <title>Section 1</title>
308
- </clause></sections>
309
- </iec-standard>
310
- OUTPUT
311
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
312
- .to be_equivalent_to xmlpp(output)
313
- end
314
-
315
- it "processes images" do
316
- input = <<~INPUT
317
- #{ASCIIDOC_BLANK_HDR}
318
- .Split-it-right sample divider
319
- image::spec/examples/rice_images/rice_image1.png[]
320
-
321
- INPUT
322
- output = <<~OUTPUT
323
- #{@blank_hdr}
324
- <sections>
325
- <figure id="_">
326
- <name>Split-it-right sample divider</name>
327
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="auto" width="auto"/>
328
- </figure>
329
- </sections>
330
- </iec-standard>
331
- OUTPUT
332
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
333
- .to be_equivalent_to xmlpp(output)
334
- end
335
-
336
- it "accepts width and height attributes on images" do
337
- input = <<~INPUT
338
- #{ASCIIDOC_BLANK_HDR}
339
- [height=4,width=3]
340
- image::spec/examples/rice_images/rice_image1.png[]
341
-
342
- INPUT
343
- output = <<~OUTPUT
344
- #{@blank_hdr}
345
- <sections>
346
- <figure id="_">
347
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="4" width="3"/>
348
- </figure>
349
- </sections>
350
- </iec-standard>
351
- OUTPUT
352
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
353
- .to be_equivalent_to xmlpp(output)
354
- end
355
-
356
- it "accepts auto for width and height attributes on images" do
357
- input = <<~INPUT
358
- #{ASCIIDOC_BLANK_HDR}
359
- [height=4,width=auto]
360
- image::spec/examples/rice_images/rice_image1.png[]
361
-
362
- INPUT
363
- output = <<~OUTPUT
364
- #{@blank_hdr}
365
- <sections>
366
- <figure id="_">
367
- <image src="spec/examples/rice_images/rice_image1.png" id="_" mimetype="image/png" height="4" width="auto"/>
368
- </figure>
369
- </sections>
370
- </iec-standard>
371
- OUTPUT
372
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
373
- .to be_equivalent_to xmlpp(output)
374
- end
375
-
376
- it "accepts alignment attribute on paragraphs" do
377
- input = <<~INPUT
378
- #{ASCIIDOC_BLANK_HDR}
379
- [align=right]
380
- This para is right-aligned.
381
- INPUT
382
- output = <<~OUTPUT
383
- #{@blank_hdr}
384
- <sections>
385
- <p align="right" id="_">This para is right-aligned.</p>
386
- </sections>
387
- </iec-standard>
388
- OUTPUT
389
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
390
- .to be_equivalent_to xmlpp(output)
391
- end
392
-
393
- it "processes blockquotes" do
394
- input = <<~INPUT
395
- #{ASCIIDOC_BLANK_HDR}
396
- [quote, ISO, "ISO7301,section 1"]
397
- ____
398
- Block quotation
399
- ____
400
- INPUT
401
- output = <<~OUTPUT
402
- #{@blank_hdr}
403
- <sections>
404
- <quote id="_">
405
- <source type="inline" bibitemid="ISO7301" citeas=""><localityStack><locality type="section"><referenceFrom>1</referenceFrom></locality></localityStack></source>
406
- <author>ISO</author>
407
- <p id="_">Block quotation</p>
408
- </quote>
409
- </sections>
410
- </iec-standard>
411
- OUTPUT
412
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
413
- .to be_equivalent_to xmlpp(output)
414
- end
415
-
416
- it "processes source code" do
417
- input = <<~INPUT
418
- #{ASCIIDOC_BLANK_HDR}
419
- [source,ruby]
420
- --
421
- puts "Hello, world."
422
- %w{a b c}.each do |x|
423
- puts x
424
- end
425
- --
426
- INPUT
427
- output = <<~OUTPUT
428
- #{@blank_hdr}
429
- <sections>
430
- <sourcecode lang="ruby" id="_">puts "Hello, world."
431
- %w{a b c}.each do |x|
432
- puts x
433
- end</sourcecode>
434
- </sections>
435
- </iec-standard>
436
- OUTPUT
437
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
438
- .to be_equivalent_to xmlpp(output)
439
- end
440
-
441
- it "processes callouts" do
442
- input = <<~INPUT
443
- #{ASCIIDOC_BLANK_HDR}
444
- [source,ruby]
445
- --
446
- puts "Hello, world." <1>
447
- %w{a b c}.each do |x|
448
- puts x <2>
449
- end
450
- --
451
- <1> This is one callout
452
- <2> This is another callout
453
- INPUT
454
- output = <<~OUTPUT
455
- #{@blank_hdr}
456
- <sections><sourcecode lang="ruby" id="_">puts "Hello, world." <callout target="_">1</callout>
457
- %w{a b c}.each do |x|
458
- puts x <callout target="_">2</callout>
459
- end<annotation id="_">
460
- <p id="_">This is one callout</p>
461
- </annotation><annotation id="_">
462
- <p id="_">This is another callout</p>
463
- </annotation></sourcecode>
464
- </sections>
465
- </iec-standard>
466
- OUTPUT
467
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
468
- .to be_equivalent_to xmlpp(output)
469
- end
470
- end