metanorma-iso 2.0.8.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/html2doc/lists.rb +169 -0
- data/lib/isodoc/iso/base_convert.rb +11 -1
- data/lib/isodoc/iso/html/html_iso_titlepage.html +7 -0
- data/lib/isodoc/iso/html/isodoc-dis.css +407 -427
- data/lib/isodoc/iso/html/isodoc-dis.scss +482 -438
- data/lib/isodoc/iso/html/isodoc.css +38 -13
- data/lib/isodoc/iso/html/isodoc.scss +38 -12
- data/lib/isodoc/iso/html/style-human.css +14 -1
- data/lib/isodoc/iso/html/style-human.scss +10 -1
- data/lib/isodoc/iso/html/style-iso.css +35 -23
- data/lib/isodoc/iso/html/style-iso.scss +31 -23
- data/lib/isodoc/iso/html/word_iso_intro-dis.html +3 -1
- data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +26 -13
- data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
- data/lib/isodoc/iso/html/word_iso_titlepage.html +16 -6
- data/lib/isodoc/iso/html/wordstyle-dis.css +168 -48
- data/lib/isodoc/iso/html/wordstyle-dis.scss +158 -43
- data/lib/isodoc/iso/html_convert.rb +7 -2
- data/lib/isodoc/iso/i18n-en.yaml +33 -4
- data/lib/isodoc/iso/i18n-fr.yaml +30 -3
- data/lib/isodoc/iso/i18n-ru.yaml +33 -4
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +33 -3
- data/lib/isodoc/iso/i18n.rb +1 -1
- data/lib/isodoc/iso/init.rb +17 -1
- data/lib/isodoc/iso/iso.amendment.xsl +1711 -367
- data/lib/isodoc/iso/iso.international-standard.xsl +1711 -367
- data/lib/isodoc/iso/metadata.rb +72 -78
- data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
- data/lib/isodoc/iso/presentation_xml_convert.rb +52 -100
- data/lib/isodoc/iso/presentation_xref.rb +132 -0
- data/lib/isodoc/iso/sections.rb +3 -3
- data/lib/isodoc/iso/word_cleanup.rb +17 -0
- data/lib/isodoc/iso/word_convert.rb +32 -12
- data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
- data/lib/isodoc/iso/word_dis_convert.rb +122 -0
- data/lib/isodoc/iso/xref.rb +78 -29
- data/lib/metanorma/iso/base.rb +20 -1
- data/lib/metanorma/iso/biblio.rng +69 -42
- data/lib/metanorma/iso/boilerplate-fr.xml +4 -1
- data/lib/metanorma/iso/boilerplate-ru.xml +4 -3
- data/lib/metanorma/iso/boilerplate.xml +4 -3
- data/lib/metanorma/iso/cleanup.rb +29 -1
- data/lib/metanorma/iso/front.rb +31 -6
- data/lib/metanorma/iso/front_id.rb +2 -0
- data/lib/metanorma/iso/isodoc.rng +65 -0
- data/lib/metanorma/iso/isostandard.rng +30 -12
- data/lib/metanorma/iso/macros.rb +29 -0
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/metanorma-iso.rb +1 -0
- data/lib/relaton/render/config.yml +4 -0
- data/lib/relaton/render/general.rb +13 -0
- data/metanorma-iso.gemspec +1 -1
- data/spec/isodoc/amd_spec.rb +35 -60
- data/spec/isodoc/blocks_spec.rb +783 -179
- data/spec/isodoc/i18n_spec.rb +331 -100
- data/spec/isodoc/inline_spec.rb +35 -42
- data/spec/isodoc/iso_spec.rb +51 -170
- data/spec/isodoc/metadata_spec.rb +240 -99
- data/spec/isodoc/postproc_spec.rb +68 -7
- data/spec/isodoc/ref_spec.rb +66 -69
- data/spec/isodoc/section_spec.rb +88 -80
- data/spec/isodoc/table_spec.rb +2 -2
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/word_dis_spec.rb +1886 -0
- data/spec/isodoc/xref_spec.rb +138 -64
- data/spec/metanorma/amd_spec.rb +53 -1
- data/spec/metanorma/base_spec.rb +195 -20
- data/spec/metanorma/blocks_spec.rb +54 -0
- data/spec/metanorma/lists_spec.rb +2 -2
- data/spec/metanorma/section_spec.rb +2 -2
- data/spec/spec_helper.rb +23 -4
- data/spec/vcr_cassettes/withdrawn_iso.yml +25 -25
- metadata +15 -10
- data/docs/asciiiso-syntax.adoc +0 -307
- data/docs/guidance.adoc +0 -487
- data/docs/navigation.adoc +0 -23
- data/docs/quickstart.adoc +0 -179
- data/spec/vcr_cassettes/docrels.yml +0 -385
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -199,7 +199,7 @@ RSpec.describe IsoDoc do
|
|
199
199
|
<title>1<tab/>
|
200
200
|
Normative references</title>
|
201
201
|
<bibitem id="ISO712" type="standard">
|
202
|
-
<
|
202
|
+
<formattedref format="text/plain"><em>Cereals and cereal products</em></formattedref>
|
203
203
|
<docidentifier>ISO 712</docidentifier>
|
204
204
|
<contributor>
|
205
205
|
<role type="publisher"/>
|
@@ -297,6 +297,7 @@ RSpec.describe IsoDoc do
|
|
297
297
|
</locality>
|
298
298
|
</eref>
|
299
299
|
<eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
|
300
|
+
<eref bibitemid="ISO712" citeas="ISO/IEC DIR 1" type="inline"/>
|
300
301
|
</p>
|
301
302
|
</foreword>
|
302
303
|
</preface>
|
@@ -328,40 +329,40 @@ RSpec.describe IsoDoc do
|
|
328
329
|
<eref bibitemid="IEV" citeas="IEV" type="inline">
|
329
330
|
<locality type="clause">
|
330
331
|
<referenceFrom>1-2-3</referenceFrom>
|
331
|
-
</locality>IEV
|
332
|
-
<eref bibitemid="ISO712" citeas="ISO 712" type="inline">ISO 712</eref>
|
332
|
+
</locality><span class='stdpublisher'>IEV</span>, <span class="citesec">1-2-3</span></eref>
|
333
|
+
<eref bibitemid="ISO712" citeas="ISO 712" type="inline"><span class='stdpublisher'>ISO</span> <span class='stddocNumber'>712</span></eref>
|
333
334
|
<eref bibitemid="ISO712" type="inline">ISO 712</eref>
|
334
335
|
<eref bibitemid="ISO712" type="inline">
|
335
336
|
<locality type="table">
|
336
337
|
<referenceFrom>1</referenceFrom>
|
337
|
-
</locality>ISO 712, Table 1</eref>
|
338
|
+
</locality>ISO 712, <span class="citetbl">Table 1</span></eref>
|
338
339
|
<eref bibitemid="ISO712" type="inline">
|
339
340
|
<locality type="table">
|
340
341
|
<referenceFrom>1</referenceFrom>
|
341
342
|
<referenceTo>1</referenceTo>
|
342
|
-
</locality>ISO 712, Table 1–1</eref>
|
343
|
+
</locality>ISO 712, <span class="citetbl">Table 1–1</span></eref>
|
343
344
|
<eref bibitemid="ISO712" type="inline">
|
344
345
|
<locality type="clause">
|
345
346
|
<referenceFrom>1</referenceFrom>
|
346
347
|
</locality>
|
347
348
|
<locality type="table">
|
348
349
|
<referenceFrom>1</referenceFrom>
|
349
|
-
</locality>ISO 712, Clause 1
|
350
|
+
</locality>ISO 712, <span class="citesec">Clause 1</span>, <span class="citetbl">Table 1</span></eref>
|
350
351
|
<eref bibitemid="ISO712" type="inline">
|
351
352
|
<locality type="clause">
|
352
353
|
<referenceFrom>1</referenceFrom>
|
353
354
|
</locality>
|
354
355
|
<locality type="list">
|
355
356
|
<referenceFrom>a</referenceFrom>
|
356
|
-
</locality>ISO 712, Clause 1 a)</eref>
|
357
|
+
</locality>ISO 712, <span class="citesec">Clause 1</span> a)</eref>
|
357
358
|
<eref bibitemid="ISO712" type="inline">
|
358
359
|
<locality type="clause">
|
359
360
|
<referenceFrom>1</referenceFrom>
|
360
|
-
</locality>ISO 712, Clause 1</eref>
|
361
|
+
</locality>ISO 712, <span class="citesec">Clause 1</span></eref>
|
361
362
|
<eref bibitemid="ISO712" type="inline">
|
362
363
|
<locality type="clause">
|
363
364
|
<referenceFrom>1.5</referenceFrom>
|
364
|
-
</locality>ISO 712, 1.5</eref>
|
365
|
+
</locality>ISO 712, <span class="citesec">1.5</span></eref>
|
365
366
|
<eref bibitemid="ISO712" type="inline">
|
366
367
|
<locality type="table">
|
367
368
|
<referenceFrom>1</referenceFrom>
|
@@ -373,6 +374,11 @@ RSpec.describe IsoDoc do
|
|
373
374
|
<referenceFrom>7</referenceFrom>
|
374
375
|
</locality>ISO 712, Prelude 7</eref>
|
375
376
|
<eref bibitemid="ISO712" citeas="ISO 712" type="inline">A</eref>
|
377
|
+
<eref bibitemid='ISO712' citeas='ISO/IEC DIR 1' type='inline'>
|
378
|
+
<span class='stdpublisher'>ISO/IEC</span>
|
379
|
+
<span class='stddocNumber'>DIR</span>
|
380
|
+
<span class='stddocNumber'>1</span>
|
381
|
+
</eref>
|
376
382
|
</p>
|
377
383
|
</foreword>
|
378
384
|
</preface>
|
@@ -381,14 +387,8 @@ RSpec.describe IsoDoc do
|
|
381
387
|
<title depth="1">1<tab/>
|
382
388
|
Normative References</title>
|
383
389
|
<bibitem id="ISO712" type="standard">
|
384
|
-
|
390
|
+
<formattedref><em><span class='stddocTitle'>Cereals and cereal products</span></em></formattedref>
|
385
391
|
<docidentifier>ISO 712</docidentifier>
|
386
|
-
<contributor>
|
387
|
-
<role type="publisher"/>
|
388
|
-
<organization>
|
389
|
-
<abbreviation>ISO</abbreviation>
|
390
|
-
</organization>
|
391
|
-
</contributor>
|
392
392
|
</bibitem>
|
393
393
|
</references>
|
394
394
|
</bibliography>
|
@@ -509,11 +509,11 @@ RSpec.describe IsoDoc do
|
|
509
509
|
<p>
|
510
510
|
<ul>
|
511
511
|
<li>
|
512
|
-
(<xref target="clause1">Clause 3</xref>)
|
512
|
+
(<xref target="clause1"><span class='citesec'>Clause 3</span></xref>)
|
513
513
|
</li>
|
514
514
|
<li>
|
515
515
|
<em>term</em>
|
516
|
-
(<xref target="clause1">Clause 3</xref>)
|
516
|
+
(<xref target="clause1"><span class='citesec'>Clause 3</span></xref>)
|
517
517
|
</li>
|
518
518
|
<li>
|
519
519
|
<em>w[o]rd</em>
|
@@ -521,7 +521,7 @@ RSpec.describe IsoDoc do
|
|
521
521
|
</li>
|
522
522
|
<li>
|
523
523
|
<em>term</em>
|
524
|
-
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>)
|
524
|
+
(<eref bibitemid="ISO712" type="inline" citeas="ISO 712"><span class='stdpublisher'>ISO</span> <span class='stddocNumber'>712</span></eref>)
|
525
525
|
</li>
|
526
526
|
<li>
|
527
527
|
<em>word</em>
|
@@ -533,7 +533,7 @@ RSpec.describe IsoDoc do
|
|
533
533
|
<referenceFrom>3.1</referenceFrom>
|
534
534
|
</locality><locality type="figure">
|
535
535
|
<referenceFrom>a</referenceFrom>
|
536
|
-
</locality>ISO 712
|
536
|
+
</locality><span class='stdpublisher'>ISO</span> <span class='stddocNumber'>712</span>, <span class="citesec">3.1</span>, <span class="citefig">Figure a</span></eref>)
|
537
537
|
</li>
|
538
538
|
<li>
|
539
539
|
<em>word</em>
|
@@ -545,7 +545,7 @@ RSpec.describe IsoDoc do
|
|
545
545
|
<locality type="figure">
|
546
546
|
<referenceFrom>b</referenceFrom>
|
547
547
|
</locality>
|
548
|
-
</localityStack>ISO 712
|
548
|
+
</localityStack><span class='stdpublisher'>ISO</span> <span class='stddocNumber'>712</span>, <span class="citesec">3.1</span> and <span class="citefig">Figure b</span></eref>)
|
549
549
|
</li>
|
550
550
|
<li>
|
551
551
|
<em>word</em>
|
@@ -584,15 +584,8 @@ RSpec.describe IsoDoc do
|
|
584
584
|
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="1"><title depth="1">1<tab/>Normative References</title>
|
585
585
|
<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>
|
586
586
|
<bibitem id="ISO712" type="standard">
|
587
|
-
|
588
|
-
<title type="main" format="text/plain">Cereals and cereal products</title>
|
587
|
+
<formattedref><em><span class='stddocTitle'>Cereals and cereal products</span></em></formattedref>
|
589
588
|
<docidentifier type="ISO">ISO 712</docidentifier>
|
590
|
-
<contributor>
|
591
|
-
<role type="publisher"/>
|
592
|
-
<organization>
|
593
|
-
<name>International Organization for Standardization</name>
|
594
|
-
</organization>
|
595
|
-
</contributor>
|
596
589
|
</bibitem>
|
597
590
|
</references></bibliography>
|
598
591
|
</iso-standard>
|
@@ -768,7 +761,7 @@ RSpec.describe IsoDoc do
|
|
768
761
|
<li>
|
769
762
|
<em>term</em>
|
770
763
|
(
|
771
|
-
<xref target='clause1'>1.2</xref>
|
764
|
+
<xref target='clause1'><span class='citesec'>1.2</span></xref>
|
772
765
|
)
|
773
766
|
</li>
|
774
767
|
<li> term </li>
|
@@ -780,7 +773,7 @@ RSpec.describe IsoDoc do
|
|
780
773
|
<li>
|
781
774
|
<em>term</em>
|
782
775
|
(
|
783
|
-
<xref target='clause1'>1.2</xref>
|
776
|
+
<xref target='clause1'><span class='citesec'>1.2</span></xref>
|
784
777
|
)
|
785
778
|
</li>
|
786
779
|
<li> term </li>
|
@@ -850,15 +843,15 @@ RSpec.describe IsoDoc do
|
|
850
843
|
<ul>
|
851
844
|
<li>
|
852
845
|
<em>term</em>
|
853
|
-
(<xref target="clause1">Clause 1</xref>)
|
846
|
+
(<xref target="clause1"><span class='citesec'>Clause 1</span></xref>)
|
854
847
|
</li>
|
855
848
|
<li>
|
856
849
|
term
|
857
|
-
(<xref target="clause1">Clause 1</xref>)
|
850
|
+
(<xref target="clause1"><span class='citesec'>Clause 1</span></xref>)
|
858
851
|
</li>
|
859
852
|
<li>
|
860
853
|
<em>term</em>
|
861
|
-
(<xref target="clause1">Clause 1</xref>)
|
854
|
+
(<xref target="clause1"><span class='citesec'>Clause 1</span></xref>)
|
862
855
|
</li>
|
863
856
|
<li>
|
864
857
|
term
|
@@ -869,10 +862,10 @@ RSpec.describe IsoDoc do
|
|
869
862
|
<li>
|
870
863
|
term
|
871
864
|
</li>
|
872
|
-
<li><xref target="clause1"><em>term</em></xref> (<xref target="clause1">Clause 1</xref>)</li>
|
873
|
-
<li><xref target="clause1"><em>term</em></xref> (Clause 1)</li>
|
874
|
-
<li><em>term</em> (<xref target="clause1">Clause 1</xref>)</li>
|
875
|
-
<li><em>term</em> (Clause 1)</li>
|
865
|
+
<li><xref target="clause1"><em>term</em></xref> (<xref target="clause1"><span class='citesec'>Clause 1</span></xref>)</li>
|
866
|
+
<li><xref target="clause1"><em>term</em></xref> (<span class='citesec'>Clause 1</span>)</li>
|
867
|
+
<li><em>term</em> (<xref target="clause1"><span class='citesec'>Clause 1</span></xref>)</li>
|
868
|
+
<li><em>term</em> (<span class='citesec'>Clause 1</span>)</li>
|
876
869
|
</ul></p>
|
877
870
|
</term>
|
878
871
|
</terms>
|
@@ -1017,7 +1010,7 @@ RSpec.describe IsoDoc do
|
|
1017
1010
|
<referenceFrom>5</referenceFrom>
|
1018
1011
|
</locality>
|
1019
1012
|
</localityStack>
|
1020
|
-
XYZ
|
1013
|
+
<span class='stdpublisher'>XYZ</span>, <span class="citesec">Clause <span class="citesec">3</span> to <span class="citesec">5</span></span>
|
1021
1014
|
</eref>
|
1022
1015
|
<eref type='inline' bibitemid='ref1' citeas='XYZ' droploc=''>
|
1023
1016
|
<localityStack connective='from'>
|
@@ -1030,7 +1023,7 @@ RSpec.describe IsoDoc do
|
|
1030
1023
|
<referenceFrom>5.1</referenceFrom>
|
1031
1024
|
</locality>
|
1032
1025
|
</localityStack>
|
1033
|
-
XYZ
|
1026
|
+
<span class='stdpublisher'>XYZ</span>, <span class="citesec">3.1</span> to <span class="citesec">5.1</span>
|
1034
1027
|
</eref>
|
1035
1028
|
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
1036
1029
|
<localityStack connective='from'>
|
@@ -1043,7 +1036,7 @@ RSpec.describe IsoDoc do
|
|
1043
1036
|
<referenceFrom>5</referenceFrom>
|
1044
1037
|
</locality>
|
1045
1038
|
</localityStack>
|
1046
|
-
XYZ
|
1039
|
+
<span class='stdpublisher'>XYZ</span>, <span class="citesec">3.1</span> to <span class="citesec">Clause 5</span>
|
1047
1040
|
</eref>
|
1048
1041
|
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
1049
1042
|
<localityStack connective='from'>
|
@@ -1056,7 +1049,7 @@ RSpec.describe IsoDoc do
|
|
1056
1049
|
<referenceFrom>5</referenceFrom>
|
1057
1050
|
</locality>
|
1058
1051
|
</localityStack>
|
1059
|
-
XYZ
|
1052
|
+
<span class='stdpublisher'>XYZ</span>, <span class="citesec">3.1</span> to <span class="citetbl">Table 5</span>
|
1060
1053
|
</eref>
|
1061
1054
|
</p>
|
1062
1055
|
</itu-standard>
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -157,7 +157,7 @@ RSpec.describe IsoDoc::Iso do
|
|
157
157
|
</relation>
|
158
158
|
</bibitem>
|
159
159
|
<bibitem id="ISO20483" type="standard">
|
160
|
-
<
|
160
|
+
<formattedref format="text/plain"><em>Cereals and pulses</em></formattedref>
|
161
161
|
<docidentifier>ISO 20483</docidentifier>
|
162
162
|
<date type="published">
|
163
163
|
<from>2013</from>
|
@@ -195,180 +195,61 @@ RSpec.describe IsoDoc::Iso do
|
|
195
195
|
OUTPUT
|
196
196
|
end
|
197
197
|
|
198
|
-
it "
|
198
|
+
it "inserts identifiers for editorial group and approval group" do
|
199
199
|
input = <<~INPUT
|
200
200
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
201
|
-
<
|
202
|
-
<
|
203
|
-
<
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
201
|
+
<bibdata>
|
202
|
+
<ext>
|
203
|
+
<doctype>international-standard</doctype>
|
204
|
+
<horizontal>true</horizontal>
|
205
|
+
<editorialgroup>
|
206
|
+
<agency>ISO</agency>
|
207
|
+
<agency>IEC</agency>
|
208
|
+
<technical-committee type="A" number="34">Food products</technical-committee>
|
209
|
+
<subcommittee type="B" number="4">Cereals and pulses</subcommittee>
|
210
|
+
<workgroup type="C" number="3">Rice Group</workgroup>
|
211
|
+
<secretariat>GB</secretariat>
|
212
|
+
</editorialgroup>
|
213
|
+
<approvalgroup>
|
214
|
+
<agency>ISO</agency>
|
215
|
+
<technical-committee type="D" number="34a">Food products A</technical-committee>
|
216
|
+
<subcommittee type="E" number="4a">Cereals and pulses A</subcommittee>
|
217
|
+
<workgroup type="F" number="3a">Rice Group A</workgroup>
|
218
|
+
</approvalgroup>
|
219
|
+
<stagename>Committee draft</stagename>
|
220
|
+
</ext>
|
221
|
+
</bibdata>
|
209
222
|
</iso-standard>
|
210
223
|
INPUT
|
211
224
|
presxml = <<~OUTPUT
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<
|
216
|
-
|
217
|
-
|
218
|
-
<
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
<
|
228
|
-
<
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
<p class="zzSTDTitle1"/>
|
235
|
-
</div>
|
236
|
-
</body>
|
237
|
-
</html>
|
238
|
-
OUTPUT
|
239
|
-
|
240
|
-
word = <<~OUTPUT
|
241
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
242
|
-
<div class="WordSection1">
|
243
|
-
<p> </p>
|
244
|
-
</div>
|
245
|
-
<p>
|
246
|
-
<br clear="all" class="section"/>
|
247
|
-
</p>
|
248
|
-
<div class="WordSection2">
|
249
|
-
<p>
|
250
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
251
|
-
</p>
|
252
|
-
<div>
|
253
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
254
|
-
<div id="samplecode" class="example">
|
255
|
-
<p><span class="example_label">EXAMPLE — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
<p> </p>
|
259
|
-
</div>
|
260
|
-
<p>
|
261
|
-
<br clear="all" class="section"/>
|
262
|
-
</p>
|
263
|
-
<div class="WordSection3">
|
264
|
-
<p class="zzSTDTitle1"/>
|
265
|
-
</div>
|
266
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
267
|
-
<div class="colophon"/>
|
268
|
-
</body>
|
269
|
-
OUTPUT
|
270
|
-
expect(IsoDoc::Iso::PresentationXMLConvert.new({})
|
271
|
-
.convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
|
272
|
-
expect(IsoDoc::Iso::HtmlConvert.new({})
|
273
|
-
.convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
|
274
|
-
output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
|
275
|
-
expect(xmlpp(output
|
276
|
-
.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
277
|
-
.to be_equivalent_to xmlpp(word)
|
278
|
-
end
|
279
|
-
|
280
|
-
it "processes sequences of examples" do
|
281
|
-
input = <<~INPUT
|
282
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
283
|
-
<preface>
|
284
|
-
<foreword>
|
285
|
-
<example id="samplecode">
|
286
|
-
<quote>Hello</quote>
|
287
|
-
</example>
|
288
|
-
<example id="samplecode2">
|
289
|
-
<name>Title</name>
|
290
|
-
<p>Hello</p>
|
291
|
-
</example>
|
292
|
-
</foreword>
|
293
|
-
</preface>
|
294
|
-
</iso-standard>
|
295
|
-
INPUT
|
296
|
-
presxml = <<~OUTPUT
|
297
|
-
<?xml version='1.0'?>
|
298
|
-
<iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
|
299
|
-
<preface>
|
300
|
-
<foreword displayorder="1">
|
301
|
-
<example id="samplecode">
|
302
|
-
<name>EXAMPLE 1</name>
|
303
|
-
<quote>Hello</quote>
|
304
|
-
</example>
|
305
|
-
<example id="samplecode2">
|
306
|
-
<name>EXAMPLE 2 — Title</name>
|
307
|
-
<p>Hello</p>
|
308
|
-
</example>
|
309
|
-
</foreword>
|
310
|
-
</preface>
|
311
|
-
</iso-standard>
|
312
|
-
OUTPUT
|
313
|
-
html = <<~OUTPUT
|
314
|
-
#{HTML_HDR}
|
315
|
-
<br/>
|
316
|
-
<div>
|
317
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
318
|
-
<div id="samplecode" class="example">
|
319
|
-
<p><span class="example_label">EXAMPLE 1</span>  </p>
|
320
|
-
<div class="Quote">Hello</div>
|
321
|
-
</div>
|
322
|
-
<div id="samplecode2" class="example">
|
323
|
-
<p><span class="example_label">EXAMPLE 2 — Title</span>  Hello</p>
|
324
|
-
</div>
|
325
|
-
</div>
|
326
|
-
<p class="zzSTDTitle1"/>
|
327
|
-
</div>
|
328
|
-
</body>
|
329
|
-
</html>
|
330
|
-
OUTPUT
|
331
|
-
word = <<~OUTPUT
|
332
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
333
|
-
<div class="WordSection1">
|
334
|
-
<p> </p>
|
335
|
-
</div>
|
336
|
-
<p>
|
337
|
-
<br clear="all" class="section"/>
|
338
|
-
</p>
|
339
|
-
<div class="WordSection2">
|
340
|
-
<p>
|
341
|
-
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
342
|
-
</p>
|
343
|
-
<div>
|
344
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
345
|
-
<div id="samplecode" class="example">
|
346
|
-
<p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">  </span></p>
|
347
|
-
<div class="Quote">Hello</div>
|
348
|
-
</div>
|
349
|
-
<div id="samplecode2" class="example">
|
350
|
-
<p><span class="example_label">EXAMPLE 2 — Title</span><span style="mso-tab-count:1">  </span>Hello</p>
|
351
|
-
</div>
|
352
|
-
</div>
|
353
|
-
<p> </p>
|
354
|
-
</div>
|
355
|
-
<p>
|
356
|
-
<br clear="all" class="section"/>
|
357
|
-
</p>
|
358
|
-
<div class="WordSection3">
|
359
|
-
<p class="zzSTDTitle1"/>
|
360
|
-
</div>
|
361
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
362
|
-
<div class="colophon"/>
|
363
|
-
</body>
|
225
|
+
<bibdata>
|
226
|
+
<ext>
|
227
|
+
<doctype language=''>international-standard</doctype>
|
228
|
+
<doctype language='en'>International Standard</doctype>
|
229
|
+
<horizontal>true</horizontal>
|
230
|
+
<editorialgroup identifier='ISO/IEC/A 34/B 4/C 3'>
|
231
|
+
<agency>ISO</agency>
|
232
|
+
<agency>IEC</agency>
|
233
|
+
<technical-committee type='A' number='34'>Food products</technical-committee>
|
234
|
+
<subcommittee type='B' number='4'>Cereals and pulses</subcommittee>
|
235
|
+
<workgroup type='C' number='3'>Rice Group</workgroup>
|
236
|
+
<secretariat>GB</secretariat>
|
237
|
+
</editorialgroup>
|
238
|
+
<approvalgroup identifier='ISO/D 34a/E 4a/F 3a'>
|
239
|
+
<agency>ISO</agency>
|
240
|
+
<technical-committee type='D' number='34a'>Food products A</technical-committee>
|
241
|
+
<subcommittee type='E' number='4a'>Cereals and pulses A</subcommittee>
|
242
|
+
<workgroup type='F' number='3a'>Rice Group A</workgroup>
|
243
|
+
</approvalgroup>
|
244
|
+
<stagename>Committee draft</stagename>
|
245
|
+
</ext>
|
246
|
+
</bibdata>
|
364
247
|
OUTPUT
|
365
|
-
expect(
|
366
|
-
.
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
|
372
|
-
.to be_equivalent_to xmlpp(word)
|
248
|
+
expect(xmlpp(Nokogiri::XML(
|
249
|
+
IsoDoc::Iso::PresentationXMLConvert.new({})
|
250
|
+
.convert("test", input, true),
|
251
|
+
)
|
252
|
+
.at("//xmlns:bibdata").to_xml))
|
253
|
+
.to be_equivalent_to xmlpp(presxml)
|
373
254
|
end
|
374
255
|
end
|