metanorma-iso 1.8.0 → 1.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/lib/asciidoctor/iso/base.rb +14 -11
  6. data/lib/asciidoctor/iso/biblio.rng +1 -0
  7. data/lib/asciidoctor/iso/cleanup.rb +40 -24
  8. data/lib/asciidoctor/iso/front.rb +28 -16
  9. data/lib/asciidoctor/iso/front_id.rb +66 -50
  10. data/lib/asciidoctor/iso/isodoc.rng +191 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +12 -0
  13. data/lib/asciidoctor/iso/section.rb +2 -1
  14. data/lib/asciidoctor/iso/validate.rb +22 -110
  15. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  16. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  17. data/lib/asciidoctor/iso/validate_section.rb +55 -29
  18. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  19. data/lib/asciidoctor/iso/validate_title.rb +2 -4
  20. data/lib/isodoc/iso/base_convert.rb +20 -14
  21. data/lib/isodoc/iso/html/isodoc.css +475 -20
  22. data/lib/isodoc/iso/html/isodoc.scss +456 -23
  23. data/lib/isodoc/iso/html/wordstyle.css +202 -31
  24. data/lib/isodoc/iso/html/wordstyle.scss +194 -32
  25. data/lib/isodoc/iso/iso.amendment.xsl +666 -193
  26. data/lib/isodoc/iso/iso.international-standard.xsl +666 -193
  27. data/lib/isodoc/iso/metadata.rb +3 -2
  28. data/lib/isodoc/iso/presentation_xml_convert.rb +15 -14
  29. data/lib/isodoc/iso/sts_convert.rb +10 -13
  30. data/lib/isodoc/iso/word_convert.rb +153 -39
  31. data/lib/isodoc/iso/xref.rb +44 -29
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +3 -3
  35. data/spec/asciidoctor/base_spec.rb +426 -305
  36. data/spec/asciidoctor/blocks_spec.rb +96 -34
  37. data/spec/asciidoctor/cleanup_spec.rb +383 -25
  38. data/spec/asciidoctor/section_spec.rb +0 -14
  39. data/spec/asciidoctor/validate_spec.rb +218 -83
  40. data/spec/isodoc/amd_spec.rb +193 -201
  41. data/spec/isodoc/blocks_spec.rb +100 -88
  42. data/spec/isodoc/i18n_spec.rb +36 -36
  43. data/spec/isodoc/inline_spec.rb +2 -2
  44. data/spec/isodoc/iso_spec.rb +86 -138
  45. data/spec/isodoc/postproc_spec.rb +492 -442
  46. data/spec/isodoc/ref_spec.rb +6 -6
  47. data/spec/isodoc/section_spec.rb +301 -306
  48. data/spec/isodoc/table_spec.rb +166 -231
  49. data/spec/isodoc/terms_spec.rb +11 -8
  50. data/spec/isodoc/xref_spec.rb +147 -118
  51. data/spec/spec_helper.rb +16 -15
  52. metadata +8 -7
@@ -88,11 +88,11 @@ RSpec.describe IsoDoc do
88
88
  <language current="true">en</language>
89
89
  </bibdata>
90
90
  <preface>
91
- <foreword obligation="informative">
91
+ <foreword obligation="informative" displayorder='1'>
92
92
  <title>Foreword</title>
93
93
  <p id="A">This is a preamble</p>
94
94
  </foreword>
95
- <introduction id="B" obligation="informative">
95
+ <introduction id="B" obligation="informative" displayorder='2'>
96
96
  <title depth="1">0<tab/>Introduction</title>
97
97
  <clause id="C" inline-header="false" obligation="informative">
98
98
  <title depth="2">0.1<tab/>Introduction Subsection</title>
@@ -101,11 +101,11 @@ RSpec.describe IsoDoc do
101
101
  </introduction>
102
102
  </preface>
103
103
  <sections>
104
- <clause id="D" obligation="normative" type="scope">
104
+ <clause id="D" obligation="normative" type="scope" displayorder='3'>
105
105
  <title depth="1">1<tab/>Scope</title>
106
106
  <p id="E">Text</p>
107
107
  </clause>
108
- <clause id="H" obligation="normative">
108
+ <clause id="H" obligation="normative" displayorder='5'>
109
109
  <title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title>
110
110
  <terms id="I" obligation="normative">
111
111
  <title depth="2">3.1<tab/>Normal Terms</title>
@@ -122,14 +122,14 @@ RSpec.describe IsoDoc do
122
122
  </dl>
123
123
  </definitions>
124
124
  </clause>
125
- <definitions id="L">
125
+ <definitions id="L" displayorder='6'>
126
126
  <title>4</title>
127
127
  <dl>
128
128
  <dt>Symbol</dt>
129
129
  <dd>Definition</dd>
130
130
  </dl>
131
131
  </definitions>
132
- <clause id="M" inline-header="false" obligation="normative">
132
+ <clause id="M" inline-header="false" obligation="normative" displayorder='7'>
133
133
  <title depth="1">5<tab/>Clause 4</title>
134
134
  <clause id="N" inline-header="false" obligation="normative">
135
135
  <title depth="2">5.1<tab/>Introduction</title>
@@ -139,7 +139,7 @@ RSpec.describe IsoDoc do
139
139
  </clause>
140
140
  </clause>
141
141
  </sections>
142
- <annex id="P" inline-header="false" obligation="normative">
142
+ <annex id="P" inline-header="false" obligation="normative" displayorder='8'>
143
143
  <title>
144
144
  <strong>Annex A</strong>
145
145
  <br/>(normative)
@@ -157,10 +157,10 @@ RSpec.describe IsoDoc do
157
157
  </appendix>
158
158
  </annex>
159
159
  <bibliography>
160
- <references id="R" normative="true" obligation="informative">
160
+ <references id="R" normative="true" obligation="informative" displayorder='4'>
161
161
  <title depth="1">2<tab/>Normative References</title>
162
162
  </references>
163
- <clause id="S" obligation="informative">
163
+ <clause id="S" obligation="informative" displayorder='9'>
164
164
  <title depth="1">Bibliography</title>
165
165
  <references id="T" normative="false" obligation="informative">
166
166
  <title depth="2">Bibliography Subsection</title>
@@ -341,11 +341,11 @@ RSpec.describe IsoDoc do
341
341
  <language current="true">tlh</language>
342
342
  </bibdata>
343
343
  <preface>
344
- <foreword obligation="informative">
344
+ <foreword obligation="informative" displayorder='1'>
345
345
  <title>Foreword</title>
346
346
  <p id="A">This is a preamble</p>
347
347
  </foreword>
348
- <introduction id="B" obligation="informative">
348
+ <introduction id="B" obligation="informative" displayorder='2'>
349
349
  <title depth="1">
350
350
  0
351
351
  <tab/>
@@ -358,11 +358,11 @@ RSpec.describe IsoDoc do
358
358
  </introduction>
359
359
  </preface>
360
360
  <sections>
361
- <clause id="D" obligation="normative" type="scope">
361
+ <clause id="D" obligation="normative" type="scope" displayorder='3'>
362
362
  <title depth="1">1<tab/>Scope</title>
363
363
  <p id="E">Text</p>
364
364
  </clause>
365
- <clause id="H" obligation="normative">
365
+ <clause id="H" obligation="normative" displayorder='5'>
366
366
  <title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title>
367
367
  <terms id="I" obligation="normative">
368
368
  <title depth="2">3.1<tab/>Normal Terms</title>
@@ -379,14 +379,14 @@ RSpec.describe IsoDoc do
379
379
  </dl>
380
380
  </definitions>
381
381
  </clause>
382
- <definitions id="L">
382
+ <definitions id="L" displayorder='6'>
383
383
  <title>4</title>
384
384
  <dl>
385
385
  <dt>Symbol</dt>
386
386
  <dd>Definition</dd>
387
387
  </dl>
388
388
  </definitions>
389
- <clause id="M" inline-header="false" obligation="normative">
389
+ <clause id="M" inline-header="false" obligation="normative" displayorder='7'>
390
390
  <title depth="1">5<tab/>Clause 4</title>
391
391
  <clause id="N" inline-header="false" obligation="normative">
392
392
  <title depth="2">5.1<tab/>Introduction</title>
@@ -396,7 +396,7 @@ RSpec.describe IsoDoc do
396
396
  </clause>
397
397
  </clause>
398
398
  </sections>
399
- <annex id="P" inline-header="false" obligation="normative">
399
+ <annex id="P" inline-header="false" obligation="normative" displayorder='8'>
400
400
  <title>
401
401
  <strong>Annex A</strong>
402
402
  <br/>(normative)
@@ -414,10 +414,10 @@ RSpec.describe IsoDoc do
414
414
  </appendix>
415
415
  </annex>
416
416
  <bibliography>
417
- <references id="R" normative="true" obligation="informative">
417
+ <references id="R" normative="true" obligation="informative" displayorder='4'>
418
418
  <title depth="1">2<tab/>Normative References</title>
419
419
  </references>
420
- <clause id="S" obligation="informative">
420
+ <clause id="S" obligation="informative" displayorder='9'>
421
421
  <title depth="1">Bibliography</title>
422
422
  <references id="T" normative="false" obligation="informative">
423
423
  <title depth="2">Bibliography Subsection</title>
@@ -515,11 +515,11 @@ RSpec.describe IsoDoc do
515
515
  <language current="true">fr</language>
516
516
  </bibdata>
517
517
  <preface>
518
- <foreword obligation="informative">
518
+ <foreword obligation="informative" displayorder='1'>
519
519
  <title>Foreword</title>
520
520
  <p id="A">This is a preamble</p>
521
521
  </foreword>
522
- <introduction id="B" obligation="informative">
522
+ <introduction id="B" obligation="informative" displayorder='2'>
523
523
  <title depth="1">0<tab/>Introduction</title>
524
524
  <clause id="C" inline-header="false" obligation="informative">
525
525
  <title depth="2">0.1<tab/>Introduction Subsection</title>
@@ -528,11 +528,11 @@ RSpec.describe IsoDoc do
528
528
  </introduction>
529
529
  </preface>
530
530
  <sections>
531
- <clause id="D" obligation="normative" type="scope">
531
+ <clause id="D" obligation="normative" type="scope" displayorder='3'>
532
532
  <title depth="1">1<tab/>Scope</title>
533
533
  <p id="E">Text</p>
534
534
  </clause>
535
- <clause id="H" obligation="normative">
535
+ <clause id="H" obligation="normative" displayorder='5'>
536
536
  <title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title>
537
537
  <terms id="I" obligation="normative">
538
538
  <title depth="2">3.1<tab/>Normal Terms</title>
@@ -549,14 +549,14 @@ RSpec.describe IsoDoc do
549
549
  </dl>
550
550
  </definitions>
551
551
  </clause>
552
- <definitions id="L">
552
+ <definitions id="L" displayorder='6'>
553
553
  <title>4</title>
554
554
  <dl>
555
555
  <dt>Symbol</dt>
556
556
  <dd>Definition</dd>
557
557
  </dl>
558
558
  </definitions>
559
- <clause id="M" inline-header="false" obligation="normative">
559
+ <clause id="M" inline-header="false" obligation="normative" displayorder='7'>
560
560
  <title depth="1">5<tab/>Clause 4</title>
561
561
  <clause id="N" inline-header="false" obligation="normative">
562
562
  <title depth="2">5.1<tab/>Introduction</title>
@@ -566,7 +566,7 @@ RSpec.describe IsoDoc do
566
566
  </clause>
567
567
  </clause>
568
568
  </sections>
569
- <annex id="P" inline-header="false" obligation="normative">
569
+ <annex id="P" inline-header="false" obligation="normative" displayorder='8'>
570
570
  <title>
571
571
  <strong>Annexe A</strong>
572
572
  <br/>(normative)
@@ -584,10 +584,10 @@ RSpec.describe IsoDoc do
584
584
  </appendix>
585
585
  </annex>
586
586
  <bibliography>
587
- <references id="R" normative="true" obligation="informative">
587
+ <references id="R" normative="true" obligation="informative" displayorder='4'>
588
588
  <title depth="1">2<tab/>Normative References</title>
589
589
  </references>
590
- <clause id="S" obligation="informative">
590
+ <clause id="S" obligation="informative" displayorder='9'>
591
591
  <title depth="1">Bibliography</title>
592
592
  <references id="T" normative="false" obligation="informative">
593
593
  <title depth="2">Bibliography Subsection</title>
@@ -796,11 +796,11 @@ RSpec.describe IsoDoc do
796
796
  <script current="true">Hans</script>
797
797
  </bibdata>
798
798
  <preface>
799
- <foreword obligation="informative">
799
+ <foreword obligation="informative" displayorder='1'>
800
800
  <title>Foreword</title>
801
801
  <p id="A">This is a preamble</p>
802
802
  </foreword>
803
- <introduction id="B" obligation="informative">
803
+ <introduction id="B" obligation="informative" displayorder='2'>
804
804
  <title depth="1">0
805
805
  <tab/>
806
806
  Introduction</title>
@@ -813,7 +813,7 @@ RSpec.describe IsoDoc do
813
813
  </introduction>
814
814
  </preface>
815
815
  <sections>
816
- <clause id="D" obligation="normative" type="scope">
816
+ <clause id="D" obligation="normative" type="scope" displayorder='3'>
817
817
  <title depth="1">1
818
818
  <tab/>
819
819
  Scope</title>
@@ -821,7 +821,7 @@ RSpec.describe IsoDoc do
821
821
  <eref bibitemid="ISO712" type="inline"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712、第1–1表</eref>
822
822
  </p>
823
823
  </clause>
824
- <clause id="H" obligation="normative">
824
+ <clause id="H" obligation="normative" displayorder='5'>
825
825
  <title depth="1">3
826
826
  <tab/>
827
827
  Terms, definitions, symbols and abbreviated terms</title>
@@ -842,14 +842,14 @@ RSpec.describe IsoDoc do
842
842
  </dl>
843
843
  </definitions>
844
844
  </clause>
845
- <definitions id="L">
845
+ <definitions id="L" displayorder='6'>
846
846
  <title>4</title>
847
847
  <dl>
848
848
  <dt>Symbol</dt>
849
849
  <dd>Definition</dd>
850
850
  </dl>
851
851
  </definitions>
852
- <clause id="M" inline-header="false" obligation="normative">
852
+ <clause id="M" inline-header="false" obligation="normative" displayorder='7'>
853
853
  <title depth="1">5
854
854
  <tab/>
855
855
  Clause 4</title>
@@ -865,7 +865,7 @@ RSpec.describe IsoDoc do
865
865
  </clause>
866
866
  </clause>
867
867
  </sections>
868
- <annex id="P" inline-header="false" obligation="normative">
868
+ <annex id="P" inline-header="false" obligation="normative" displayorder='8'>
869
869
  <title>
870
870
  <strong>附件A</strong>
871
871
  <br/>(规范性附录)
@@ -889,7 +889,7 @@ RSpec.describe IsoDoc do
889
889
  </appendix>
890
890
  </annex>
891
891
  <bibliography>
892
- <references id="R" normative="true" obligation="informative">
892
+ <references id="R" normative="true" obligation="informative" displayorder='4'>
893
893
  <title depth="1">2
894
894
  <tab/>
895
895
  Normative References</title>
@@ -904,7 +904,7 @@ RSpec.describe IsoDoc do
904
904
  </contributor>
905
905
  </bibitem>
906
906
  </references>
907
- <clause id="S" obligation="informative">
907
+ <clause id="S" obligation="informative" displayorder='9'>
908
908
  <title depth="1">Bibliography</title>
909
909
  <references id="T" normative="false" obligation="informative">
910
910
  <title depth="2">Bibliography Subsection</title>
@@ -318,7 +318,7 @@ RSpec.describe IsoDoc do
318
318
  <?xml version='1.0'?>
319
319
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
320
320
  <preface>
321
- <foreword>
321
+ <foreword displayorder="1">
322
322
  <p>
323
323
  <eref bibitemid="IEV" citeas="IEV" type="inline">
324
324
  <locality type="clause">
@@ -372,7 +372,7 @@ RSpec.describe IsoDoc do
372
372
  </foreword>
373
373
  </preface>
374
374
  <bibliography>
375
- <references id="_normative_references" normative="true" obligation="informative">
375
+ <references id="_normative_references" normative="true" obligation="informative" displayorder="2">
376
376
  <title depth="1">1<tab/>
377
377
  Normative References</title>
378
378
  <bibitem id="ISO712" type="standard">
@@ -177,8 +177,8 @@ RSpec.describe IsoDoc::Iso do
177
177
  OUTPUT
178
178
  end
179
179
 
180
- it "processes examples (Presentation XML)" do
181
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
180
+ it "processes examples" do
181
+ input = <<~INPUT
182
182
  <iso-standard xmlns="http://riboseinc.com/isoxml">
183
183
  <preface>
184
184
  <foreword>
@@ -190,11 +190,11 @@ RSpec.describe IsoDoc::Iso do
190
190
  </preface>
191
191
  </iso-standard>
192
192
  INPUT
193
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
193
+ presxml = <<~OUTPUT
194
194
  <?xml version='1.0'?>
195
195
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
196
196
  <preface>
197
- <foreword>
197
+ <foreword displayorder="1">
198
198
  <example id="samplecode">
199
199
  <name>EXAMPLE — Title</name>
200
200
  <p>Hello</p>
@@ -203,22 +203,8 @@ RSpec.describe IsoDoc::Iso do
203
203
  </preface>
204
204
  </iso-standard>
205
205
  OUTPUT
206
- end
207
206
 
208
- it "processes examples (HTML)" do
209
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
210
- <iso-standard xmlns="http://riboseinc.com/isoxml">
211
- <preface>
212
- <foreword>
213
- <example id="samplecode">
214
- <name>EXAMPLE — Title</name>
215
- <p>Hello</p>
216
- </example>
217
- </foreword>
218
- </preface>
219
- </iso-standard>
220
- INPUT
221
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
207
+ html = <<~OUTPUT
222
208
  #{HTML_HDR}
223
209
  <br/>
224
210
  <div>
@@ -232,10 +218,49 @@ RSpec.describe IsoDoc::Iso do
232
218
  </body>
233
219
  </html>
234
220
  OUTPUT
221
+
222
+ word = <<~OUTPUT
223
+ <body lang="EN-US" link="blue" vlink="#954F72">
224
+ <div class="WordSection1">
225
+ <p>&#160;</p>
226
+ </div>
227
+ <p>
228
+ <br clear="all" class="section"/>
229
+ </p>
230
+ <div class="WordSection2">
231
+ <p>
232
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
233
+ </p>
234
+ <div>
235
+ <h1 class="ForewordTitle">Foreword</h1>
236
+ <div id="samplecode" class="example">
237
+ <p><span class="example_label">EXAMPLE&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
238
+ </div>
239
+ </div>
240
+ <p>&#160;</p>
241
+ </div>
242
+ <p>
243
+ <br clear="all" class="section"/>
244
+ </p>
245
+ <div class="WordSection3">
246
+ <p class="zzSTDTitle1"/>
247
+ </div>
248
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
249
+ <div class="colophon"/>
250
+ </body>
251
+ OUTPUT
252
+ expect(IsoDoc::Iso::PresentationXMLConvert.new({})
253
+ .convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
254
+ expect(IsoDoc::Iso::HtmlConvert.new({})
255
+ .convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
256
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
257
+ expect(xmlpp(output
258
+ .sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
259
+ .to be_equivalent_to xmlpp(word)
235
260
  end
236
261
 
237
- it "processes sequences of examples (Presentation XML)" do
238
- output = IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
262
+ it "processes sequences of examples" do
263
+ input = <<~INPUT
239
264
  <iso-standard xmlns="http://riboseinc.com/isoxml">
240
265
  <preface>
241
266
  <foreword>
@@ -250,11 +275,11 @@ RSpec.describe IsoDoc::Iso do
250
275
  </preface>
251
276
  </iso-standard>
252
277
  INPUT
253
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
278
+ presxml = <<~OUTPUT
254
279
  <?xml version='1.0'?>
255
280
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
256
281
  <preface>
257
- <foreword>
282
+ <foreword displayorder="1">
258
283
  <example id="samplecode">
259
284
  <name>EXAMPLE 1</name>
260
285
  <quote>Hello</quote>
@@ -267,26 +292,7 @@ RSpec.describe IsoDoc::Iso do
267
292
  </preface>
268
293
  </iso-standard>
269
294
  OUTPUT
270
- end
271
-
272
- it "processes sequences of examples (HTML)" do
273
- output = IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)
274
- <iso-standard xmlns="http://riboseinc.com/isoxml">
275
- <preface>
276
- <foreword>
277
- <example id="samplecode">
278
- <name>EXAMPLE 1</name>
279
- <quote>Hello</quote>
280
- </example>
281
- <example id="samplecode2">
282
- <name>EXAMPLE 2 — Title</name>
283
- <p>Hello</p>
284
- </example>
285
- </foreword>
286
- </preface>
287
- </iso-standard>
288
- INPUT
289
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
295
+ html = <<~OUTPUT
290
296
  #{HTML_HDR}
291
297
  <br/>
292
298
  <div>
@@ -304,105 +310,47 @@ RSpec.describe IsoDoc::Iso do
304
310
  </body>
305
311
  </html>
306
312
  OUTPUT
307
- end
308
-
309
- it "processes examples (Word)" do
310
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
311
- <iso-standard xmlns="http://riboseinc.com/isoxml">
312
- <preface>
313
- <foreword>
314
- <example id="samplecode">
315
- <name>EXAMPLE — Title</name>
316
- <p>Hello</p>
317
- </example>
318
- </foreword>
319
- </preface>
320
- </iso-standard>
321
- INPUT
322
- expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
323
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
324
- <body lang="EN-US" link="blue" vlink="#954F72">
325
- <div class="WordSection1">
326
- <p>&#160;</p>
327
- </div>
313
+ word = <<~OUTPUT
314
+ <body lang="EN-US" link="blue" vlink="#954F72">
315
+ <div class="WordSection1">
316
+ <p>&#160;</p>
317
+ </div>
318
+ <p>
319
+ <br clear="all" class="section"/>
320
+ </p>
321
+ <div class="WordSection2">
328
322
  <p>
329
- <br clear="all" class="section"/>
323
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
330
324
  </p>
331
- <div class="WordSection2">
332
- <p>
333
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
334
- </p>
335
- <div>
336
- <h1 class="ForewordTitle">Foreword</h1>
337
- <div id="samplecode" class="example">
338
- <p><span class="example_label">EXAMPLE&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
339
- </div>
325
+ <div>
326
+ <h1 class="ForewordTitle">Foreword</h1>
327
+ <div id="samplecode" class="example">
328
+ <p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span></p>
329
+ <div class="Quote">Hello</div>
340
330
  </div>
341
- <p>&#160;</p>
342
- </div>
343
- <p>
344
- <br clear="all" class="section"/>
345
- </p>
346
- <div class="WordSection3">
347
- <p class="zzSTDTitle1"/>
348
- </div>
349
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
350
- <div class="colophon"/>
351
- </body>
352
- OUTPUT
353
- end
354
-
355
- it "processes sequences of examples (Word)" do
356
- output = IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true)
357
- <iso-standard xmlns="http://riboseinc.com/isoxml">
358
- <preface>
359
- <foreword>
360
- <example id="samplecode">
361
- <name>EXAMPLE 1</name>
362
- <quote>Hello</quote>
363
- </example>
364
- <example id="samplecode2">
365
- <name>EXAMPLE 2 — Title</name>
366
- <p>Hello</p>
367
- </example>
368
- </foreword>
369
- </preface>
370
- </iso-standard>
371
- INPUT
372
- expect(xmlpp(output.sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
373
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
374
- <body lang="EN-US" link="blue" vlink="#954F72">
375
- <div class="WordSection1">
376
- <p>&#160;</p>
377
- </div>
378
- <p>
379
- <br clear="all" class="section"/>
380
- </p>
381
- <div class="WordSection2">
382
- <p>
383
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
384
- </p>
385
- <div>
386
- <h1 class="ForewordTitle">Foreword</h1>
387
- <div id="samplecode" class="example">
388
- <p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span></p>
389
- <div class="Quote">Hello</div>
390
- </div>
391
- <div id="samplecode2" class="example">
392
- <p><span class="example_label">EXAMPLE 2&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
393
- </div>
331
+ <div id="samplecode2" class="example">
332
+ <p><span class="example_label">EXAMPLE 2&#160;&#8212; Title</span><span style="mso-tab-count:1">&#160; </span>Hello</p>
394
333
  </div>
395
- <p>&#160;</p>
396
334
  </div>
397
- <p>
398
- <br clear="all" class="section"/>
399
- </p>
400
- <div class="WordSection3">
401
- <p class="zzSTDTitle1"/>
402
- </div>
403
- <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
404
- <div class="colophon"/>
405
- </body>
406
- OUTPUT
335
+ <p>&#160;</p>
336
+ </div>
337
+ <p>
338
+ <br clear="all" class="section"/>
339
+ </p>
340
+ <div class="WordSection3">
341
+ <p class="zzSTDTitle1"/>
342
+ </div>
343
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
344
+ <div class="colophon"/>
345
+ </body>
346
+ OUTPUT
347
+ expect(IsoDoc::Iso::PresentationXMLConvert.new({})
348
+ .convert("test", input, true)).to be_equivalent_to xmlpp(presxml)
349
+ expect(IsoDoc::Iso::HtmlConvert.new({})
350
+ .convert("test", presxml, true)).to be_equivalent_to xmlpp(html)
351
+ output = IsoDoc::Iso::WordConvert.new({}).convert("test", presxml, true)
352
+ expect(xmlpp(output
353
+ .sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")))
354
+ .to be_equivalent_to xmlpp(word)
407
355
  end
408
356
  end