isodoc 1.1.4 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc-yaml/i18n-en.yaml +4 -1
  3. data/lib/isodoc-yaml/i18n-fr.yaml +4 -1
  4. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +4 -1
  5. data/lib/isodoc.rb +1 -0
  6. data/lib/isodoc/common.rb +0 -2
  7. data/lib/isodoc/convert.rb +33 -27
  8. data/lib/isodoc/function/blocks.rb +10 -22
  9. data/lib/isodoc/function/blocks_example_note.rb +14 -15
  10. data/lib/isodoc/function/cleanup.rb +5 -4
  11. data/lib/isodoc/function/inline.rb +6 -76
  12. data/lib/isodoc/function/references.rb +10 -9
  13. data/lib/isodoc/function/reqt.rb +12 -11
  14. data/lib/isodoc/function/section.rb +39 -54
  15. data/lib/isodoc/function/table.rb +1 -6
  16. data/lib/isodoc/function/terms.rb +13 -6
  17. data/lib/isodoc/function/to_word_html.rb +1 -0
  18. data/lib/isodoc/function/utils.rb +4 -3
  19. data/lib/isodoc/html_function/html.rb +0 -1
  20. data/lib/isodoc/{function/i18n.rb → i18n.rb} +37 -36
  21. data/lib/isodoc/metadata.rb +4 -3
  22. data/lib/isodoc/metadata_date.rb +1 -1
  23. data/lib/isodoc/presentation_function/block.rb +138 -0
  24. data/lib/isodoc/presentation_function/inline.rb +131 -0
  25. data/lib/isodoc/presentation_function/section.rb +46 -0
  26. data/lib/isodoc/presentation_xml_convert.rb +38 -5
  27. data/lib/isodoc/version.rb +1 -1
  28. data/lib/isodoc/word_function/body.rb +12 -8
  29. data/lib/isodoc/word_function/inline.rb +3 -1
  30. data/lib/isodoc/xref.rb +5 -3
  31. data/lib/isodoc/xref/xref_sect_gen.rb +3 -3
  32. data/spec/assets/i18n.yaml +12 -1
  33. data/spec/isodoc/blocks_spec.rb +1101 -147
  34. data/spec/isodoc/cleanup_spec.rb +2 -2
  35. data/spec/isodoc/footnotes_spec.rb +2 -2
  36. data/spec/isodoc/i18n_spec.rb +679 -110
  37. data/spec/isodoc/inline_spec.rb +323 -142
  38. data/spec/isodoc/lists_spec.rb +2 -2
  39. data/spec/isodoc/postproc_spec.rb +1311 -1333
  40. data/spec/isodoc/ref_spec.rb +181 -3
  41. data/spec/isodoc/section_spec.rb +508 -680
  42. data/spec/isodoc/table_spec.rb +155 -4
  43. data/spec/isodoc/terms_spec.rb +111 -79
  44. data/spec/isodoc/xref_spec.rb +1569 -1186
  45. metadata +6 -3
@@ -1,6 +1,62 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
+ it "cases xrefs" do
5
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <sections>
8
+ <clause id="A">
9
+ <table id="B">
10
+ </table>
11
+ </clause>
12
+ <clause id="C">
13
+ <p>This is <xref target="A"/> and <xref target="B"/>.
14
+ This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
15
+ <xref target="A"/> is clause <em>initial.</em><br/>
16
+ <xref target="A"/> is too. </p>
17
+ <p><xref target="A"/> is also.</p>
18
+ </clause>
19
+ </sections>
20
+ </iso-standard>
21
+ INPUT
22
+ <?xml version='1.0'?>
23
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
24
+ <sections>
25
+ <clause id='A'>
26
+ <title>1.</title>
27
+ <table id='B'>
28
+ <name>Tabelo 1</name>
29
+ </table>
30
+ </clause>
31
+ <clause id='C'>
32
+ <title>2.</title>
33
+ <p>
34
+ This is
35
+ <xref target='A'>kla&#x16D;zo 1</xref>
36
+ and
37
+ <xref target='B'>Tabelo 1</xref>
38
+ . This is
39
+ <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
40
+ and
41
+ <xref target='B' case='lowercase'>tabelo 1</xref>
42
+ .
43
+ <xref target='A'>Kla&#x16D;zo 1</xref>
44
+ is clause
45
+ <em>initial.</em>
46
+ <br/>
47
+ <xref target='A'>Kla&#x16D;zo 1</xref>
48
+ is too.
49
+ </p>
50
+ <p>
51
+ <xref target='A'>Kla&#x16D;zo 1</xref>
52
+ is also.
53
+ </p>
54
+ </clause>
55
+ </sections>
56
+ </iso-standard>
57
+ OUTPUT
58
+ end
59
+
4
60
  it "processes inline formatting" do
5
61
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
62
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -96,8 +152,8 @@ RSpec.describe IsoDoc do
96
152
  OUTPUT
97
153
  end
98
154
 
99
- it "processes concept markup" do
100
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
155
+ it "processes concept markup" do
156
+ input = <<~INPUT
101
157
  <iso-standard xmlns="http://riboseinc.com/isoxml">
102
158
  <preface><foreword>
103
159
  <p>
@@ -181,57 +237,120 @@ RSpec.describe IsoDoc do
181
237
  </references></bibliography>
182
238
  </iso-standard>
183
239
  INPUT
240
+ presxml = <<~OUTPUT
241
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
242
+ <preface><foreword>
243
+ <p>
244
+ <ul>
245
+ <li><concept term="term">
246
+ <xref target="clause1">Clause 2</xref>
247
+ </concept></li>
248
+ <li><concept term="term">
249
+ <xref target="clause1">w[o]rd</xref>
250
+ </concept></li>
251
+ <li><concept term="term">
252
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>
253
+ </concept></li>
254
+ <li><concept term="term">
255
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
256
+ </concept></li>
257
+ <li><concept>
258
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
259
+ <referenceFrom>3.1</referenceFrom>
260
+ </locality><locality type="figure">
261
+ <referenceFrom>a</referenceFrom>
262
+ </locality>ISO 712, Clause 3.1, Figure a</eref>
263
+ </concept></li>
264
+ <li><concept>
265
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
266
+ <locality type="clause">
267
+ <referenceFrom>3.1</referenceFrom>
268
+ </locality>
269
+ </localityStack><localityStack>
270
+ <locality type="figure">
271
+ <referenceFrom>b</referenceFrom>
272
+ </locality>
273
+ </localityStack>ISO 712, Clause 3.1; Figure b</eref>
274
+ </concept></li>
275
+ <li><concept>
276
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
277
+ <localityStack>
278
+ <locality type="clause">
279
+ <referenceFrom>3.1</referenceFrom>
280
+ </locality>
281
+ </localityStack>
282
+ <localityStack>
283
+ <locality type="figure">
284
+ <referenceFrom>b</referenceFrom>
285
+ </locality>
286
+ </localityStack>
287
+ <em>word</em>
288
+ </eref>
289
+ </concept></li>
290
+ <li><concept term="term">
291
+ <termref base="IEV" target="135-13-13"/>
292
+ </concept></li>
293
+ <li><concept term="term">
294
+ <termref base="IEV" target="135-13-13"><em>word</em> word</termref>
295
+ </concept></li>
296
+ </ul>
297
+ </p>
298
+ </foreword></preface>
299
+ <sections>
300
+ <clause id="clause1"><title depth='1'>2.<tab/>Clause 1</title>
301
+ </clause>
302
+ </sections>
303
+ <bibliography><references id="_normative_references" obligation="informative" normative="true">
304
+ <title depth='1'>1.<tab/>Normative References</title>
305
+ <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>
306
+ <bibitem id="ISO712" type="standard">
307
+ <title format="text/plain">Cereals or cereal products</title>
308
+ <title type="main" format="text/plain">Cereals and cereal products</title>
309
+ <docidentifier type="ISO">ISO 712</docidentifier>
310
+ <contributor>
311
+ <role type="publisher"/>
312
+ <organization>
313
+ <name>International Organization for Standardization</name>
314
+ </organization>
315
+ </contributor>
316
+ </bibitem>
317
+ </references></bibliography>
318
+ </iso-standard>
319
+ OUTPUT
320
+
321
+ html = <<~OUTPUT
184
322
  #{HTML_HDR}
185
323
  <br/>
186
- <div>
187
- <h1 class='ForewordTitle'>Foreword</h1>
188
- <p>
189
- <ul>
190
- <li>
191
- [Term defined in <a href='#clause1'>Clause 2</a>]
192
- </li>
193
- <li>w[o]rd</li>
194
- <li>
195
- [Term defined in <a href='#ISO712'>ISO 712</a>]
196
- </li>
197
- <li>word</li>
198
- <li>
199
- [Term defined in <a href='#ISO712'>ISO 712, Clause 3.1, Figure a</a>]
200
- </li>
201
- <li>
202
- [Term defined in <a href='#ISO712'>ISO 712, Clause 3.1; Figure b</a>]
203
- </li>
204
- <li>
205
- <i>word</i>
206
- </li>
207
- <li>[Term defined in Termbase IEV, term ID 135-13-13]</li>
208
- <li>
209
- <i>word</i> word
210
- </li>
211
- </ul>
212
- </p>
213
- </div>
214
- <p class='zzSTDTitle1'/>
215
- <div>
216
- <h1>1.&#160; Normative references</h1>
324
+ <div>
325
+ <h1 class="ForewordTitle">Foreword</h1>
217
326
  <p>
218
- The following documents are referred to in the text in such a way that
219
- some or all of their content constitutes requirements of this
220
- document. For dated references, only the edition cited applies. For
221
- undated references, the latest edition of the referenced document
222
- (including any amendments) applies.
223
- </p>
224
- <p id='ISO712' class='NormRef'>
225
- ISO 712, <i>Cereals and cereal products</i>
226
- </p>
327
+ <ul>
328
+ <li>Clause 2</li>
329
+ <li>w[o]rd</li>
330
+ <li>ISO 712</li>
331
+ <li>word</li>
332
+ <li>ISO 712, Clause 3.1, Figure a</li>
333
+ <li>ISO 712, Clause 3.1; Figure b</li>
334
+ <li><i>word</i></li>
335
+ <li>[Term defined in Termbase IEV, term ID 135-13-13]</li>
336
+ <li><i>word</i> word</li>
337
+ </ul>
338
+ </p>
227
339
  </div>
228
- <div id='clause1'>
340
+ <p class="zzSTDTitle1"/>
341
+ <div><h1>1.&#160; Normative References</h1>
342
+ <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>
343
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
344
+ </div>
345
+ <div id="clause1">
229
346
  <h1>2.&#160; Clause 1</h1>
230
347
  </div>
231
348
  </div>
232
349
  </body>
233
350
  </html>
234
351
  OUTPUT
352
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
353
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
235
354
  end
236
355
 
237
356
  it "processes embedded inline formatting" do
@@ -239,7 +358,7 @@ OUTPUT
239
358
  <iso-standard xmlns="http://riboseinc.com/isoxml">
240
359
  <preface><foreword>
241
360
  <p>
242
- <em><strong>&lt;</strong></em> <tt><link target="B"/></tt> <xref target="_http_1_1">Requirement <tt>/req/core/http</tt></xref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712">Requirement <tt>/req/core/http</tt></eref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712"><locality type="section"><referenceFrom>3.1</referenceFrom></locality></eref>
361
+ <em><strong>&lt;</strong></em> <tt><link target="B"/></tt> <xref target="_http_1_1">Requirement <tt>/req/core/http</tt></xref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712">Requirement <tt>/req/core/http</tt></eref>
243
362
  </p>
244
363
  </foreword></preface>
245
364
  <sections>
@@ -250,7 +369,7 @@ OUTPUT
250
369
  <div>
251
370
  <h1 class="ForewordTitle">Foreword</h1>
252
371
  <p>
253
- <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">ISO 712, Section 3.1</a>
372
+ <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
254
373
  </p>
255
374
  </div>
256
375
  <p class="zzSTDTitle1"/>
@@ -440,8 +559,8 @@ OUTPUT
440
559
  </div>
441
560
  <p class="zzSTDTitle1"/>
442
561
  <div>
443
- <h1>1.&#160; Normative references</h1>
444
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
562
+ <h1>Normative References</h1>
563
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
445
564
  </div>
446
565
  </div>
447
566
  </body>
@@ -450,7 +569,7 @@ OUTPUT
450
569
  end
451
570
 
452
571
  it "processes eref content" do
453
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
572
+ input = <<~INPUT
454
573
  <iso-standard xmlns="http://riboseinc.com/isoxml">
455
574
  <preface><foreword>
456
575
  <p>
@@ -486,6 +605,44 @@ OUTPUT
486
605
  </bibliography>
487
606
  </iso-standard>
488
607
  INPUT
608
+ presxml = <<~OUTPUT
609
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
610
+ <preface><foreword>
611
+ <p>
612
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
613
+ <eref type="inline" bibitemid="ISO712">ISO 712</eref>
614
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
615
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
616
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
617
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
618
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
619
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
620
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
621
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
622
+ <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
623
+ <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
624
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
625
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
626
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
627
+ </p>
628
+ </foreword></preface>
629
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth='1'>1.<tab/>Normative References</title>
630
+ <bibitem id="ISO712" type="standard">
631
+ <title format="text/plain">Cereals and cereal products</title>
632
+ <docidentifier>ISO 712</docidentifier>
633
+ <contributor>
634
+ <role type="publisher"/>
635
+ <organization>
636
+ <abbreviation>ISO</abbreviation>
637
+ </organization>
638
+ </contributor>
639
+ </bibitem>
640
+ </references>
641
+ </bibliography>
642
+ </iso-standard>
643
+ OUTPUT
644
+
645
+ html = <<~OUTPUT
489
646
  #{HTML_HDR}
490
647
  <br/>
491
648
  <div>
@@ -510,17 +667,19 @@ OUTPUT
510
667
  </div>
511
668
  <p class="zzSTDTitle1"/>
512
669
  <div>
513
- <h1>1.&#160; Normative references</h1>
670
+ <h1>1.&#160; Normative References</h1>
514
671
  <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
515
672
  </div>
516
673
  </div>
517
674
  </body>
518
675
  </html>
519
676
  OUTPUT
677
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
678
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
520
679
  end
521
680
 
522
- it "processes eref content pointing to reference with citation URL" do
523
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
681
+ it "processes eref content pointing to reference with citation URL" do
682
+ input = <<~INPUT
524
683
  <iso-standard xmlns="http://riboseinc.com/isoxml">
525
684
  <preface><foreword>
526
685
  <p>
@@ -568,6 +727,73 @@ OUTPUT
568
727
  </bibliography>
569
728
  </iso-standard>
570
729
  INPUT
730
+ presxml = <<~OUTPUT
731
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
732
+ <preface>
733
+ <foreword>
734
+ <p>
735
+ <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
736
+ <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
737
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
738
+ <referenceFrom>1</referenceFrom>
739
+ </locality>ISO 713, Table 1</eref>
740
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
741
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1; Clause 1</eref>
742
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
743
+ <referenceFrom>1</referenceFrom>
744
+ <referenceTo>1</referenceTo>
745
+ </locality>ISO 713, Table 1&#x2013;1</eref>
746
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'><referenceFrom>1</referenceFrom></locality><locality type='table'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1, Table 1</eref>
747
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
748
+ <referenceFrom>1</referenceFrom>
749
+ </locality>ISO 713, Clause 1</eref>
750
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
751
+ <referenceFrom>1.5</referenceFrom>
752
+ </locality>ISO 713, Clause 1.5</eref>
753
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
754
+ <referenceFrom>1</referenceFrom>
755
+ </locality>A</eref>
756
+ <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
757
+ <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
758
+ <referenceFrom>7</referenceFrom>
759
+ </locality>ISO 713, Prelude 7</eref>
760
+ <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
761
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
762
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
763
+ </p>
764
+ </foreword>
765
+ </preface>
766
+ <bibliography>
767
+ <references id='_normative_references' obligation='informative' normative='true'>
768
+ <title depth='1'>1.<tab/>Normative References</title>
769
+ <bibitem id='ISO712' type='standard'>
770
+ <title format='text/plain'>Cereals and cereal products</title>
771
+ <uri type='citation'>http://www.example.com</uri>
772
+ <docidentifier>ISO 712</docidentifier>
773
+ <contributor>
774
+ <role type='publisher'/>
775
+ <organization>
776
+ <abbreviation>ISO</abbreviation>
777
+ </organization>
778
+ </contributor>
779
+ </bibitem>
780
+ <bibitem id='ISO713' type='standard'>
781
+ <title format='text/plain'>Cereals and cereal products</title>
782
+ <uri type='citation'>spec/assets/iso713</uri>
783
+ <docidentifier>ISO 713</docidentifier>
784
+ <contributor>
785
+ <role type='publisher'/>
786
+ <organization>
787
+ <abbreviation>ISO</abbreviation>
788
+ </organization>
789
+ </contributor>
790
+ </bibitem>
791
+ </references>
792
+ </bibliography>
793
+ </iso-standard>
794
+ OUTPUT
795
+
796
+ html = <<~OUTPUT
571
797
  #{HTML_HDR}
572
798
  <br/>
573
799
  <div>
@@ -592,7 +818,7 @@ OUTPUT
592
818
  </div>
593
819
  <p class='zzSTDTitle1'/>
594
820
  <div>
595
- <h1>1.&#160; Normative references</h1>
821
+ <h1>1.&#160; Normative References</h1>
596
822
  <p id='ISO712' class='NormRef'>
597
823
  ISO 712,
598
824
  <i>Cereals and cereal products</i>
@@ -606,57 +832,8 @@ OUTPUT
606
832
  </body>
607
833
  </html>
608
834
  OUTPUT
609
- end
610
835
 
611
- it "processes eref content pointing to reference with citation URL (Word)" do
612
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
613
- <iso-standard xmlns="http://riboseinc.com/isoxml">
614
- <preface><foreword>
615
- <p>
616
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
617
- <eref type="inline" bibitemid="ISO712"/>
618
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
619
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
620
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
621
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
622
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
623
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
624
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
625
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
626
- <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
627
- <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
628
- <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
629
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
630
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
631
- </p>
632
- </foreword></preface>
633
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
634
- <bibitem id="ISO712" type="standard">
635
- <title format="text/plain">Cereals and cereal products</title>
636
- <uri type="citation">http://www.example.com</uri>
637
- <docidentifier>ISO 712</docidentifier>
638
- <contributor>
639
- <role type="publisher"/>
640
- <organization>
641
- <abbreviation>ISO</abbreviation>
642
- </organization>
643
- </contributor>
644
- </bibitem>
645
- <bibitem id="ISO713" type="standard">
646
- <title format="text/plain">Cereals and cereal products</title>
647
- <uri type="citation">spec/assets/iso713</uri>
648
- <docidentifier>ISO 713</docidentifier>
649
- <contributor>
650
- <role type="publisher"/>
651
- <organization>
652
- <abbreviation>ISO</abbreviation>
653
- </organization>
654
- </contributor>
655
- </bibitem>
656
- </references>
657
- </bibliography>
658
- </iso-standard>
659
- INPUT
836
+ word = <<~OUTPUT
660
837
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
661
838
  <head>
662
839
  <style>
@@ -701,11 +878,11 @@ OUTPUT
701
878
  <div class='WordSection3'>
702
879
  <p class='zzSTDTitle1'/>
703
880
  <div>
704
- <h1>
705
- 1.
706
- <span style='mso-tab-count:1'>&#160; </span>
707
- Normative references
708
- </h1>
881
+ <h1>
882
+ 1.
883
+ <span style='mso-tab-count:1'>&#160; </span>
884
+ Normative References
885
+ </h1>
709
886
  <p id='ISO712' class='NormRef'>
710
887
  ISO 712,
711
888
  <i>Cereals and cereal products</i>
@@ -720,6 +897,9 @@ OUTPUT
720
897
  </html>
721
898
 
722
899
  OUTPUT
900
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
901
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
902
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
723
903
  end
724
904
 
725
905
  it "processes variant" do
@@ -757,7 +937,7 @@ OUTPUT
757
937
  end
758
938
 
759
939
  it "cases xrefs" do
760
- expect(xmlpp(IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
940
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
761
941
  <iso-standard xmlns="http://riboseinc.com/isoxml">
762
942
  <sections>
763
943
  <clause id="A">
@@ -774,40 +954,41 @@ it "cases xrefs" do
774
954
  </sections>
775
955
  </iso-standard>
776
956
  INPUT
777
- #{HTML_HDR}
778
- <p class='zzSTDTitle1'/>
779
- <div id='A'>
780
- <h1>1.&#160; </h1>
781
- <p class='TableTitle' style='text-align:center;'>Tabelo 1</p>
782
- <table id='B' class='MsoISOTable' style='border-width:1px;border-spacing:0;'/>
783
- </div>
784
- <div id='C'>
785
- <h1>2.&#160; </h1>
786
- <p>
787
- This is
788
- <a href='#A'>kla&#365;zo 1</a>
789
- and
790
- <a href='#B'>Tabelo 1</a>
791
- . This is
792
- <a href='#A'>Kla&#365;zo 1</a>
793
- and
794
- <a href='#B'>tabelo 1</a>
795
- .
796
- <a href='#A'>Kla&#365;zo 1</a>
797
- is clause
798
- <i>initial.</i>
799
- <br/>
800
- <a href='#A'>Kla&#365;zo 1</a>
801
- is too.
802
- </p>
803
- <p>
804
- <a href='#A'>Kla&#365;zo 1</a>
805
- is also.
806
- </p>
807
- </div>
808
- </div>
809
- </body>
810
- </html>
957
+ <?xml version='1.0'?>
958
+ <iso-standard xmlns='http://riboseinc.com/isoxml'>
959
+ <sections>
960
+ <clause id='A'>
961
+ <title>1.</title>
962
+ <table id='B'>
963
+ <name>Tabelo 1</name>
964
+ </table>
965
+ </clause>
966
+ <clause id='C'>
967
+ <title>2.</title>
968
+ <p>
969
+ This is
970
+ <xref target='A'>kla&#x16D;zo 1</xref>
971
+ and
972
+ <xref target='B'>Tabelo 1</xref>
973
+ . This is
974
+ <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
975
+ and
976
+ <xref target='B' case='lowercase'>tabelo 1</xref>
977
+ .
978
+ <xref target='A'>Kla&#x16D;zo 1</xref>
979
+ is clause
980
+ <em>initial.</em>
981
+ <br/>
982
+ <xref target='A'>Kla&#x16D;zo 1</xref>
983
+ is too.
984
+ </p>
985
+ <p>
986
+ <xref target='A'>Kla&#x16D;zo 1</xref>
987
+ is also.
988
+ </p>
989
+ </clause>
990
+ </sections>
991
+ </iso-standard>
811
992
  OUTPUT
812
993
  end
813
994