metanorma-iso 1.5.1 → 1.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -1
- data/lib/asciidoctor/iso/base.rb +1 -1
- data/lib/asciidoctor/iso/basicdoc.rng +31 -1
- data/lib/asciidoctor/iso/front.rb +6 -6
- data/lib/asciidoctor/iso/front_id.rb +5 -5
- data/lib/asciidoctor/iso/isodoc.rng +112 -9
- data/lib/asciidoctor/iso/section.rb +0 -7
- data/lib/asciidoctor/iso/validate_section.rb +10 -0
- data/lib/isodoc/iso/html/isodoc.css +16 -4
- data/lib/isodoc/iso/html/isodoc.scss +18 -4
- data/lib/isodoc/iso/html/wordstyle.css +10 -9
- data/lib/isodoc/iso/html/wordstyle.scss +15 -9
- data/lib/isodoc/iso/i18n-en.yaml +0 -1
- data/lib/isodoc/iso/iso.amendment.xsl +761 -259
- data/lib/isodoc/iso/iso.international-standard.xsl +761 -259
- data/lib/isodoc/iso/word_convert.rb +17 -13
- data/lib/isodoc/iso/xref.rb +7 -11
- data/lib/metanorma/iso/processor.rb +4 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor-iso/amd_spec.rb +0 -32
- data/spec/asciidoctor-iso/base_spec.rb +3 -11
- data/spec/asciidoctor-iso/cleanup_spec.rb +57 -33
- data/spec/asciidoctor-iso/inline_spec.rb +7 -1
- data/spec/asciidoctor-iso/table_spec.rb +118 -112
- data/spec/asciidoctor-iso/validate_spec.rb +87 -0
- data/spec/isodoc/amd_spec.rb +13 -13
- data/spec/isodoc/iso_spec.rb +3 -3
- data/spec/isodoc/postproc_spec.rb +76 -1
- data/spec/isodoc/ref_spec.rb +1 -1
- data/spec/metanorma/processor_spec.rb +1 -1
- metadata +4 -4
@@ -3,6 +3,93 @@ require "fileutils"
|
|
3
3
|
|
4
4
|
RSpec.describe Asciidoctor::ISO do
|
5
5
|
|
6
|
+
it "Warns of missing scope" do
|
7
|
+
FileUtils.rm_f "test.err"
|
8
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
9
|
+
= Document title
|
10
|
+
Author
|
11
|
+
:docfile: test.adoc
|
12
|
+
:nodoc:
|
13
|
+
:no-isobib:
|
14
|
+
:doctype: pizza
|
15
|
+
|
16
|
+
text
|
17
|
+
INPUT
|
18
|
+
expect(File.read("test.err")).to include "Scope clause missing"
|
19
|
+
FileUtils.rm_f "test.err"
|
20
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
21
|
+
= Document title
|
22
|
+
Author
|
23
|
+
:docfile: test.adoc
|
24
|
+
:nodoc:
|
25
|
+
:no-isobib:
|
26
|
+
:doctype: pizza
|
27
|
+
|
28
|
+
== Scope
|
29
|
+
INPUT
|
30
|
+
expect(File.read("test.err")).not_to include "Scope clause missing"
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
it "Warns of missing normative references" do
|
35
|
+
FileUtils.rm_f "test.err"
|
36
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
37
|
+
= Document title
|
38
|
+
Author
|
39
|
+
:docfile: test.adoc
|
40
|
+
:nodoc:
|
41
|
+
:no-isobib:
|
42
|
+
:doctype: pizza
|
43
|
+
|
44
|
+
text
|
45
|
+
INPUT
|
46
|
+
expect(File.read("test.err")).to include "Normative references missing"
|
47
|
+
FileUtils.rm_f "test.err"
|
48
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
49
|
+
= Document title
|
50
|
+
Author
|
51
|
+
:docfile: test.adoc
|
52
|
+
:nodoc:
|
53
|
+
:no-isobib:
|
54
|
+
:doctype: pizza
|
55
|
+
|
56
|
+
[bibliography]
|
57
|
+
== Normative references
|
58
|
+
INPUT
|
59
|
+
expect(File.read("test.err")).not_to include "Normative references missing"
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
it "Warns of missing terms & definitions" do
|
64
|
+
FileUtils.rm_f "test.err"
|
65
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
66
|
+
= Document title
|
67
|
+
Author
|
68
|
+
:docfile: test.adoc
|
69
|
+
:nodoc:
|
70
|
+
:no-isobib:
|
71
|
+
:doctype: pizza
|
72
|
+
|
73
|
+
text
|
74
|
+
INPUT
|
75
|
+
expect(File.read("test.err")).to include "Terms & definitions missing"
|
76
|
+
FileUtils.rm_f "test.err"
|
77
|
+
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
78
|
+
= Document title
|
79
|
+
Author
|
80
|
+
:docfile: test.adoc
|
81
|
+
:nodoc:
|
82
|
+
:no-isobib:
|
83
|
+
:doctype: pizza
|
84
|
+
|
85
|
+
== Terms and definitions
|
86
|
+
=== Term 1
|
87
|
+
INPUT
|
88
|
+
expect(File.read("test.err")).not_to include "Terms & definitions missing"
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
6
93
|
it "Warns of illegal doctype" do
|
7
94
|
FileUtils.rm_f "test.err"
|
8
95
|
Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
|
data/spec/isodoc/amd_spec.rb
CHANGED
@@ -66,9 +66,9 @@ RSpec.describe IsoDoc do
|
|
66
66
|
<preface>
|
67
67
|
<foreword>
|
68
68
|
<p>
|
69
|
-
<xref target='N'>[
|
70
|
-
<xref target='note1'>[
|
71
|
-
<xref target='note2'>[
|
69
|
+
<xref target='N'>[scope], Note</xref>
|
70
|
+
<xref target='note1'>[widgets1], Note 1</xref>
|
71
|
+
<xref target='note2'>[widgets1], Note 2</xref>
|
72
72
|
<xref target='AN'>A.1, Note</xref>
|
73
73
|
<xref target='Anote1'>A.2, Note 1</xref>
|
74
74
|
<xref target='Anote2'>A.2, Note 2</xref>
|
@@ -86,7 +86,7 @@ RSpec.describe IsoDoc do
|
|
86
86
|
</p>
|
87
87
|
</note>
|
88
88
|
<p>
|
89
|
-
<xref target='N'>
|
89
|
+
<xref target='N'>Note</xref>
|
90
90
|
</p>
|
91
91
|
</clause>
|
92
92
|
<terms id='terms'/>
|
@@ -94,22 +94,22 @@ RSpec.describe IsoDoc do
|
|
94
94
|
<title depth="1">Widgets</title>
|
95
95
|
<clause id='widgets1' inline-header="true">
|
96
96
|
<note id='note1'>
|
97
|
-
<name>NOTE</name>
|
97
|
+
<name>NOTE 1</name>
|
98
98
|
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
|
99
99
|
These results are based on a study carried out on three different
|
100
100
|
types of kernel.
|
101
101
|
</p>
|
102
102
|
</note>
|
103
103
|
<note id='note2'>
|
104
|
-
<name>NOTE</name>
|
104
|
+
<name>NOTE 2</name>
|
105
105
|
<p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
|
106
106
|
These results are based on a study carried out on three different
|
107
107
|
types of kernel.
|
108
108
|
</p>
|
109
109
|
</note>
|
110
110
|
<p>
|
111
|
-
<xref target='note1'>
|
112
|
-
<xref target='note2'>
|
111
|
+
<xref target='note1'>Note 1</xref>
|
112
|
+
<xref target='note2'>Note 2</xref>
|
113
113
|
</p>
|
114
114
|
</clause>
|
115
115
|
</clause>
|
@@ -229,8 +229,8 @@ RSpec.describe IsoDoc do
|
|
229
229
|
<title>Foreword</title>
|
230
230
|
<p id='A'>
|
231
231
|
This is a preamble
|
232
|
-
<xref target='C'>
|
233
|
-
<xref target='C1'>
|
232
|
+
<xref target='C'>0.1</xref>
|
233
|
+
<xref target='C1'>0.2</xref>
|
234
234
|
<xref target='D'>[D]</xref>
|
235
235
|
<xref target='H'>[H]</xref>
|
236
236
|
<xref target='I'>[I]</xref>
|
@@ -250,7 +250,7 @@ RSpec.describe IsoDoc do
|
|
250
250
|
<introduction id='B' obligation='informative'>
|
251
251
|
<title depth="1">Introduction</title>
|
252
252
|
<clause id='C' inline-header='false' obligation='informative'>
|
253
|
-
<title depth="
|
253
|
+
<title depth="2">Introduction Subsection</title>
|
254
254
|
</clause>
|
255
255
|
<clause id='C1' inline-header='true' obligation='informative'>Text</clause>
|
256
256
|
</introduction>
|
@@ -435,7 +435,7 @@ RSpec.describe IsoDoc do
|
|
435
435
|
<introduction id='B' obligation='informative'>
|
436
436
|
<title depth='1'>Introduction</title>
|
437
437
|
<clause id='C' inline-header='false' obligation='informative'>
|
438
|
-
<title depth='
|
438
|
+
<title depth='2'>Introduction Subsection</title>
|
439
439
|
</clause>
|
440
440
|
</introduction>
|
441
441
|
<clause id='B1'>
|
@@ -548,7 +548,7 @@ RSpec.describe IsoDoc do
|
|
548
548
|
<div class='Section3' id='B'>
|
549
549
|
<h1 class='IntroTitle'>Introduction</h1>
|
550
550
|
<div id='C'>
|
551
|
-
<
|
551
|
+
<h2>Introduction Subsection</h2>
|
552
552
|
</div>
|
553
553
|
</div>
|
554
554
|
<br/>
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -271,7 +271,7 @@ end
|
|
271
271
|
<h1 class="ForewordTitle">Foreword</h1>
|
272
272
|
<div id="samplecode" class="example">
|
273
273
|
<p><span class="example_label">EXAMPLE 1</span>  </p>
|
274
|
-
<div class="Quote">Hello
|
274
|
+
<div class="Quote">Hello</div>
|
275
275
|
</div>
|
276
276
|
<div id="samplecode2" class="example">
|
277
277
|
<p><span class="example_label">EXAMPLE 2 — Title</span>  Hello</p>
|
@@ -330,7 +330,7 @@ end
|
|
330
330
|
|
331
331
|
|
332
332
|
it "processes sequences of examples (Word)" do
|
333
|
-
expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")).to be_equivalent_to <<~"OUTPUT"
|
333
|
+
expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
334
334
|
<iso-standard xmlns='http://riboseinc.com/isoxml'>
|
335
335
|
<preface>
|
336
336
|
<foreword>
|
@@ -361,7 +361,7 @@ end
|
|
361
361
|
<h1 class="ForewordTitle">Foreword</h1>
|
362
362
|
<div id="samplecode" class="example">
|
363
363
|
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span></p>
|
364
|
-
<div class="Quote">Hello
|
364
|
+
<div class="Quote">Hello</div>
|
365
365
|
</div>
|
366
366
|
<div id="samplecode2" class="example">
|
367
367
|
<p><span class="example_label">EXAMPLE 2 — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
@@ -215,7 +215,7 @@ RSpec.describe IsoDoc do
|
|
215
215
|
expect(xmlpp("<div>" + word.gsub(/_Toc\d\d+/, "_Toc") )).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
216
216
|
<div>
|
217
217
|
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
218
|
-
\o "1-
|
218
|
+
\o "1-3" \h \z \u <span style="mso-element:field-separator"></span></span>
|
219
219
|
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
220
220
|
<a href="#_Toc">1 Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
221
221
|
<span style="mso-tab-count:1 dotted">. </span>
|
@@ -705,4 +705,79 @@ expect((IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/wo
|
|
705
705
|
expect(word).to include '<p class="zzWarning">This document is not an ISO International Standard'
|
706
706
|
end
|
707
707
|
|
708
|
+
it "populates Word ToC" do
|
709
|
+
FileUtils.rm_f "test.doc"
|
710
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
|
711
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
712
|
+
<sections>
|
713
|
+
<clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
714
|
+
<title>Introduction<bookmark id="Q"/> to this<fn reference="1">
|
715
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
716
|
+
</fn></title>
|
717
|
+
</clause>
|
718
|
+
<clause id="O" inline-header="false" obligation="normative">
|
719
|
+
<title>Clause 4.2</title>
|
720
|
+
<p>A<fn reference="1">
|
721
|
+
<p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
|
722
|
+
</fn></p>
|
723
|
+
<clause id="P" inline-header="false" obligation="normative">
|
724
|
+
<title>Clause 4.2.1</title>
|
725
|
+
</clause>
|
726
|
+
</clause></clause>
|
727
|
+
</sections>
|
728
|
+
</iso-standard>
|
729
|
+
INPUT
|
730
|
+
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
731
|
+
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
732
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
733
|
+
<div class="WordSection2">
|
734
|
+
An empty word intro page.
|
735
|
+
|
736
|
+
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
737
|
+
\o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
|
738
|
+
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
739
|
+
<a href="#_Toc">Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
740
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
741
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
742
|
+
<span style="mso-element:field-begin"></span></span>
|
743
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
744
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
745
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
|
746
|
+
<p class="MsoToc2">
|
747
|
+
<span class="MsoHyperlink">
|
748
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
749
|
+
<a href="#_Toc">Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
750
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
751
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
752
|
+
<span style="mso-element:field-begin"></span></span>
|
753
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
754
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
755
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
756
|
+
</span>
|
757
|
+
</p>
|
758
|
+
<p class="MsoToc2">
|
759
|
+
<span class="MsoHyperlink">
|
760
|
+
<span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
761
|
+
<a href="#_Toc">Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
762
|
+
<span style="mso-tab-count:1 dotted">. </span>
|
763
|
+
</span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
|
764
|
+
<span style="mso-element:field-begin"></span></span>
|
765
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
|
766
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
|
767
|
+
<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
|
768
|
+
</span>
|
769
|
+
</p>
|
770
|
+
<p class="MsoToc1">
|
771
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
772
|
+
<span style="mso-element:field-end"></span>
|
773
|
+
</span>
|
774
|
+
<span lang="EN-GB" xml:lang="EN-GB">
|
775
|
+
<p class="MsoNormal"> </p>
|
776
|
+
</span>
|
777
|
+
</p>
|
778
|
+
<p class="MsoNormal"> </p>
|
779
|
+
</div>
|
780
|
+
OUTPUT
|
781
|
+
end
|
782
|
+
|
708
783
|
end
|
data/spec/isodoc/ref_spec.rb
CHANGED
@@ -15,7 +15,7 @@ RSpec.describe Metanorma::Iso::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"], [:html_alt, "alt.html"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
18
|
+
[[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:isosts, "sts.xml"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
19
19
|
OUTPUT
|
20
20
|
end
|
21
21
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.6
|
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-
|
11
|
+
date: 2020-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-jing
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.5.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.5.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: byebug
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|