metanorma-iec 1.0.4 → 1.0.9

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -7
  3. data/.github/workflows/ubuntu.yml +12 -9
  4. data/.github/workflows/windows.yml +8 -8
  5. data/lib/asciidoctor/iec/biblio.rng +89 -32
  6. data/lib/asciidoctor/iec/converter.rb +8 -0
  7. data/lib/asciidoctor/iec/front.rb +3 -3
  8. data/lib/asciidoctor/iec/isodoc.rng +475 -2
  9. data/lib/asciidoctor/iec/isostandard.rng +12 -1
  10. data/lib/asciidoctor/iec/reqt.rng +23 -0
  11. data/lib/isodoc/iec/base_convert.rb +17 -3
  12. data/lib/isodoc/iec/html/htmlstyle.scss +6 -6
  13. data/lib/isodoc/iec/html/isodoc.scss +15 -9
  14. data/lib/isodoc/iec/html/scripts.html +23 -21
  15. data/lib/isodoc/iec/html/wordstyle.scss +0 -3
  16. data/lib/isodoc/iec/html_convert.rb +8 -0
  17. data/lib/isodoc/iec/iec.international-standard.xsl +4133 -0
  18. data/lib/isodoc/iec/pdf_convert.rb +31 -0
  19. data/lib/isodoc/iec/word_convert.rb +17 -6
  20. data/lib/metanorma-iec.rb +1 -0
  21. data/lib/metanorma/iec/processor.rb +12 -1
  22. data/lib/metanorma/iec/version.rb +1 -1
  23. data/spec/asciidoctor-iec/base_spec.rb +9 -23
  24. data/spec/asciidoctor-iec/blocks_spec.rb +4 -4
  25. data/spec/asciidoctor-iec/cleanup_spec.rb +8 -6
  26. data/spec/asciidoctor-iec/iev_spec.rb +4 -4
  27. data/spec/asciidoctor-iec/inline_spec.rb +2 -1
  28. data/spec/asciidoctor-iec/section_spec.rb +8 -8
  29. data/spec/assets/iso.xml +65 -2
  30. data/spec/examples/rice.html +5 -5
  31. data/spec/isodoc/blocks_spec.rb +154 -0
  32. data/spec/isodoc/i18n_spec.rb +17 -25
  33. data/spec/isodoc/iev_spec.rb +15 -14
  34. data/spec/isodoc/inline_spec.rb +11 -11
  35. data/spec/isodoc/iso_spec.rb +6 -23
  36. data/spec/isodoc/metadata_spec.rb +90 -7
  37. data/spec/isodoc/postproc_spec.rb +10 -4
  38. data/spec/isodoc/ref_spec.rb +249 -0
  39. data/spec/isodoc/section_spec.rb +53 -20
  40. data/spec/isodoc/terms_spec.rb +12 -14
  41. data/spec/metanorma/processor_spec.rb +3 -6
  42. data/spec/spec_helper.rb +7 -0
  43. metadata +6 -2
@@ -12,16 +12,14 @@ RSpec.describe IsoDoc do
12
12
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
13
13
  <title>Introduction Subsection</title>
14
14
  </clause>
15
- <patent-notice>
16
15
  <p>This is patent boilerplate</p>
17
- </patent-notice>
18
16
  </introduction></preface><sections>
19
17
  <clause id="D" obligation="normative">
20
18
  <title>Scope</title>
21
19
  <p id="E">Text</p>
22
20
  </clause>
23
21
 
24
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
22
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
25
23
  <title>Normal Terms</title>
26
24
  <term id="J">
27
25
  <preferred>Term2</preferred>
@@ -58,11 +56,11 @@ RSpec.describe IsoDoc do
58
56
  <appendix id="Q2" inline-header="false" obligation="normative">
59
57
  <title>An Appendix</title>
60
58
  </appendix>
61
- </annex><bibliography><references id="R" obligation="informative">
59
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
62
60
  <title>Normative References</title>
63
61
  </references><clause id="S" obligation="informative">
64
62
  <title>Bibliography</title>
65
- <references id="T" obligation="informative">
63
+ <references id="T" obligation="informative" normative="false">
66
64
  <title>Bibliography Subsection</title>
67
65
  </references>
68
66
  </clause>
@@ -96,7 +94,7 @@ RSpec.describe IsoDoc do
96
94
  </div>
97
95
  <p>This is patent boilerplate</p>
98
96
  </div>
99
- #{IEC_TITLE}
97
+ #{IEC_TITLE1}
100
98
  <div id="D">
101
99
  <h1>1&#160; Scope</h1>
102
100
  <p id="E">Text</p>
@@ -169,16 +167,14 @@ OUTPUT
169
167
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
170
168
  <title>Introduction Subsection</title>
171
169
  </clause>
172
- <patent-notice>
173
170
  <p>This is patent boilerplate</p>
174
- </patent-notice>
175
171
  </introduction></preface><sections>
176
172
  <clause id="D" obligation="normative">
177
173
  <title>Scope</title>
178
174
  <p id="E">Text</p>
179
175
  </clause>
180
176
 
181
- <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
177
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
182
178
  <title>Normal Terms</title>
183
179
  <term id="J">
184
180
  <preferred>Term2</preferred>
@@ -215,11 +211,11 @@ OUTPUT
215
211
  <appendix id="Q2" inline-header="false" obligation="normative">
216
212
  <title>An Appendix</title>
217
213
  </appendix>
218
- </annex><bibliography><references id="R" obligation="informative">
214
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
219
215
  <title>Normative References</title>
220
216
  </references><clause id="S" obligation="informative">
221
217
  <title>Bibliography</title>
222
- <references id="T" obligation="informative">
218
+ <references id="T" obligation="informative" normative="false">
223
219
  <title>Bibliography Subsection</title>
224
220
  </references>
225
221
  </clause>
@@ -247,7 +243,7 @@ OUTPUT
247
243
  </div>
248
244
  <p><br clear="all" class="section"/></p>
249
245
  <div class="WordSection3">
250
- #{IEC_TITLE}
246
+ #{IEC_TITLE1}
251
247
  <div id="D">
252
248
  <h1>1<span style="mso-tab-count:1">&#160; </span>Scope</h1>
253
249
  <p id="E">Text</p>
@@ -311,6 +307,43 @@ OUTPUT
311
307
  OUTPUT
312
308
  end
313
309
 
310
+ it "processes subclauses with and without titles" do
311
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
312
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
313
+ <sections>
314
+ <clause id="D" obligation="normative">
315
+ <title>Scope</title>
316
+ <clause id="D1" obligation="normative">
317
+ <title>Scope 1</title>
318
+ </clause>
319
+ <clause id="D2" obligation="normative">
320
+ </clause>
321
+ </clause>
322
+ </sections>
323
+ </iso-standard>
324
+ INPUT
325
+ #{HTML_HDR}
326
+ <div id=''>
327
+ <h1 class='ForewordTitle'>FOREWORD</h1>
328
+ <div class='boilerplate_legal'/>
329
+ </div>
330
+ #{IEC_TITLE1}
331
+ <div id='D'>
332
+ <h1>1&#160; Scope</h1>
333
+ <div id='D1'>
334
+ <h2>1.1&#160; Scope 1</h2>
335
+ </div>
336
+ <div id='D2'>
337
+ <h2>1.2&#160; </h2>
338
+ </div>
339
+ </div>
340
+ </div>
341
+ </body>
342
+ </html>
343
+ OUTPUT
344
+ end
345
+
346
+
314
347
  it "processes simple terms & definitions" do
315
348
  expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
316
349
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -328,8 +361,8 @@ OUTPUT
328
361
  <h1 class="ForewordTitle">FOREWORD</h1>
329
362
  <div class="boilerplate_legal"/>
330
363
  </div>
331
- #{IEC_TITLE}
332
- <div id="H"><h1>1&#160; Terms and definitions</h1>
364
+ #{IEC_TITLE1}
365
+ <div id="H"><h1>1&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
333
366
  <p class="TermNum" id="J">1.1</p>
334
367
  <p class="Terms" style="text-align:left;">Term2</p>
335
368
  </div>
@@ -358,14 +391,14 @@ OUTPUT
358
391
  <h1 class="ForewordTitle">FOREWORD</h1>
359
392
  <div class="boilerplate_legal"/>
360
393
  </div>
361
- #{IEC_TITLE}
394
+ #{IEC_TITLE1}
362
395
  <div id="M">
363
396
  <h1>1&#160; Clause 4</h1>
364
397
  <div id="N">
365
398
  <h2>1.1&#160; Introduction</h2>
366
399
  </div>
367
400
  <div id="O">
368
- <span class="zzMoveToFollowing"><b>1.2&#160; Clause 4.2 </b></span>
401
+ <span class="zzMoveToFollowing"><b>1.2&#160; Clause 4.2&#160; </b></span>
369
402
  </div>
370
403
  </div>
371
404
  </div>
@@ -401,7 +434,7 @@ OUTPUT
401
434
  </div>
402
435
  <p><br clear="all" class="section"/></p>
403
436
  <div class="WordSection3">
404
- #{IEC_TITLE}
437
+ #{IEC_TITLE1}
405
438
  </div>
406
439
  <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
407
440
  <div class="colophon"/>
@@ -436,7 +469,7 @@ OUTPUT
436
469
  </div>
437
470
  <p><br clear="all" class="section"/></p>
438
471
  <div class="WordSection3">
439
- #{IEC_TITLE}
472
+ #{IEC_TITLE1}
440
473
  </div>
441
474
  </body>
442
475
  OUTPUT
@@ -463,7 +496,7 @@ OUTPUT
463
496
  <p>Boilerplate</p>
464
497
  </div>
465
498
  </div>
466
- #{IEC_TITLE}
499
+ #{IEC_TITLE1}
467
500
  </div>
468
501
  </body>
469
502
  </html>
@@ -488,7 +521,7 @@ OUTPUT
488
521
  <div id="">
489
522
  <h1 class="ForewordTitle">FOREWORD</h1>
490
523
  </div>
491
- #{IEC_TITLE}
524
+ #{IEC_TITLE1}
492
525
  </div>
493
526
  </body>
494
527
  </html>
@@ -5,7 +5,7 @@ RSpec.describe IsoDoc do
5
5
  expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <sections>
8
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
8
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
9
9
 
10
10
  <term id="paddy1"><preferred>paddy</preferred>
11
11
  <domain>rice</domain>
@@ -57,7 +57,7 @@ RSpec.describe IsoDoc do
57
57
  <h1 class="ForewordTitle">FOREWORD</h1>
58
58
  <div class="boilerplate_legal"/>
59
59
  </div>
60
- #{IEC_TITLE}
60
+ #{IEC_TITLE1}
61
61
  <div id="_terms_and_definitions"><h1>1&#160; Terms and definitions</h1>
62
62
  <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
63
63
 
@@ -83,8 +83,8 @@ RSpec.describe IsoDoc do
83
83
  <li>A</li>
84
84
  </ul>
85
85
  </div>
86
- <div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
87
- <div class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
86
+ <div id="_671a1994-4783-40d0-bc81-987d06ffb74e" class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
87
+ <div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
88
88
  <p>[TERMREF]
89
89
  <a href="#ISO7301">ISO 7301:2011, 3.1</a>
90
90
  [/TERMREF]</p></div>
@@ -95,10 +95,10 @@ OUTPUT
95
95
  end
96
96
 
97
97
  it "processes IsoXML terms (Word)" do
98
- expect((IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div id="_terms_and_definitions">}m, '<div id="_terms_and_definitions">').sub(%r{<br[^>]*>\s*<div class="colophon"/>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
98
+ expect((IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div id="_terms_and_definitions">}m, '<div id="_terms_and_definitions">').sub(%r{</div>\s*<br[^>]*>\s*<div class="colophon"/>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
99
99
  <iso-standard xmlns="http://riboseinc.com/isoxml">
100
100
  <sections>
101
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
101
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
102
102
 
103
103
  <term id="paddy1"><preferred>paddy</preferred>
104
104
  <domain>rice</domain>
@@ -145,8 +145,7 @@ OUTPUT
145
145
  </sections>
146
146
  </iso-standard>
147
147
  INPUT
148
- <div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">&#160; </span>Terms and definitions</h1>
149
- <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
148
+ <div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">&#160; </span>Terms and definitions</h1><p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
150
149
 
151
150
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
152
151
  <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span>Foreign seeds, husks, bran, sand, dust.</p><ul>
@@ -164,18 +163,17 @@ OUTPUT
164
163
  [/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
165
164
  <p class="AltTerms" style="text-align:left;">rough rice</p>
166
165
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
167
- <div class="Note"><p class="Note">Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
168
- <div class="Note"><p class="Note">Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
169
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
170
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span><span style="mso-tab-count:1">&#160; </span></p>
166
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p><div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span><span style="mso-tab-count:1">&#160; </span></p>
171
167
  <ul>
172
168
  <li>A</li>
173
169
  </ul>
174
- </div>
170
+ </div><div id="_671a1994-4783-40d0-bc81-987d06ffb74e" class="Note"><p class="Note">Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div><div id="_671a1994-4783-40d0-bc81-987d06ffb74f" class="Note"><p class="Note">Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
171
+
172
+
173
+
175
174
  <p>[TERMREF]
176
175
  <a href="#ISO7301">ISO 7301:2011, 3.1</a>
177
176
  [/TERMREF]</p></div>
178
-
179
177
  OUTPUT
180
178
  end
181
179
  end
@@ -15,7 +15,7 @@ RSpec.describe Metanorma::Iec::Processor do
15
15
 
16
16
  it "registers output formats against metanorma" do
17
17
  expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
18
- [[:doc, "doc"], [:html, "html"], [:rxl, "rxl"], [:xml, "xml"]]
18
+ [[:doc, "doc"], [:html, "html"], [:pdf, "pdf"], [:rxl, "rxl"], [:xml, "xml"]]
19
19
  OUTPUT
20
20
  end
21
21
 
@@ -57,17 +57,14 @@ RSpec.describe Metanorma::Iec::Processor do
57
57
  </p>
58
58
  <p class="zzSTDTitle1">&#xA0;</p>
59
59
  <div id="">
60
- <h1 class="ForewordTitle">FOREWORD</h1>
60
+ <h1 class="ForewordTitle" id="toc0">FOREWORD</h1>
61
61
  <div class="boilerplate_legal"></div>
62
62
  </div>
63
- <p class="zzSTDTitle1">INTERNATIONAL ELECTROTECHNICAL COMMISSION</p>
64
- <p class="zzSTDTitle1">____________</p>
65
- <p class="zzSTDTitle1">&#xA0;</p>
66
63
  <p class="zzSTDTitle1">
67
64
  <b></b>
68
65
  </p>
69
66
  <p class="zzSTDTitle1">&#xA0;</p>
70
- <div id="H"><h1>1&#xA0; Terms and definitions</h1>
67
+ <div id="H"><h1 id="toc1">1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
71
68
  <h2 class="TermNum" id="J">1.1</h2>
72
69
  <p class="Terms" style="text-align:left;">Term2</p>
73
70
  </div>
@@ -195,6 +195,13 @@ IEC_TITLE = <<~END
195
195
  <p class="zzSTDTitle1">&#160;</p>
196
196
  END
197
197
 
198
+ IEC_TITLE1 = <<~END
199
+ <p class="zzSTDTitle1">
200
+ <b/>
201
+ </p>
202
+ <p class="zzSTDTitle1">&#160;</p>
203
+ END
204
+
198
205
  HTML_HDR = <<~END
199
206
  <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
200
207
  <head/>
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: 1.0.4
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-17 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -241,7 +241,9 @@ files:
241
241
  - lib/isodoc/iec/i18n-en.yaml
242
242
  - lib/isodoc/iec/i18n-fr.yaml
243
243
  - lib/isodoc/iec/i18n-zh-Hans.yaml
244
+ - lib/isodoc/iec/iec.international-standard.xsl
244
245
  - lib/isodoc/iec/metadata.rb
246
+ - lib/isodoc/iec/pdf_convert.rb
245
247
  - lib/isodoc/iec/word_convert.rb
246
248
  - lib/metanorma-iec.rb
247
249
  - lib/metanorma/iec.rb
@@ -271,12 +273,14 @@ files:
271
273
  - spec/examples/rice_img/rice_image3_1.png
272
274
  - spec/examples/rice_img/rice_image3_2.png
273
275
  - spec/examples/rice_img/rice_image3_3.png
276
+ - spec/isodoc/blocks_spec.rb
274
277
  - spec/isodoc/i18n_spec.rb
275
278
  - spec/isodoc/iev_spec.rb
276
279
  - spec/isodoc/inline_spec.rb
277
280
  - spec/isodoc/iso_spec.rb
278
281
  - spec/isodoc/metadata_spec.rb
279
282
  - spec/isodoc/postproc_spec.rb
283
+ - spec/isodoc/ref_spec.rb
280
284
  - spec/isodoc/section_spec.rb
281
285
  - spec/isodoc/terms_spec.rb
282
286
  - spec/metanorma/processor_spec.rb