isodoc 1.0.27 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +4 -8
  3. data/.github/workflows/ubuntu.yml +18 -16
  4. data/.github/workflows/windows.yml +4 -8
  5. data/Rakefile +3 -1
  6. data/isodoc.gemspec +2 -2
  7. data/lib/isodoc.rb +2 -0
  8. data/lib/isodoc/base_style/metanorma_word.scss +0 -1
  9. data/lib/isodoc/base_style/reset.scss +3 -3
  10. data/lib/isodoc/common.rb +0 -4
  11. data/lib/isodoc/convert.rb +121 -58
  12. data/lib/isodoc/function/blocks.rb +42 -53
  13. data/lib/isodoc/function/blocks_example_note.rb +108 -0
  14. data/lib/isodoc/function/cleanup.rb +8 -4
  15. data/lib/isodoc/function/i18n.rb +1 -0
  16. data/lib/isodoc/function/inline.rb +70 -90
  17. data/lib/isodoc/function/inline_simple.rb +72 -0
  18. data/lib/isodoc/function/lists.rb +12 -6
  19. data/lib/isodoc/function/references.rb +33 -38
  20. data/lib/isodoc/function/reqt.rb +14 -5
  21. data/lib/isodoc/function/section.rb +8 -11
  22. data/lib/isodoc/function/table.rb +4 -4
  23. data/lib/isodoc/function/terms.rb +3 -3
  24. data/lib/isodoc/function/to_word_html.rb +21 -13
  25. data/lib/isodoc/function/utils.rb +57 -50
  26. data/lib/isodoc/gem_tasks.rb +104 -0
  27. data/lib/isodoc/headlesshtml_convert.rb +7 -6
  28. data/lib/isodoc/html_convert.rb +2 -1
  29. data/lib/isodoc/html_function/footnotes.rb +1 -1
  30. data/lib/isodoc/html_function/html.rb +13 -1
  31. data/lib/isodoc/html_function/postprocess.rb +4 -4
  32. data/lib/isodoc/metadata.rb +74 -62
  33. data/lib/isodoc/pdf_convert.rb +8 -6
  34. data/lib/isodoc/presentation_xml_convert.rb +29 -0
  35. data/lib/isodoc/sassc_importer.rb +11 -0
  36. data/lib/isodoc/version.rb +1 -1
  37. data/lib/isodoc/word_convert.rb +2 -1
  38. data/lib/isodoc/word_function/body.rb +14 -48
  39. data/lib/isodoc/word_function/footnotes.rb +1 -1
  40. data/lib/isodoc/word_function/inline.rb +75 -0
  41. data/lib/isodoc/word_function/postprocess.rb +1 -0
  42. data/lib/isodoc/word_function/table.rb +3 -3
  43. data/lib/isodoc/xref.rb +59 -0
  44. data/lib/isodoc/{function → xref}/xref_anchor.rb +10 -21
  45. data/lib/isodoc/xref/xref_counter.rb +74 -0
  46. data/lib/isodoc/{function → xref}/xref_gen.rb +9 -22
  47. data/lib/isodoc/{function → xref}/xref_gen_seq.rb +41 -32
  48. data/lib/isodoc/{function → xref}/xref_sect_gen.rb +33 -23
  49. data/lib/isodoc/xslfo_convert.rb +16 -4
  50. data/spec/assets/{html.css → html.scss} +0 -0
  51. data/spec/assets/i18n.yaml +4 -1
  52. data/spec/assets/odf.emf +0 -0
  53. data/spec/assets/odf.svg +4 -0
  54. data/spec/assets/odf1.svg +4 -0
  55. data/spec/isodoc/blocks_spec.rb +219 -47
  56. data/spec/isodoc/cleanup_spec.rb +135 -6
  57. data/spec/isodoc/footnotes_spec.rb +22 -7
  58. data/spec/isodoc/inline_spec.rb +262 -2
  59. data/spec/isodoc/lists_spec.rb +8 -8
  60. data/spec/isodoc/metadata_spec.rb +110 -3
  61. data/spec/isodoc/postproc_spec.rb +1321 -1351
  62. data/spec/isodoc/presentation_xml_spec.rb +20 -0
  63. data/spec/isodoc/ref_spec.rb +119 -50
  64. data/spec/isodoc/section_spec.rb +84 -18
  65. data/spec/isodoc/table_spec.rb +6 -6
  66. data/spec/isodoc/terms_spec.rb +7 -7
  67. data/spec/isodoc/xref_spec.rb +165 -45
  68. metadata +36 -27
  69. data/lib/isodoc/function/blocks_example.rb +0 -53
  70. data/lib/isodoc/function/xref_counter.rb +0 -50
@@ -154,9 +154,9 @@ RSpec.describe IsoDoc do
154
154
  <br/>
155
155
  <div>
156
156
  <h1 class="ForewordTitle">Foreword</h1>
157
- <p>A.<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
158
- <p>B.<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
159
- <p>C.<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a></p>
157
+ <p>A.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
158
+ <p>B.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
159
+ <p>C.<a class="FootnoteRef" href="#fn:1" epub:type="footnote"><sup>1</sup></a></p>
160
160
  </div>
161
161
  <p class="zzSTDTitle1"/>
162
162
  <aside id="fn:2" class="footnote">
@@ -173,9 +173,9 @@ RSpec.describe IsoDoc do
173
173
  <br/>
174
174
  <div>
175
175
  <h1 class="ForewordTitle">Foreword</h1>
176
- <p>A.<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>1</sup></a></p>
177
- <p>B.<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
178
- <p>C.<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>3</sup></a></p>
176
+ <p>A.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>1</sup></a></p>
177
+ <p>B.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
178
+ <p>C.<a class="FootnoteRef" href="#fn:1" epub:type="footnote"><sup>3</sup></a></p>
179
179
  </div>
180
180
  <p class="zzSTDTitle1"/>
181
181
  <aside id="fn:2" class="footnote">
@@ -1056,4 +1056,133 @@ INPUT
1056
1056
  OUTPUT
1057
1057
  end
1058
1058
 
1059
+ it "cleans up term sources" do
1060
+ c = IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"})
1061
+ c.i18n_init("en", "Latn")
1062
+ expect(xmlpp(c.textcleanup(<<~"INPUT").to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
1063
+ #{HTML_HDR}
1064
+ <p class="zzSTDTitle1"/>
1065
+ <div id="_terms_and_definitions"><h1>1.&#160; Terms and Definitions</h1><p>For the purposes of this document,
1066
+ the following terms and definitions apply.</p>
1067
+ <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
1068
+
1069
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
1070
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p class="example-title">EXAMPLE 1</p>
1071
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1072
+ <ul>
1073
+ <li>A</li>
1074
+ </ul>
1075
+ </div>
1076
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p class="example-title">EXAMPLE 2</p>
1077
+ <ul>
1078
+ <li>A</li>
1079
+ </ul>
1080
+ </div>
1081
+
1082
+ <p>[TERMREF]
1083
+ <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
1084
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
1085
+ [/TERMREF]</p>
1086
+ <p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
1087
+ <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
1088
+ <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>
1089
+ <p class="AltTerms" style="text-align:left;">rough rice</p>
1090
+ <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
1091
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
1092
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p class="example-title">EXAMPLE</p>
1093
+ <ul>
1094
+ <li>A</li>
1095
+ </ul>
1096
+ </div>
1097
+ <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>
1098
+ <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>
1099
+ <p>[TERMREF]
1100
+ <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
1101
+ [/TERMREF]</p></div>
1102
+ </div>
1103
+ </body>
1104
+ </html>
1105
+ INPUT
1106
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1107
+ <head/>
1108
+ <body lang='en'>
1109
+ <div class='title-section'>
1110
+ <p>&#160;</p>
1111
+ </div>
1112
+ <br/>
1113
+ <div class='prefatory-section'>
1114
+ <p>&#160;</p>
1115
+ </div>
1116
+ <br/>
1117
+ <div class='main-section'>
1118
+ <p class='zzSTDTitle1'/>
1119
+ <div id='_terms_and_definitions'>
1120
+ <h1>1.&#160; Terms and Definitions</h1>
1121
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
1122
+ <p class='TermNum' id='paddy1'>1.1.</p>
1123
+ <p class='Terms' style='text-align:left;'>paddy</p>
1124
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p>
1125
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
1126
+ <p class='example-title'>EXAMPLE 1</p>
1127
+ <p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
1128
+ <ul>
1129
+ <li>A</li>
1130
+ </ul>
1131
+ </div>
1132
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
1133
+ <p class='example-title'>EXAMPLE 2</p>
1134
+ <ul>
1135
+ <li>A</li>
1136
+ </ul>
1137
+ </div>
1138
+ <p>
1139
+ [SOURCE:
1140
+ <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1141
+ , modified &mdash; The term "cargo rice" is shown as deprecated, and
1142
+ Note 1 to entry is not included here; Termbase IEV, term ID xyz;
1143
+ Termbase IEV, term ID xyz, modified &mdash; with adjustments]
1144
+ </p>
1145
+ <p class='TermNum' id='paddy'>1.2.</p>
1146
+ <p class='Terms' style='text-align:left;'>paddy</p>
1147
+ <p class='AltTerms' style='text-align:left;'>paddy rice</p>
1148
+ <p class='AltTerms' style='text-align:left;'>rough rice</p>
1149
+ <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
1150
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
1151
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
1152
+ <p class='example-title'>EXAMPLE</p>
1153
+ <ul>
1154
+ <li>A</li>
1155
+ </ul>
1156
+ </div>
1157
+ <div class='Note'>
1158
+ <p>
1159
+ Note 1 to entry: The starch of waxy rice consists almost entirely of
1160
+ amylopectin. The kernels have a tendency to stick together after
1161
+ cooking.
1162
+ </p>
1163
+ </div>
1164
+ <div class='Note'>
1165
+ <p>
1166
+ Note 2 to entry:
1167
+ <ul>
1168
+ <li>A</li>
1169
+ </ul>
1170
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
1171
+ The starch of waxy rice consists almost entirely of amylopectin.
1172
+ The kernels have a tendency to stick together after cooking.
1173
+ </p>
1174
+ </p>
1175
+ </div>
1176
+ <p>
1177
+ [SOURCE:
1178
+ <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1179
+ ]
1180
+ </p>
1181
+ </div>
1182
+ </div>
1183
+ </body>
1184
+ </html>
1185
+ OUTPUT
1186
+ end
1187
+
1059
1188
  end
@@ -24,9 +24,24 @@ RSpec.describe IsoDoc do
24
24
  <br/>
25
25
  <div>
26
26
  <h1 class="ForewordTitle">Foreword</h1>
27
- <p>A.<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
28
- <p>B.<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
29
- <p>C.<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a></p>
27
+ <p>
28
+ A.
29
+ <a class='FootnoteRef' href='#fn:2'>
30
+ <sup>2</sup>
31
+ </a>
32
+ </p>
33
+ <p>
34
+ B.
35
+ <a class='FootnoteRef' href='#fn:2'>
36
+ <sup>2</sup>
37
+ </a>
38
+ </p>
39
+ <p>
40
+ C.
41
+ <a class='FootnoteRef' href='#fn:1'>
42
+ <sup>1</sup>
43
+ </a>
44
+ </p>
30
45
  </div>
31
46
  <p class="zzSTDTitle1"/>
32
47
  <aside id="fn:2" class="footnote">
@@ -80,7 +95,7 @@ RSpec.describe IsoDoc do
80
95
  <p>
81
96
  A.
82
97
  <span style='mso-bookmark:_Ref'>
83
- <a href='#ftn2' epub:type='footnote'>
98
+ <a href='#ftn2' epub:type='footnote' class='FootnoteRef'>
84
99
  <sup>2</sup>
85
100
  </a>
86
101
  </span>
@@ -96,7 +111,7 @@ RSpec.describe IsoDoc do
96
111
  <p>
97
112
  C.
98
113
  <span style='mso-bookmark:_Ref'>
99
- <a href='#ftn1' epub:type='footnote'>
114
+ <a href='#ftn1' epub:type='footnote' class='FootnoteRef'>
100
115
  <sup>1</sup>
101
116
  </a>
102
117
  </span>
@@ -123,7 +138,7 @@ RSpec.describe IsoDoc do
123
138
 
124
139
  it "processes IsoXML reviewer notes (HTML)" do
125
140
  FileUtils.rm_f "test.html"
126
- IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
141
+ IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss"}).convert("test", <<~"INPUT", false)
127
142
  <iso-standard xmlns="http://riboseinc.com/isoxml">
128
143
  <preface>
129
144
  <foreword>
@@ -177,7 +192,7 @@ RSpec.describe IsoDoc do
177
192
 
178
193
  it "processes IsoXML reviewer notes (Word)" do
179
194
  FileUtils.rm_f "test.doc"
180
- IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
195
+ IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss"}).convert("test", <<~"INPUT", false)
181
196
  <iso-standard xmlns="http://riboseinc.com/isoxml">
182
197
  <preface>
183
198
  <foreword>
@@ -467,6 +467,8 @@ OUTPUT
467
467
  <eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
468
468
  <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
469
469
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
470
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
471
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
470
472
  </p>
471
473
  </foreword></preface>
472
474
  <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
@@ -499,9 +501,11 @@ OUTPUT
499
501
  <a href="#ISO712">ISO 712, Clause 1</a>
500
502
  <a href="#ISO712">ISO 712, Clause 1.5</a>
501
503
  <a href="#ISO712">A</a>
502
- <a href="#ISO712">ISO 712, </a>
504
+ <a href="#ISO712">ISO 712, Whole of text</a>
503
505
  <a href="#ISO712">ISO 712, Prelude 7</a>
504
506
  <a href="#ISO712">A</a>
507
+ <a href='#ISO712'>ISO 712</a>
508
+ <a href='#ISO712'>ISO 712, Clause 1</a>
505
509
  </p>
506
510
  </div>
507
511
  <p class="zzSTDTitle1"/>
@@ -515,6 +519,209 @@ OUTPUT
515
519
  OUTPUT
516
520
  end
517
521
 
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")
524
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
525
+ <preface><foreword>
526
+ <p>
527
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
528
+ <eref type="inline" bibitemid="ISO712"/>
529
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
530
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
531
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
532
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
533
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
534
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
535
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
536
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
537
+ <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
538
+ <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
539
+ <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
540
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
541
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
542
+ </p>
543
+ </foreword></preface>
544
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
545
+ <bibitem id="ISO712" type="standard">
546
+ <title format="text/plain">Cereals and cereal products</title>
547
+ <uri type="citation">http://www.example.com</uri>
548
+ <docidentifier>ISO 712</docidentifier>
549
+ <contributor>
550
+ <role type="publisher"/>
551
+ <organization>
552
+ <abbreviation>ISO</abbreviation>
553
+ </organization>
554
+ </contributor>
555
+ </bibitem>
556
+ <bibitem id="ISO713" type="standard">
557
+ <title format="text/plain">Cereals and cereal products</title>
558
+ <uri type="citation">spec/assets/iso713</uri>
559
+ <docidentifier>ISO 713</docidentifier>
560
+ <contributor>
561
+ <role type="publisher"/>
562
+ <organization>
563
+ <abbreviation>ISO</abbreviation>
564
+ </organization>
565
+ </contributor>
566
+ </bibitem>
567
+ </references>
568
+ </bibliography>
569
+ </iso-standard>
570
+ INPUT
571
+ #{HTML_HDR}
572
+ <br/>
573
+ <div>
574
+ <h1 class='ForewordTitle'>Foreword</h1>
575
+ <p>
576
+ <a href='http://www.example.com'>ISO 712</a>
577
+ <a href='http://www.example.com'>ISO 712</a>
578
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
579
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
580
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
581
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
582
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
583
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
584
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
585
+ <a href='spec/assets/iso713.html'>A</a>
586
+ <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
587
+ <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
588
+ <a href='spec/assets/iso713.html'>A</a>
589
+ <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
590
+ <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
591
+ </p>
592
+ </div>
593
+ <p class='zzSTDTitle1'/>
594
+ <div>
595
+ <h1>1.&#160; Normative references</h1>
596
+ <p id='ISO712' class='NormRef'>
597
+ ISO 712,
598
+ <i>Cereals and cereal products</i>
599
+ </p>
600
+ <p id='ISO713' class='NormRef'>
601
+ ISO 713,
602
+ <i>Cereals and cereal products</i>
603
+ </p>
604
+ </div>
605
+ </div>
606
+ </body>
607
+ </html>
608
+ OUTPUT
609
+ end
610
+
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
660
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
661
+ <head>
662
+ <style>
663
+ </style>
664
+ </head>
665
+ <body lang='EN-US' link='blue' vlink='#954F72'>
666
+ <div class='WordSection1'>
667
+ <p>&#160;</p>
668
+ </div>
669
+ <p>
670
+ <br clear='all' class='section'/>
671
+ </p>
672
+ <div class='WordSection2'>
673
+ <p>
674
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
675
+ </p>
676
+ <div>
677
+ <h1 class='ForewordTitle'>Foreword</h1>
678
+ <p>
679
+ <a href='http://www.example.com'>ISO 712</a>
680
+ <a href='http://www.example.com'>ISO 712</a>
681
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
682
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
683
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
684
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
685
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
686
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
687
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
688
+ <a href='spec/assets/iso713.doc'>A</a>
689
+ <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
690
+ <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
691
+ <a href='spec/assets/iso713.doc'>A</a>
692
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
693
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
694
+ </p>
695
+ </div>
696
+ <p>&#160;</p>
697
+ </div>
698
+ <p>
699
+ <br clear='all' class='section'/>
700
+ </p>
701
+ <div class='WordSection3'>
702
+ <p class='zzSTDTitle1'/>
703
+ <div>
704
+ <h1>
705
+ 1.
706
+ <span style='mso-tab-count:1'>&#160; </span>
707
+ Normative references
708
+ </h1>
709
+ <p id='ISO712' class='NormRef'>
710
+ ISO 712,
711
+ <i>Cereals and cereal products</i>
712
+ </p>
713
+ <p id='ISO713' class='NormRef'>
714
+ ISO 713,
715
+ <i>Cereals and cereal products</i>
716
+ </p>
717
+ </div>
718
+ </div>
719
+ </body>
720
+ </html>
721
+
722
+ OUTPUT
723
+ end
724
+
518
725
  it "processes variant" do
519
726
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
520
727
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -549,6 +756,59 @@ OUTPUT
549
756
  OUTPUT
550
757
  end
551
758
 
552
-
759
+ 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")
761
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
762
+ <sections>
763
+ <clause id="A">
764
+ <table id="B">
765
+ </table>
766
+ </clause>
767
+ <clause id="C">
768
+ <p>This is <xref target="A"/> and <xref target="B"/>.
769
+ This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
770
+ <xref target="A"/> is clause <em>initial.</em><br/>
771
+ <xref target="A"/> is too. </p>
772
+ <p><xref target="A"/> is also.</p>
773
+ </clause>
774
+ </sections>
775
+ </iso-standard>
776
+ 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>
811
+ OUTPUT
812
+ end
553
813
 
554
814
  end