metanorma-iso 1.8.6 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/iso/cleanup.rb +0 -1
- data/lib/asciidoctor/iso/isodoc.rng +32 -7
- data/lib/asciidoctor/iso/isostandard.rng +7 -3
- data/lib/asciidoctor/iso/section.rb +3 -0
- data/lib/asciidoctor/iso/validate.rb +4 -17
- data/lib/asciidoctor/iso/validate_section.rb +50 -34
- data/lib/asciidoctor/iso/validate_style.rb +3 -3
- data/lib/isodoc/iso/base_convert.rb +31 -6
- data/lib/isodoc/iso/iso.amendment.xsl +122 -84
- data/lib/isodoc/iso/iso.international-standard.xsl +122 -84
- data/lib/isodoc/iso/isosts_convert.rb +12 -13
- data/lib/isodoc/iso/presentation_xml_convert.rb +51 -7
- data/lib/isodoc/iso/sts_convert.rb +4 -5
- data/lib/isodoc/iso/xref.rb +17 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor/section_spec.rb +128 -7
- data/spec/asciidoctor/validate_spec.rb +15 -15
- data/spec/isodoc/amd_spec.rb +2 -2
- data/spec/isodoc/inline_spec.rb +312 -122
- data/spec/isodoc/section_spec.rb +194 -71
- metadata +3 -3
data/spec/isodoc/section_spec.rb
CHANGED
@@ -86,86 +86,86 @@ RSpec.describe IsoDoc do
|
|
86
86
|
INPUT
|
87
87
|
|
88
88
|
presxml = <<~OUTPUT
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
</clause>
|
100
|
-
<p>This is patent boilerplate</p>
|
101
|
-
</introduction>
|
102
|
-
</preface>
|
103
|
-
<sections>
|
104
|
-
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
105
|
-
<title depth="1">1<tab/>Scope</title>
|
106
|
-
<p id="E">Text</p>
|
107
|
-
</clause>
|
108
|
-
<clause id="H" obligation="normative" displayorder="5">
|
109
|
-
<title depth="1">3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
110
|
-
<terms id="I" obligation="normative">
|
111
|
-
<title depth="2">3.1<tab/>Normal Terms</title>
|
112
|
-
<term id="J"><name>3.1.1</name>
|
113
|
-
<preferred>Term2</preferred>
|
114
|
-
</term>
|
115
|
-
</terms>
|
116
|
-
<definitions id="K" inline-header="true"><title>3.2</title>
|
117
|
-
<dl>
|
118
|
-
<dt>Symbol</dt>
|
119
|
-
<dd>Definition</dd>
|
120
|
-
</dl>
|
121
|
-
</definitions>
|
89
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
90
|
+
<preface>
|
91
|
+
<foreword obligation="informative" displayorder="1">
|
92
|
+
<title>Foreword</title>
|
93
|
+
<p id="A">This is a preamble</p>
|
94
|
+
</foreword>
|
95
|
+
<introduction id="B" obligation="informative" displayorder="2">
|
96
|
+
<title depth="1">0<tab/>Introduction</title>
|
97
|
+
<clause id="C" inline-header="false" obligation="informative">
|
98
|
+
<title depth="2">0.1<tab/>Introduction Subsection</title>
|
122
99
|
</clause>
|
123
|
-
<
|
100
|
+
<p>This is patent boilerplate</p>
|
101
|
+
</introduction>
|
102
|
+
</preface>
|
103
|
+
<sections>
|
104
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
105
|
+
<title depth="1">1<tab/>Scope</title>
|
106
|
+
<p id="E">Text</p>
|
107
|
+
</clause>
|
108
|
+
<clause id="H" obligation="normative" displayorder="5">
|
109
|
+
<title depth="1">3<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
110
|
+
<terms id="I" obligation="normative">
|
111
|
+
<title depth="2">3.1<tab/>Normal Terms</title>
|
112
|
+
<term id="J"><name>3.1.1</name>
|
113
|
+
<preferred>Term2</preferred>
|
114
|
+
</term>
|
115
|
+
</terms>
|
116
|
+
<definitions id="K" inline-header="true"><title>3.2</title>
|
124
117
|
<dl>
|
125
118
|
<dt>Symbol</dt>
|
126
119
|
<dd>Definition</dd>
|
127
120
|
</dl>
|
128
121
|
</definitions>
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
</
|
134
|
-
|
135
|
-
|
136
|
-
|
122
|
+
</clause>
|
123
|
+
<definitions id="L" displayorder="6"><title>4</title>
|
124
|
+
<dl>
|
125
|
+
<dt>Symbol</dt>
|
126
|
+
<dd>Definition</dd>
|
127
|
+
</dl>
|
128
|
+
</definitions>
|
129
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7">
|
130
|
+
<title depth="1">5<tab/>Clause 4</title>
|
131
|
+
<clause id="N" inline-header="false" obligation="normative">
|
132
|
+
<title depth="2">5.1<tab/>Introduction</title>
|
137
133
|
</clause>
|
138
|
-
|
139
|
-
|
140
|
-
<title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
141
|
-
<clause id="Q" inline-header="false" obligation="normative">
|
142
|
-
<title depth="2">A.1<tab/>Annex A.1</title>
|
143
|
-
<clause id="Q1" inline-header="false" obligation="normative">
|
144
|
-
<title depth="3">A.1.1<tab/>Annex A.1a</title>
|
145
|
-
</clause>
|
134
|
+
<clause id="O" inline-header="false" obligation="normative">
|
135
|
+
<title depth="2">5.2<tab/>Clause 4.2</title>
|
146
136
|
</clause>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
</
|
153
|
-
<
|
154
|
-
<title depth="
|
155
|
-
</references>
|
156
|
-
</annex>
|
157
|
-
<bibliography>
|
158
|
-
<references id="R" normative="true" obligation="informative" displayorder="4">
|
159
|
-
<title depth="1">2<tab/>Normative References</title>
|
160
|
-
</references>
|
161
|
-
<clause id="S" obligation="informative" displayorder="9">
|
162
|
-
<title depth="1">Bibliography</title>
|
163
|
-
<references id="T" normative="false" obligation="informative">
|
164
|
-
<title depth="2">Bibliography Subsection</title>
|
165
|
-
</references>
|
137
|
+
</clause>
|
138
|
+
</sections>
|
139
|
+
<annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
140
|
+
<title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
141
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
142
|
+
<title depth="2">A.1<tab/>Annex A.1</title>
|
143
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
144
|
+
<title depth="3">A.1.1<tab/>Annex A.1a</title>
|
166
145
|
</clause>
|
167
|
-
</
|
168
|
-
|
146
|
+
</clause>
|
147
|
+
<appendix id="Q2" inline-header="false" obligation="normative">
|
148
|
+
<title depth="2">Appendix 1<tab/>An Appendix</title>
|
149
|
+
<clause id="Q2a" inline-header="false" obligation="normative">
|
150
|
+
<title depth="3">Appendix 1.1<tab/>Appendix subclause</title>
|
151
|
+
</clause>
|
152
|
+
</appendix>
|
153
|
+
<references id="Q3" normative="false">
|
154
|
+
<title depth="2">A.2<tab/>Annex Bibliography</title>
|
155
|
+
</references>
|
156
|
+
</annex>
|
157
|
+
<bibliography>
|
158
|
+
<references id="R" normative="true" obligation="informative" displayorder="4">
|
159
|
+
<title depth="1">2<tab/>Normative References</title>
|
160
|
+
</references>
|
161
|
+
<clause id="S" obligation="informative" displayorder="9">
|
162
|
+
<title depth="1">Bibliography</title>
|
163
|
+
<references id="T" normative="false" obligation="informative">
|
164
|
+
<title depth="2">Bibliography Subsection</title>
|
165
|
+
</references>
|
166
|
+
</clause>
|
167
|
+
</bibliography>
|
168
|
+
</iso-standard>
|
169
169
|
OUTPUT
|
170
170
|
|
171
171
|
html = <<~OUTPUT
|
@@ -524,6 +524,129 @@ RSpec.describe IsoDoc do
|
|
524
524
|
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
525
525
|
end
|
526
526
|
|
527
|
+
it "processes multiple terms & definitions sections" do
|
528
|
+
input = <<~INPUT
|
529
|
+
#{BLANK_HDR.sub(%r{<doctype>article</doctype>}, '<doctype>article</doctype><subdoctype>vocabulary</subdoctype>')}
|
530
|
+
<sections>
|
531
|
+
<terms id='A' obligation='normative'>
|
532
|
+
<title>Terms and definitions</title>
|
533
|
+
<p id='A1'>No terms and definitions are listed in this document.</p>
|
534
|
+
</terms>
|
535
|
+
<clause id='B' inline-header='false' obligation='normative'>
|
536
|
+
<title>Clause</title>
|
537
|
+
</clause>
|
538
|
+
<terms id='C' obligation='normative'>
|
539
|
+
<title>More terms</title>
|
540
|
+
</terms>
|
541
|
+
</sections>
|
542
|
+
</iso-standard>
|
543
|
+
INPUT
|
544
|
+
presxml = <<~OUTPUT
|
545
|
+
<iso-standard xmlns='https://www.metanorma.org/ns/iso' type='presentation' version='1.8.6'>
|
546
|
+
<bibdata type='standard'>
|
547
|
+
<contributor>
|
548
|
+
<role type='author'/>
|
549
|
+
<organization>
|
550
|
+
<name>International Organization for Standardization</name>
|
551
|
+
<abbreviation>ISO</abbreviation>
|
552
|
+
</organization>
|
553
|
+
</contributor>
|
554
|
+
<contributor>
|
555
|
+
<role type='publisher'/>
|
556
|
+
<organization>
|
557
|
+
<name>International Organization for Standardization</name>
|
558
|
+
<abbreviation>ISO</abbreviation>
|
559
|
+
</organization>
|
560
|
+
</contributor>
|
561
|
+
<language current='true'>en</language>
|
562
|
+
<script current='true'>Latn</script>
|
563
|
+
<status>
|
564
|
+
<stage abbreviation='IS' language=''>60</stage>
|
565
|
+
<substage language=''>60</substage>
|
566
|
+
</status>
|
567
|
+
<copyright>
|
568
|
+
<from>2021</from>
|
569
|
+
<owner>
|
570
|
+
<organization>
|
571
|
+
<name>International Organization for Standardization</name>
|
572
|
+
<abbreviation>ISO</abbreviation>
|
573
|
+
</organization>
|
574
|
+
</owner>
|
575
|
+
</copyright>
|
576
|
+
<ext>
|
577
|
+
<doctype language=''>article</doctype>
|
578
|
+
<subdoctype>vocabulary</subdoctype>
|
579
|
+
<editorialgroup>
|
580
|
+
<technical-committee/>
|
581
|
+
<subcommittee/>
|
582
|
+
<workgroup/>
|
583
|
+
</editorialgroup>
|
584
|
+
<stagename>International standard</stagename>
|
585
|
+
</ext>
|
586
|
+
</bibdata>
|
587
|
+
<sections>
|
588
|
+
<terms id='A' obligation='normative' displayorder='1'>
|
589
|
+
<title depth='1'>
|
590
|
+
1
|
591
|
+
<tab/>
|
592
|
+
Terms and definitions
|
593
|
+
</title>
|
594
|
+
<p id='A1'>No terms and definitions are listed in this document.</p>
|
595
|
+
</terms>
|
596
|
+
<clause id='B' inline-header='false' obligation='normative' displayorder='2'>
|
597
|
+
<title depth='1'>
|
598
|
+
2
|
599
|
+
<tab/>
|
600
|
+
Clause
|
601
|
+
</title>
|
602
|
+
</clause>
|
603
|
+
<terms id='C' obligation='normative' displayorder='3'>
|
604
|
+
<title depth='1'>
|
605
|
+
3
|
606
|
+
<tab/>
|
607
|
+
More terms
|
608
|
+
</title>
|
609
|
+
</terms>
|
610
|
+
</sections>
|
611
|
+
</iso-standard>
|
612
|
+
OUTPUT
|
613
|
+
output = <<~OUTPUT
|
614
|
+
<html lang='en'>
|
615
|
+
<head/>
|
616
|
+
<body lang='en'>
|
617
|
+
<div class='title-section'>
|
618
|
+
<p> </p>
|
619
|
+
</div>
|
620
|
+
<br/>
|
621
|
+
<div class='prefatory-section'>
|
622
|
+
<p> </p>
|
623
|
+
</div>
|
624
|
+
<br/>
|
625
|
+
<div class='main-section'>
|
626
|
+
<p class='zzSTDTitle1'/>
|
627
|
+
<div id='A'>
|
628
|
+
<h1> 1   Terms and definitions </h1>
|
629
|
+
<p id='A1'>No terms and definitions are listed in this document.</p>
|
630
|
+
</div>
|
631
|
+
<div id='B'>
|
632
|
+
<h1> 2   Clause </h1>
|
633
|
+
</div>
|
634
|
+
<div id='C'>
|
635
|
+
<h1> 3   More terms </h1>
|
636
|
+
</div>
|
637
|
+
</div>
|
638
|
+
</body>
|
639
|
+
</html>
|
640
|
+
OUTPUT
|
641
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
642
|
+
.convert("test", input, true)
|
643
|
+
.gsub(%r{<localized-strings>.*</localized-strings>}m, "")
|
644
|
+
.gsub(%r{<boilerplate>.*</boilerplate>}m, "")))
|
645
|
+
.to be_equivalent_to xmlpp(presxml)
|
646
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
647
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
648
|
+
end
|
649
|
+
|
527
650
|
it "processes inline section headers" do
|
528
651
|
output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
|
529
652
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
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.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: isodoc
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.10.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: mnconvert
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|