metanorma-iso 1.10.0 → 1.10.1
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 +41 -0
- data/Gemfile +3 -4
- data/Makefile +44 -0
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/lib/asciidoctor/iso/basicdoc.rng +11 -1
- data/lib/asciidoctor/iso/biblio.rng +2 -0
- data/lib/asciidoctor/iso/cleanup.rb +7 -6
- data/lib/asciidoctor/iso/isodoc.rng +13 -1
- data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
- data/lib/asciidoctor/iso/isostandard.rng +3 -1
- data/lib/asciidoctor/iso/reqt.rng +1 -1
- data/lib/isodoc/iso/i18n.rb +10 -9
- data/lib/isodoc/iso/iso.amendment.xsl +27 -9
- data/lib/isodoc/iso/iso.international-standard.xsl +27 -9
- data/lib/isodoc/iso/sections.rb +2 -0
- data/lib/isodoc/iso/word_cleanup.rb +94 -0
- data/lib/isodoc/iso/word_convert.rb +12 -89
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor/base_spec.rb +543 -209
- data/spec/asciidoctor/blocks_spec.rb +0 -39
- data/spec/asciidoctor/refs_spec.rb +87 -4
- data/spec/isodoc/i18n_spec.rb +25 -11
- data/spec/isodoc/table_spec.rb +6 -8
- data/spec/vcr_cassettes/docrels.yml +783 -0
- data/spec/vcr_cassettes/sortrefs.yml +599 -0
- metadata +6 -2
@@ -600,43 +600,4 @@ RSpec.describe Asciidoctor::ISO do
|
|
600
600
|
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
601
601
|
.to be_equivalent_to xmlpp(output)
|
602
602
|
end
|
603
|
-
|
604
|
-
it "processes nested terms" do
|
605
|
-
input = <<~INPUT
|
606
|
-
#{ASCIIDOC_BLANK_HDR}
|
607
|
-
== Terms and Definitions
|
608
|
-
|
609
|
-
[.term]
|
610
|
-
=== Term1
|
611
|
-
|
612
|
-
definition
|
613
|
-
|
614
|
-
==== Term11
|
615
|
-
definition2
|
616
|
-
INPUT
|
617
|
-
output = <<~OUTPUT
|
618
|
-
#{BLANK_HDR}
|
619
|
-
<sections>
|
620
|
-
<terms id='_' obligation='normative'>
|
621
|
-
<title>Terms and definitions</title>
|
622
|
-
#{TERM_BOILERPLATE}
|
623
|
-
<term id='term-term1'>
|
624
|
-
<preferred><expression><name>Term1</name></expression></preferred>
|
625
|
-
<definition><verbaldefinition>
|
626
|
-
<p id='_'>definition</p>
|
627
|
-
</verbaldefinition></definition>
|
628
|
-
<term id='term-term11'>
|
629
|
-
<preferred><expression><name>Term11</name></expression></preferred>
|
630
|
-
<definition><verbaldefinition>
|
631
|
-
<p id='_'>definition2</p>
|
632
|
-
</verbaldefinition></definition>
|
633
|
-
</term>
|
634
|
-
</term>
|
635
|
-
</terms>
|
636
|
-
</sections>
|
637
|
-
</iso-standard>
|
638
|
-
OUTPUT
|
639
|
-
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
640
|
-
.to be_equivalent_to xmlpp(output)
|
641
|
-
end
|
642
603
|
end
|
@@ -5,7 +5,7 @@ require "relaton_ietf"
|
|
5
5
|
RSpec.describe Asciidoctor::ISO do
|
6
6
|
it "processes draft ISO reference" do
|
7
7
|
mock_fdis
|
8
|
-
|
8
|
+
input = <<~INPUT
|
9
9
|
#{ISOBIB_BLANK_HDR}
|
10
10
|
== Clause
|
11
11
|
<<iso123>>
|
@@ -20,6 +20,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
20
20
|
* [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
|
21
21
|
* [[[fdis,ISO/FDIS 17664-1]]] Title
|
22
22
|
INPUT
|
23
|
+
output = <<~OUTPUT
|
23
24
|
#{BLANK_HDR}
|
24
25
|
<sections>
|
25
26
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -169,10 +170,12 @@ RSpec.describe Asciidoctor::ISO do
|
|
169
170
|
</bibliography>
|
170
171
|
</iso-standard>
|
171
172
|
OUTPUT
|
173
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
174
|
+
.to be_equivalent_to xmlpp(output)
|
172
175
|
end
|
173
176
|
|
174
177
|
it "processes all-parts ISO reference" do
|
175
|
-
|
178
|
+
input = <<~INPUT
|
176
179
|
#{ASCIIDOC_BLANK_HDR}
|
177
180
|
|
178
181
|
== Clause
|
@@ -184,6 +187,7 @@ RSpec.describe Asciidoctor::ISO do
|
|
184
187
|
|
185
188
|
* [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
|
186
189
|
INPUT
|
190
|
+
output = <<~OUTPUT
|
187
191
|
#{BLANK_HDR}
|
188
192
|
<sections>
|
189
193
|
<clause id="_" inline-header="false" obligation="normative">
|
@@ -219,16 +223,19 @@ RSpec.describe Asciidoctor::ISO do
|
|
219
223
|
</bibliography>
|
220
224
|
</iso-standard>
|
221
225
|
OUTPUT
|
226
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
227
|
+
.to be_equivalent_to xmlpp(output)
|
222
228
|
end
|
223
229
|
|
224
230
|
it "processes non-ISO reference in Normative References" do
|
225
|
-
|
231
|
+
input = <<~INPUT
|
226
232
|
#{ASCIIDOC_BLANK_HDR}
|
227
233
|
[bibliography]
|
228
234
|
== Normative References
|
229
235
|
|
230
236
|
* [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
|
231
237
|
INPUT
|
238
|
+
output = <<~OUTPUT
|
232
239
|
#{BLANK_HDR}
|
233
240
|
<sections>
|
234
241
|
|
@@ -248,16 +255,19 @@ RSpec.describe Asciidoctor::ISO do
|
|
248
255
|
</bibliography>
|
249
256
|
</iso-standard>
|
250
257
|
OUTPUT
|
258
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
259
|
+
.to be_equivalent_to xmlpp(output)
|
251
260
|
end
|
252
261
|
|
253
262
|
it "processes non-ISO reference in Bibliography" do
|
254
|
-
|
263
|
+
input = <<~INPUT
|
255
264
|
#{ASCIIDOC_BLANK_HDR}
|
256
265
|
[bibliography]
|
257
266
|
== Bibliography
|
258
267
|
|
259
268
|
* [[[iso123,1]]] _Standard_
|
260
269
|
INPUT
|
270
|
+
output = <<~OUTPUT
|
261
271
|
#{BLANK_HDR}
|
262
272
|
<sections>
|
263
273
|
|
@@ -275,6 +285,79 @@ RSpec.describe Asciidoctor::ISO do
|
|
275
285
|
</bibliography>
|
276
286
|
</iso-standard>
|
277
287
|
OUTPUT
|
288
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
289
|
+
.to be_equivalent_to xmlpp(output)
|
290
|
+
end
|
291
|
+
|
292
|
+
it "sort ISO references in Bibliography" do
|
293
|
+
VCR.use_cassette "sortrefs" do
|
294
|
+
input = <<~INPUT
|
295
|
+
#{ASCIIDOC_BLANK_HDR}
|
296
|
+
[bibliography]
|
297
|
+
== Bibliography
|
298
|
+
|
299
|
+
* [[[iso1,ISO 8000-110]]]
|
300
|
+
* [[[iso2,ISO 8000-61]]]
|
301
|
+
* [[[iso3,ISO 8000-8]]]
|
302
|
+
* [[[iso4,ISO 9]]]
|
303
|
+
INPUT
|
304
|
+
output = <<~OUTPUT
|
305
|
+
#{BLANK_HDR}
|
306
|
+
<sections> </sections>
|
307
|
+
<bibliography>
|
308
|
+
<references id='_' normative='false' obligation='informative'>
|
309
|
+
<title>Bibliography</title>
|
310
|
+
<bibitem id='iso4' type='standard'>
|
311
|
+
<docidentifier>ISO 9</docidentifier>
|
312
|
+
<docnumber>9</docnumber>
|
313
|
+
<contributor>
|
314
|
+
<role type='publisher'/>
|
315
|
+
<organization>
|
316
|
+
<name>International Organization for Standardization</name>
|
317
|
+
<abbreviation>ISO</abbreviation>
|
318
|
+
</organization>
|
319
|
+
</contributor>
|
320
|
+
</bibitem>
|
321
|
+
<bibitem id='iso3' type='standard'>
|
322
|
+
<docidentifier>ISO 8000-8</docidentifier>
|
323
|
+
<docnumber>8000-8</docnumber>
|
324
|
+
<contributor>
|
325
|
+
<role type='publisher'/>
|
326
|
+
<organization>
|
327
|
+
<name>International Organization for Standardization</name>
|
328
|
+
<abbreviation>ISO</abbreviation>
|
329
|
+
</organization>
|
330
|
+
</contributor>
|
331
|
+
</bibitem>
|
332
|
+
<bibitem id='iso2' type='standard'>
|
333
|
+
<docidentifier>ISO 8000-61</docidentifier>
|
334
|
+
<docnumber>8000-61</docnumber>
|
335
|
+
<contributor>
|
336
|
+
<role type='publisher'/>
|
337
|
+
<organization>
|
338
|
+
<name>International Organization for Standardization</name>
|
339
|
+
<abbreviation>ISO</abbreviation>
|
340
|
+
</organization>
|
341
|
+
</contributor>
|
342
|
+
</bibitem>
|
343
|
+
<bibitem id='iso1' type='standard'>
|
344
|
+
<docidentifier>ISO 8000-110</docidentifier>
|
345
|
+
<docnumber>8000-110</docnumber>
|
346
|
+
<contributor>
|
347
|
+
<role type='publisher'/>
|
348
|
+
<organization>
|
349
|
+
<name>International Organization for Standardization</name>
|
350
|
+
<abbreviation>ISO</abbreviation>
|
351
|
+
</organization>
|
352
|
+
</contributor>
|
353
|
+
</bibitem>
|
354
|
+
</references>
|
355
|
+
</bibliography>
|
356
|
+
</iso-standard>
|
357
|
+
OUTPUT
|
358
|
+
expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
|
359
|
+
.to be_equivalent_to xmlpp(output)
|
360
|
+
end
|
278
361
|
end
|
279
362
|
|
280
363
|
private
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -249,13 +249,18 @@ RSpec.describe IsoDoc do
|
|
249
249
|
</body>
|
250
250
|
</html>
|
251
251
|
OUTPUT
|
252
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
253
|
-
.
|
254
|
-
|
252
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
253
|
+
.convert("test", input, true))
|
254
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
255
|
+
.to be_equivalent_to xmlpp(presxml)
|
256
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
257
|
+
.convert("test", presxml, true)))
|
258
|
+
.to be_equivalent_to xmlpp(html)
|
255
259
|
end
|
256
260
|
|
257
261
|
it "defaults to English" do
|
258
|
-
output = IsoDoc::Iso::PresentationXMLConvert.new({})
|
262
|
+
output = IsoDoc::Iso::PresentationXMLConvert.new({})
|
263
|
+
.convert("test", <<~"INPUT", true)
|
259
264
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
260
265
|
<bibdata>
|
261
266
|
<language>tlh</language>
|
@@ -334,7 +339,8 @@ RSpec.describe IsoDoc do
|
|
334
339
|
</bibliography>
|
335
340
|
</iso-standard>
|
336
341
|
INPUT
|
337
|
-
expect(xmlpp(output)
|
342
|
+
expect(xmlpp(output)
|
343
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
338
344
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
339
345
|
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
340
346
|
<bibdata>
|
@@ -686,9 +692,13 @@ RSpec.describe IsoDoc do
|
|
686
692
|
</body>
|
687
693
|
</html>
|
688
694
|
OUTPUT
|
689
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
690
|
-
.
|
691
|
-
|
695
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
696
|
+
.convert("test", input, true))
|
697
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
698
|
+
.to be_equivalent_to xmlpp(presxml)
|
699
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
700
|
+
.convert("test", presxml, true)))
|
701
|
+
.to be_equivalent_to xmlpp(html)
|
692
702
|
end
|
693
703
|
|
694
704
|
it "processes Simplified Chinese" do
|
@@ -989,8 +999,12 @@ RSpec.describe IsoDoc do
|
|
989
999
|
</body>
|
990
1000
|
</html>
|
991
1001
|
OUTPUT
|
992
|
-
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
993
|
-
.
|
994
|
-
|
1002
|
+
expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({})
|
1003
|
+
.convert("test", input, true))
|
1004
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
1005
|
+
.to be_equivalent_to xmlpp(presxml)
|
1006
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({})
|
1007
|
+
.convert("test", presxml, true)))
|
1008
|
+
.to be_equivalent_to xmlpp(html)
|
995
1009
|
end
|
996
1010
|
end
|
data/spec/isodoc/table_spec.rb
CHANGED
@@ -368,14 +368,12 @@ RSpec.describe IsoDoc do
|
|
368
368
|
</td>
|
369
369
|
</tr>
|
370
370
|
</tfoot>
|
371
|
-
|
372
|
-
<
|
373
|
-
<
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
<td valign="top">A type of rice</td>
|
378
|
-
</tr>
|
371
|
+
<dl>
|
372
|
+
<dt>
|
373
|
+
<p align='left' style='margin-left:0pt;text-align:left;' class='MsoNormal'>Drago</p>
|
374
|
+
</dt>
|
375
|
+
<dd>A type of rice</dd>
|
376
|
+
</dl>
|
379
377
|
</table>
|
380
378
|
</div>
|
381
379
|
OUTPUT
|