metanorma-iec 1.0.6 → 1.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/.github/workflows/macos.yml +8 -1
- data/.github/workflows/ubuntu.yml +20 -7
- data/.github/workflows/windows.yml +8 -1
- data/lib/asciidoctor/iec/biblio.rng +36 -6
- data/lib/asciidoctor/iec/converter.rb +8 -0
- data/lib/asciidoctor/iec/front.rb +2 -2
- data/lib/asciidoctor/iec/isodoc.rng +444 -1
- data/lib/asciidoctor/iec/isostandard.rng +12 -1
- data/lib/asciidoctor/iec/reqt.rng +23 -0
- data/lib/isodoc/iec/base_convert.rb +21 -37
- data/lib/isodoc/iec/html/isodoc.scss +15 -9
- data/lib/isodoc/iec/html/scripts.html +18 -0
- data/lib/isodoc/iec/html/wordstyle.scss +0 -3
- data/lib/isodoc/iec/iec.international-standard.xsl +1346 -608
- data/lib/isodoc/iec/pdf_convert.rb +2 -12
- data/lib/isodoc/iec/presentation_xml_convert.rb +10 -0
- data/lib/isodoc/iec/word_convert.rb +19 -8
- data/lib/isodoc/iec/xref.rb +45 -0
- data/lib/metanorma-iec.rb +2 -0
- data/lib/metanorma/iec/processor.rb +11 -9
- data/lib/metanorma/iec/version.rb +1 -1
- data/metanorma-iec.gemspec +2 -2
- data/spec/asciidoctor-iec/base_spec.rb +7 -6
- data/spec/asciidoctor-iec/cleanup_spec.rb +1 -1
- data/spec/asciidoctor-iec/iev_spec.rb +2 -2
- data/spec/isodoc/blocks_spec.rb +154 -0
- data/spec/isodoc/i18n_spec.rb +4 -4
- data/spec/isodoc/iev_spec.rb +11 -10
- data/spec/isodoc/inline_spec.rb +9 -9
- data/spec/isodoc/iso_spec.rb +4 -4
- data/spec/isodoc/metadata_spec.rb +90 -7
- data/spec/isodoc/postproc_spec.rb +3 -3
- data/spec/isodoc/ref_spec.rb +249 -0
- data/spec/isodoc/section_spec.rb +46 -9
- data/spec/isodoc/terms_spec.rb +10 -12
- data/spec/metanorma/processor_spec.rb +2 -5
- data/spec/spec_helper.rb +7 -0
- metadata +14 -11
data/spec/isodoc/section_spec.rb
CHANGED
@@ -94,7 +94,7 @@ RSpec.describe IsoDoc do
|
|
94
94
|
</div>
|
95
95
|
<p>This is patent boilerplate</p>
|
96
96
|
</div>
|
97
|
-
#{
|
97
|
+
#{IEC_TITLE1}
|
98
98
|
<div id="D">
|
99
99
|
<h1>1  Scope</h1>
|
100
100
|
<p id="E">Text</p>
|
@@ -243,7 +243,7 @@ OUTPUT
|
|
243
243
|
</div>
|
244
244
|
<p><br clear="all" class="section"/></p>
|
245
245
|
<div class="WordSection3">
|
246
|
-
#{
|
246
|
+
#{IEC_TITLE1}
|
247
247
|
<div id="D">
|
248
248
|
<h1>1<span style="mso-tab-count:1">  </span>Scope</h1>
|
249
249
|
<p id="E">Text</p>
|
@@ -307,6 +307,43 @@ OUTPUT
|
|
307
307
|
OUTPUT
|
308
308
|
end
|
309
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  Scope</h1>
|
333
|
+
<div id='D1'>
|
334
|
+
<h2>1.1  Scope 1</h2>
|
335
|
+
</div>
|
336
|
+
<div id='D2'>
|
337
|
+
<h2>1.2  </h2>
|
338
|
+
</div>
|
339
|
+
</div>
|
340
|
+
</div>
|
341
|
+
</body>
|
342
|
+
</html>
|
343
|
+
OUTPUT
|
344
|
+
end
|
345
|
+
|
346
|
+
|
310
347
|
it "processes simple terms & definitions" do
|
311
348
|
expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
312
349
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -324,7 +361,7 @@ OUTPUT
|
|
324
361
|
<h1 class="ForewordTitle">FOREWORD</h1>
|
325
362
|
<div class="boilerplate_legal"/>
|
326
363
|
</div>
|
327
|
-
#{
|
364
|
+
#{IEC_TITLE1}
|
328
365
|
<div id="H"><h1>1  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
329
366
|
<p class="TermNum" id="J">1.1</p>
|
330
367
|
<p class="Terms" style="text-align:left;">Term2</p>
|
@@ -354,14 +391,14 @@ OUTPUT
|
|
354
391
|
<h1 class="ForewordTitle">FOREWORD</h1>
|
355
392
|
<div class="boilerplate_legal"/>
|
356
393
|
</div>
|
357
|
-
#{
|
394
|
+
#{IEC_TITLE1}
|
358
395
|
<div id="M">
|
359
396
|
<h1>1  Clause 4</h1>
|
360
397
|
<div id="N">
|
361
398
|
<h2>1.1  Introduction</h2>
|
362
399
|
</div>
|
363
400
|
<div id="O">
|
364
|
-
<span class="zzMoveToFollowing"><b>1.2  Clause 4.2 </b></span>
|
401
|
+
<span class="zzMoveToFollowing"><b>1.2  Clause 4.2  </b></span>
|
365
402
|
</div>
|
366
403
|
</div>
|
367
404
|
</div>
|
@@ -397,7 +434,7 @@ OUTPUT
|
|
397
434
|
</div>
|
398
435
|
<p><br clear="all" class="section"/></p>
|
399
436
|
<div class="WordSection3">
|
400
|
-
#{
|
437
|
+
#{IEC_TITLE1}
|
401
438
|
</div>
|
402
439
|
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
403
440
|
<div class="colophon"/>
|
@@ -432,7 +469,7 @@ OUTPUT
|
|
432
469
|
</div>
|
433
470
|
<p><br clear="all" class="section"/></p>
|
434
471
|
<div class="WordSection3">
|
435
|
-
#{
|
472
|
+
#{IEC_TITLE1}
|
436
473
|
</div>
|
437
474
|
</body>
|
438
475
|
OUTPUT
|
@@ -459,7 +496,7 @@ OUTPUT
|
|
459
496
|
<p>Boilerplate</p>
|
460
497
|
</div>
|
461
498
|
</div>
|
462
|
-
#{
|
499
|
+
#{IEC_TITLE1}
|
463
500
|
</div>
|
464
501
|
</body>
|
465
502
|
</html>
|
@@ -484,7 +521,7 @@ OUTPUT
|
|
484
521
|
<div id="">
|
485
522
|
<h1 class="ForewordTitle">FOREWORD</h1>
|
486
523
|
</div>
|
487
|
-
#{
|
524
|
+
#{IEC_TITLE1}
|
488
525
|
</div>
|
489
526
|
</body>
|
490
527
|
</html>
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -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
|
-
#{
|
60
|
+
#{IEC_TITLE1}
|
61
61
|
<div id="_terms_and_definitions"><h1>1  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,7 +95,7 @@ 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{
|
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
101
|
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
|
@@ -145,8 +145,7 @@ OUTPUT
|
|
145
145
|
</sections>
|
146
146
|
</iso-standard>
|
147
147
|
INPUT
|
148
|
-
|
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">  </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"><rice> 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">  </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="
|
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">  </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">  </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"], [:pdf, "pdf"], [:rxl, "rxl"], [:xml, "xml"]]
|
18
|
+
[[:doc, "doc"], [:html, "html"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:xml, "xml"]]
|
19
19
|
OUTPUT
|
20
20
|
end
|
21
21
|
|
@@ -35,7 +35,7 @@ RSpec.describe Metanorma::Iec::Processor do
|
|
35
35
|
|
36
36
|
it "generates HTML from IsoDoc XML" do
|
37
37
|
FileUtils.rm_f "test.xml"
|
38
|
-
processor.output(<<~"INPUT", "test.html", :html)
|
38
|
+
processor.output(<<~"INPUT", "test.xml", "test.html", :html)
|
39
39
|
<iec-standard xmlns="http://riboseinc.com/isoxml">
|
40
40
|
<sections>
|
41
41
|
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
@@ -60,9 +60,6 @@ RSpec.describe Metanorma::Iec::Processor do
|
|
60
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"> </p>
|
66
63
|
<p class="zzSTDTitle1">
|
67
64
|
<b></b>
|
68
65
|
</p>
|
data/spec/spec_helper.rb
CHANGED
@@ -195,6 +195,13 @@ IEC_TITLE = <<~END
|
|
195
195
|
<p class="zzSTDTitle1"> </p>
|
196
196
|
END
|
197
197
|
|
198
|
+
IEC_TITLE1 = <<~END
|
199
|
+
<p class="zzSTDTitle1">
|
200
|
+
<b/>
|
201
|
+
</p>
|
202
|
+
<p class="zzSTDTitle1"> </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.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-jing
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: metanorma-iso
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.4.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.4.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,7 +244,9 @@ files:
|
|
244
244
|
- lib/isodoc/iec/iec.international-standard.xsl
|
245
245
|
- lib/isodoc/iec/metadata.rb
|
246
246
|
- lib/isodoc/iec/pdf_convert.rb
|
247
|
+
- lib/isodoc/iec/presentation_xml_convert.rb
|
247
248
|
- lib/isodoc/iec/word_convert.rb
|
249
|
+
- lib/isodoc/iec/xref.rb
|
248
250
|
- lib/metanorma-iec.rb
|
249
251
|
- lib/metanorma/iec.rb
|
250
252
|
- lib/metanorma/iec/processor.rb
|
@@ -273,12 +275,14 @@ files:
|
|
273
275
|
- spec/examples/rice_img/rice_image3_1.png
|
274
276
|
- spec/examples/rice_img/rice_image3_2.png
|
275
277
|
- spec/examples/rice_img/rice_image3_3.png
|
278
|
+
- spec/isodoc/blocks_spec.rb
|
276
279
|
- spec/isodoc/i18n_spec.rb
|
277
280
|
- spec/isodoc/iev_spec.rb
|
278
281
|
- spec/isodoc/inline_spec.rb
|
279
282
|
- spec/isodoc/iso_spec.rb
|
280
283
|
- spec/isodoc/metadata_spec.rb
|
281
284
|
- spec/isodoc/postproc_spec.rb
|
285
|
+
- spec/isodoc/ref_spec.rb
|
282
286
|
- spec/isodoc/section_spec.rb
|
283
287
|
- spec/isodoc/terms_spec.rb
|
284
288
|
- spec/metanorma/processor_spec.rb
|
@@ -287,7 +291,7 @@ homepage: https://github.com/metanorma/metanorma-iec
|
|
287
291
|
licenses:
|
288
292
|
- BSD-2-Clause
|
289
293
|
metadata: {}
|
290
|
-
post_install_message:
|
294
|
+
post_install_message:
|
291
295
|
rdoc_options: []
|
292
296
|
require_paths:
|
293
297
|
- lib
|
@@ -302,9 +306,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
302
306
|
- !ruby/object:Gem::Version
|
303
307
|
version: '0'
|
304
308
|
requirements: []
|
305
|
-
|
306
|
-
|
307
|
-
signing_key:
|
309
|
+
rubygems_version: 3.0.3
|
310
|
+
signing_key:
|
308
311
|
specification_version: 4
|
309
312
|
summary: metanorma-iec lets you write IEC standards in AsciiDoc.
|
310
313
|
test_files: []
|