metanorma-iso 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/customisation.adoc +496 -37
- data/docs/guidance.adoc +26 -2
- data/docs/quickstart.adoc +1 -1
- data/lib/asciidoctor/iso/isodoc.rng +8 -1
- data/lib/asciidoctor/iso/isostandard.rng +11 -4
- data/lib/asciidoctor/iso/section.rb +1 -5
- data/lib/asciidoctor/iso/validate.rb +1 -1
- data/lib/asciidoctor/iso/validate_section.rb +1 -1
- data/lib/asciidoctor/iso/version.rb +1 -1
- data/lib/isodoc/iso/html/word_iso_titlepage.html +3 -6
- data/lib/isodoc/iso/html_convert.rb +20 -0
- data/lib/isodoc/iso/metadata.rb +2 -2
- data/lib/isodoc/iso/word_convert.rb +20 -0
- data/metanorma-iso.gemspec +1 -1
- data/spec/asciidoctor-iso/base_spec.rb +1 -3
- data/spec/asciidoctor-iso/section_spec.rb +6 -4
- data/spec/asciidoctor-iso/validate_spec.rb +26 -0
- data/spec/assets/iso.doc +9 -15
- data/spec/examples/rice.adoc +0 -2
- data/spec/examples/rice.preview.html +2 -9
- data/spec/examples/rice.sh +1 -1
- data/spec/isodoc/inline_spec.rb +263 -0
- data/spec/isodoc/iso_spec.rb +1 -3
- data/spec/isodoc/metadata_spec.rb +4 -4
- data/spec/isodoc/terms_spec.rb +207 -0
- data/spec/isodoc/xref_spec.rb +66 -65
- metadata +6 -4
data/spec/examples/rice.sh
CHANGED
@@ -0,0 +1,263 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe IsoDoc do
|
4
|
+
it "processes inline formatting" do
|
5
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<preface><foreword>
|
8
|
+
<p>
|
9
|
+
<em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
10
|
+
<strike>F</strike> <smallcap>G</smallcap> <br/> <hr/>
|
11
|
+
<bookmark id="H"/> <pagebreak/>
|
12
|
+
</p>
|
13
|
+
</foreword></preface>
|
14
|
+
<sections>
|
15
|
+
</iso-standard>
|
16
|
+
INPUT
|
17
|
+
#{HTML_HDR}
|
18
|
+
<br/>
|
19
|
+
<div>
|
20
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
21
|
+
<p>
|
22
|
+
<i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
23
|
+
<s>F</s> <span style="font-variant:small-caps;">G</span> <br/> <hr/>
|
24
|
+
<a id="H"/> <br/>
|
25
|
+
</p>
|
26
|
+
</div>
|
27
|
+
<p class="zzSTDTitle1"/>
|
28
|
+
</div>
|
29
|
+
</body>
|
30
|
+
</html>
|
31
|
+
OUTPUT
|
32
|
+
end
|
33
|
+
|
34
|
+
it "processes links" do
|
35
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
36
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
37
|
+
<preface><foreword>
|
38
|
+
<p>
|
39
|
+
<link target="http://example.com"/>
|
40
|
+
<link target="http://example.com">example</link>
|
41
|
+
<link target="mailto:fred@example.com"/>
|
42
|
+
<link target="mailto:fred@example.com">mailto:fred@example.com</link>
|
43
|
+
</p>
|
44
|
+
</foreword></preface>
|
45
|
+
<sections>
|
46
|
+
</iso-standard>
|
47
|
+
INPUT
|
48
|
+
#{HTML_HDR}
|
49
|
+
<br/>
|
50
|
+
<div>
|
51
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
52
|
+
<p>
|
53
|
+
<a href="http://example.com">http://example.com</a>
|
54
|
+
<a href="http://example.com">example</a>
|
55
|
+
<a href="mailto:fred@example.com">fred@example.com</a>
|
56
|
+
<a href="mailto:fred@example.com">mailto:fred@example.com</a>
|
57
|
+
</p>
|
58
|
+
</div>
|
59
|
+
<p class="zzSTDTitle1"/>
|
60
|
+
</div>
|
61
|
+
</body>
|
62
|
+
</html>
|
63
|
+
OUTPUT
|
64
|
+
end
|
65
|
+
|
66
|
+
it "processes unrecognised markup" do
|
67
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
68
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
69
|
+
<preface><foreword>
|
70
|
+
<p>
|
71
|
+
<barry fred="http://example.com">example</barry>
|
72
|
+
</p>
|
73
|
+
</foreword></preface>
|
74
|
+
<sections>
|
75
|
+
</iso-standard>
|
76
|
+
INPUT
|
77
|
+
#{HTML_HDR}
|
78
|
+
<br/>
|
79
|
+
<div>
|
80
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
81
|
+
<p>
|
82
|
+
<para><b role="strong"><barry fred="http://example.com">example</barry></b></para>
|
83
|
+
</p>
|
84
|
+
</div>
|
85
|
+
<p class="zzSTDTitle1"/>
|
86
|
+
</div>
|
87
|
+
</body>
|
88
|
+
</html>
|
89
|
+
OUTPUT
|
90
|
+
end
|
91
|
+
|
92
|
+
it "processes AsciiMath and MathML" do
|
93
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
94
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
95
|
+
<preface><foreword>
|
96
|
+
<p>
|
97
|
+
<stem type="AsciiMath">A</stem>
|
98
|
+
<stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
|
99
|
+
<stem type="None">Latex?</stem>
|
100
|
+
</p>
|
101
|
+
</foreword></preface>
|
102
|
+
<sections>
|
103
|
+
</iso-standard>
|
104
|
+
INPUT
|
105
|
+
#{HTML_HDR}
|
106
|
+
<br/>
|
107
|
+
<div>
|
108
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
109
|
+
<p>
|
110
|
+
<span class="stem">(#(A)#)</span>
|
111
|
+
<span class="stem"><m:math>
|
112
|
+
<m:row>X</m:row>
|
113
|
+
</m:math></span>
|
114
|
+
<span class="stem">Latex?</span>
|
115
|
+
</p>
|
116
|
+
</div>
|
117
|
+
<p class="zzSTDTitle1"/>
|
118
|
+
</div>
|
119
|
+
</body>
|
120
|
+
</html>
|
121
|
+
OUTPUT
|
122
|
+
end
|
123
|
+
|
124
|
+
it "overrides AsciiMath delimiters" do
|
125
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
126
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
127
|
+
<preface><foreword>
|
128
|
+
<p>
|
129
|
+
<stem type="AsciiMath">A</stem>
|
130
|
+
(#((Hello))#)
|
131
|
+
</p>
|
132
|
+
</foreword></preface>
|
133
|
+
<sections>
|
134
|
+
</iso-standard>
|
135
|
+
INPUT
|
136
|
+
#{HTML_HDR}
|
137
|
+
<br/>
|
138
|
+
<div>
|
139
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
140
|
+
<p>
|
141
|
+
<span class="stem">(#(((A)#)))</span>
|
142
|
+
(#((Hello))#)
|
143
|
+
</p>
|
144
|
+
</div>
|
145
|
+
<p class="zzSTDTitle1"/>
|
146
|
+
</div>
|
147
|
+
</body>
|
148
|
+
</html>
|
149
|
+
OUTPUT
|
150
|
+
end
|
151
|
+
|
152
|
+
it "processes eref types" do
|
153
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
154
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
155
|
+
<preface><foreword>
|
156
|
+
<p>
|
157
|
+
<eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
158
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
159
|
+
</p>
|
160
|
+
</foreword></preface>
|
161
|
+
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
162
|
+
<bibitem id="ISO712" type="standard">
|
163
|
+
<title format="text/plain">Cereals and cereal products</title>
|
164
|
+
<docidentifier>ISO 712</docidentifier>
|
165
|
+
<contributor>
|
166
|
+
<role type="publisher"/>
|
167
|
+
<organization>
|
168
|
+
<abbreviation>ISO</abbreviation>
|
169
|
+
</organization>
|
170
|
+
</contributor>
|
171
|
+
</bibitem>
|
172
|
+
</references>
|
173
|
+
</bibliography>
|
174
|
+
</iso-standard>
|
175
|
+
INPUT
|
176
|
+
#{HTML_HDR}
|
177
|
+
<br/>
|
178
|
+
<div>
|
179
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
180
|
+
<p>
|
181
|
+
<sup><a href="#ISO712">A</a></sup>
|
182
|
+
<a href="#ISO712">A</a>
|
183
|
+
</p>
|
184
|
+
</div>
|
185
|
+
<p class="zzSTDTitle1"/>
|
186
|
+
<div>
|
187
|
+
<h1>1.  Normative references</h1>
|
188
|
+
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
189
|
+
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
</body>
|
193
|
+
</html>
|
194
|
+
OUTPUT
|
195
|
+
end
|
196
|
+
|
197
|
+
it "processes eref content" do
|
198
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
199
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
200
|
+
<preface><foreword>
|
201
|
+
<p>
|
202
|
+
<eref type="inline" bibitemid="IEV" citeas="IEV"><locality type="clause"><referenceFrom>1-2-3</referenceFrom></locality></eref>
|
203
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
204
|
+
<eref type="inline" bibitemid="ISO712"/>
|
205
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
206
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
207
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
208
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
209
|
+
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
210
|
+
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
211
|
+
<eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
|
212
|
+
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
213
|
+
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
214
|
+
</p>
|
215
|
+
</foreword></preface>
|
216
|
+
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
217
|
+
<bibitem id="ISO712" type="standard">
|
218
|
+
<title format="text/plain">Cereals and cereal products</title>
|
219
|
+
<docidentifier>ISO 712</docidentifier>
|
220
|
+
<contributor>
|
221
|
+
<role type="publisher"/>
|
222
|
+
<organization>
|
223
|
+
<abbreviation>ISO</abbreviation>
|
224
|
+
</organization>
|
225
|
+
</contributor>
|
226
|
+
</bibitem>
|
227
|
+
</references>
|
228
|
+
</bibliography>
|
229
|
+
</iso-standard>
|
230
|
+
INPUT
|
231
|
+
#{HTML_HDR}
|
232
|
+
<br/>
|
233
|
+
<div>
|
234
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
235
|
+
<p>
|
236
|
+
<a href="#IEV">IEV, 1-2-3</a>
|
237
|
+
<a href="#ISO712">ISO 712</a>
|
238
|
+
<a href="#ISO712">ISO 712</a>
|
239
|
+
<a href="#ISO712">ISO 712, Table 1</a>
|
240
|
+
<a href="#ISO712">ISO 712, Table 1–1</a>
|
241
|
+
<a href="#ISO712">ISO 712, Clause 1, Table 1</a>
|
242
|
+
<a href="#ISO712">ISO 712, Clause 1</a>
|
243
|
+
<a href="#ISO712">ISO 712, 1.5</a>
|
244
|
+
<a href="#ISO712">A</a>
|
245
|
+
<a href="#ISO712">ISO 712, </a>
|
246
|
+
<a href="#ISO712">ISO 712, Prelude 7</a>
|
247
|
+
<a href="#ISO712">A</a>
|
248
|
+
</p>
|
249
|
+
</div>
|
250
|
+
<p class="zzSTDTitle1"/>
|
251
|
+
<div>
|
252
|
+
<h1>1.  Normative references</h1>
|
253
|
+
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
254
|
+
<p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
|
255
|
+
</div>
|
256
|
+
</div>
|
257
|
+
</body>
|
258
|
+
</html>
|
259
|
+
OUTPUT
|
260
|
+
end
|
261
|
+
|
262
|
+
|
263
|
+
end
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -101,7 +101,6 @@ RSpec.describe IsoDoc::Iso do
|
|
101
101
|
The World's Online Electrotechnical Vocabulary</title>
|
102
102
|
<source type="src">http://www.electropedia.org</source>
|
103
103
|
<docidentifier>IEV</docidentifier>
|
104
|
-
<date type="published"> <on>2018</on> </date>
|
105
104
|
<contributor>
|
106
105
|
<role type="publisher"/>
|
107
106
|
<organization>
|
@@ -113,7 +112,6 @@ RSpec.describe IsoDoc::Iso do
|
|
113
112
|
<language>en</language> <language>fr</language>
|
114
113
|
<script>Latn</script>
|
115
114
|
<copyright>
|
116
|
-
<from>2018</from>
|
117
115
|
<owner>
|
118
116
|
<organization>
|
119
117
|
<name>International Electrotechnical Commission</name>
|
@@ -148,7 +146,7 @@ RSpec.describe IsoDoc::Iso do
|
|
148
146
|
<div>
|
149
147
|
<h1 class="ForewordTitle">Foreword</h1>
|
150
148
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
|
151
|
-
<a href="#IEV">IEV
|
149
|
+
<a href="#IEV">IEV</a>
|
152
150
|
<a href="#ISO20483">ISO 20483:2013–2014</a>
|
153
151
|
</p>
|
154
152
|
</div>
|
@@ -21,7 +21,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
21
21
|
<title-part language="fr" format="text/plain">Riz</title-part>
|
22
22
|
</title>
|
23
23
|
<docidentifier>
|
24
|
-
<project-number part="1">17301</project-number>
|
24
|
+
<project-number part="1">ISO 17301</project-number>
|
25
25
|
<tc-document-number>17301</tc-document-number>
|
26
26
|
</docidentifier>
|
27
27
|
<date type="published"><on>2011</on></date>
|
@@ -69,7 +69,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
69
69
|
</version>
|
70
70
|
</iso-standard>
|
71
71
|
INPUT
|
72
|
-
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010–2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Partie 1: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Part 1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
|
72
|
+
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010–2011", :docnumber=>"ISO PreCD3 17301-1", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Partie 1: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Part 1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
|
73
73
|
OUTPUT
|
74
74
|
end
|
75
75
|
|
@@ -92,7 +92,7 @@ OUTPUT
|
|
92
92
|
<title-part language="fr" format="text/plain">Riz</title-part>
|
93
93
|
</title>
|
94
94
|
<docidentifier>
|
95
|
-
<project-number part="1" subpart="3">17301</project-number>
|
95
|
+
<project-number part="1" subpart="3">ISO/IEC 17301</project-number>
|
96
96
|
<tc-document-number>17301</tc-document-number>
|
97
97
|
</docidentifier>
|
98
98
|
<contributor>
|
@@ -145,7 +145,7 @@ OUTPUT
|
|
145
145
|
</version>
|
146
146
|
</iso-standard>
|
147
147
|
INPUT
|
148
|
-
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Partie 1–3: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Part 1–3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
|
148
|
+
{:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"ISO/IEC CD 17301-1-3", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Partie 1–3: Riz", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Part 1–3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" (draft 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
|
149
149
|
OUTPUT
|
150
150
|
end
|
151
151
|
|
@@ -0,0 +1,207 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe IsoDoc do
|
4
|
+
it "processes IsoXML terms" do
|
5
|
+
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<sections>
|
8
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
9
|
+
|
10
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
11
|
+
<domain>rice</domain>
|
12
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
13
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
14
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
15
|
+
<ul>
|
16
|
+
<li>A</li>
|
17
|
+
</ul>
|
18
|
+
</termexample>
|
19
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
20
|
+
<ul>
|
21
|
+
<li>A</li>
|
22
|
+
</ul>
|
23
|
+
</termexample>
|
24
|
+
|
25
|
+
<termsource status="modified">
|
26
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
27
|
+
<modification>
|
28
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
29
|
+
</modification>
|
30
|
+
</termsource></term>
|
31
|
+
|
32
|
+
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
33
|
+
<admitted>rough rice</admitted>
|
34
|
+
<deprecates>cargo rice</deprecates>
|
35
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
36
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
37
|
+
<ul>
|
38
|
+
<li>A</li>
|
39
|
+
</ul>
|
40
|
+
</termexample>
|
41
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
42
|
+
<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>
|
43
|
+
</termnote>
|
44
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
45
|
+
<ul><li>A</li></ul>
|
46
|
+
<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>
|
47
|
+
</termnote>
|
48
|
+
<termsource status="identical">
|
49
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
50
|
+
</termsource></term>
|
51
|
+
</terms>
|
52
|
+
</sections>
|
53
|
+
</iso-standard>
|
54
|
+
INPUT
|
55
|
+
#{HTML_HDR}
|
56
|
+
<p class="zzSTDTitle1"/>
|
57
|
+
<div id="_terms_and_definitions"><h1>1.  Terms and definitions</h1><p>For the purposes of this document,
|
58
|
+
the following terms and definitions apply.</p>
|
59
|
+
<p>ISO and IEC maintain terminological databases for use in
|
60
|
+
standardization at the following addresses:</p>
|
61
|
+
|
62
|
+
<ul>
|
63
|
+
<li> <p>ISO Online browsing platform: available at
|
64
|
+
<a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
|
65
|
+
<li> <p>IEC Electropedia: available at
|
66
|
+
<a href="http://www.electropedia.org">http://www.electropedia.org</a>
|
67
|
+
</p> </li> </ul>
|
68
|
+
<p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
69
|
+
|
70
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
71
|
+
<table id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 1</td><td valign="top" class="example">
|
72
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
73
|
+
<ul>
|
74
|
+
<li>A</li>
|
75
|
+
</ul>
|
76
|
+
</td></tr></table>
|
77
|
+
<table id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 2</td><td valign="top" class="example">
|
78
|
+
<ul>
|
79
|
+
<li>A</li>
|
80
|
+
</ul>
|
81
|
+
</td></tr></table>
|
82
|
+
|
83
|
+
<p>[TERMREF]
|
84
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
85
|
+
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
86
|
+
[/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>
|
87
|
+
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
88
|
+
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
89
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
90
|
+
<table id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE</td><td valign="top" class="example">
|
91
|
+
<ul>
|
92
|
+
<li>A</li>
|
93
|
+
</ul>
|
94
|
+
</td></tr></table>
|
95
|
+
<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>
|
96
|
+
<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>
|
97
|
+
<p>[TERMREF]
|
98
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
99
|
+
[/TERMREF]</p></div>
|
100
|
+
</div>
|
101
|
+
</body>
|
102
|
+
</head>
|
103
|
+
</html>
|
104
|
+
OUTPUT
|
105
|
+
end
|
106
|
+
|
107
|
+
it "processes IsoXML terms (Word)" do
|
108
|
+
expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<p class="zzSTDTitle1"/>}m, "")).to be_equivalent_to <<~"OUTPUT"
|
109
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
110
|
+
<sections>
|
111
|
+
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
112
|
+
|
113
|
+
<term id="paddy1"><preferred>paddy</preferred>
|
114
|
+
<domain>rice</domain>
|
115
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
116
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
|
117
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
118
|
+
<ul>
|
119
|
+
<li>A</li>
|
120
|
+
</ul>
|
121
|
+
</termexample>
|
122
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
|
123
|
+
<ul>
|
124
|
+
<li>A</li>
|
125
|
+
</ul>
|
126
|
+
</termexample>
|
127
|
+
|
128
|
+
<termsource status="modified">
|
129
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
130
|
+
<modification>
|
131
|
+
<p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
|
132
|
+
</modification>
|
133
|
+
</termsource></term>
|
134
|
+
|
135
|
+
<term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
|
136
|
+
<admitted>rough rice</admitted>
|
137
|
+
<deprecates>cargo rice</deprecates>
|
138
|
+
<definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
|
139
|
+
<termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
|
140
|
+
<ul>
|
141
|
+
<li>A</li>
|
142
|
+
</ul>
|
143
|
+
</termexample>
|
144
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
|
145
|
+
<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>
|
146
|
+
</termnote>
|
147
|
+
<termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
|
148
|
+
<ul><li>A</li></ul>
|
149
|
+
<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>
|
150
|
+
</termnote>
|
151
|
+
<termsource status="identical">
|
152
|
+
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
|
153
|
+
</termsource></term>
|
154
|
+
</terms>
|
155
|
+
</sections>
|
156
|
+
</iso-standard>
|
157
|
+
INPUT
|
158
|
+
<div id="_terms_and_definitions"><h1>1.<span style="mso-tab-count:1">  </span>Terms and definitions</h1><p>For the purposes of this document,
|
159
|
+
the following terms and definitions apply.</p>
|
160
|
+
<p>ISO and IEC maintain terminological databases for use in
|
161
|
+
standardization at the following addresses:</p>
|
162
|
+
|
163
|
+
<ul>
|
164
|
+
<li> <p>ISO Online browsing platform: available at
|
165
|
+
<a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
|
166
|
+
<li> <p>IEC Electropedia: available at
|
167
|
+
<a href="http://www.electropedia.org">http://www.electropedia.org</a>
|
168
|
+
</p> </li> </ul>
|
169
|
+
<p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
170
|
+
|
171
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"><rice> rice retaining its husk after threshing</p>
|
172
|
+
<table id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 1</td><td valign="top" class="example">
|
173
|
+
<p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
|
174
|
+
<ul>
|
175
|
+
<li>A</li>
|
176
|
+
</ul>
|
177
|
+
</td></tr></table>
|
178
|
+
<table id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 2</td><td valign="top" class="example">
|
179
|
+
<ul>
|
180
|
+
<li>A</li>
|
181
|
+
</ul>
|
182
|
+
</td></tr></table>
|
183
|
+
|
184
|
+
<p>[TERMREF]
|
185
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
186
|
+
[MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
|
187
|
+
[/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>
|
188
|
+
<p class="AltTerms" style="text-align:left;">rough rice</p>
|
189
|
+
<p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
|
190
|
+
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
|
191
|
+
<table id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE</td><td valign="top" class="example">
|
192
|
+
<ul>
|
193
|
+
<li>A</li>
|
194
|
+
</ul>
|
195
|
+
</td></tr></table>
|
196
|
+
<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>
|
197
|
+
<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>
|
198
|
+
<p>[TERMREF]
|
199
|
+
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
200
|
+
[/TERMREF]</p></div>
|
201
|
+
</div>
|
202
|
+
</body>
|
203
|
+
</html>
|
204
|
+
|
205
|
+
OUTPUT
|
206
|
+
end
|
207
|
+
end
|