isodoc 1.2.4 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +69 -0
  3. data/README.adoc +1 -3
  4. data/isodoc.gemspec +3 -1
  5. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  6. data/lib/isodoc-yaml/i18n-fr.yaml +8 -7
  7. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  8. data/lib/isodoc/base_style/all.css +5 -1
  9. data/lib/isodoc/base_style/blocks.scss +2 -2
  10. data/lib/isodoc/base_style/reset.css +5 -1
  11. data/lib/isodoc/base_style/reset.scss +6 -1
  12. data/lib/isodoc/base_style/typography.scss +1 -1
  13. data/lib/isodoc/convert.rb +12 -97
  14. data/lib/isodoc/css.rb +95 -0
  15. data/lib/isodoc/function/inline.rb +0 -33
  16. data/lib/isodoc/function/lists.rb +2 -1
  17. data/lib/isodoc/function/references.rb +8 -13
  18. data/lib/isodoc/function/to_word_html.rb +2 -2
  19. data/lib/isodoc/html_function/postprocess.rb +12 -3
  20. data/lib/isodoc/i18n.rb +23 -51
  21. data/lib/isodoc/metadata.rb +44 -111
  22. data/lib/isodoc/metadata_contributor.rb +90 -0
  23. data/lib/isodoc/metadata_date.rb +11 -0
  24. data/lib/isodoc/presentation_function/bibdata.rb +96 -0
  25. data/lib/isodoc/presentation_function/block.rb +14 -9
  26. data/lib/isodoc/presentation_function/inline.rb +151 -34
  27. data/lib/isodoc/presentation_xml_convert.rb +6 -0
  28. data/lib/isodoc/version.rb +1 -1
  29. data/lib/isodoc/word_convert.rb +0 -20
  30. data/lib/isodoc/word_function/body.rb +12 -0
  31. data/lib/isodoc/word_function/postprocess.rb +1 -1
  32. data/lib/isodoc/xref/xref_anchor.rb +8 -3
  33. data/lib/isodoc/xref/xref_counter.rb +20 -9
  34. data/lib/isodoc/xref/xref_gen.rb +4 -4
  35. data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
  36. data/lib/isodoc/xslfo_convert.rb +6 -1
  37. data/spec/assets/html.scss +14 -0
  38. data/spec/assets/i18n.yaml +22 -5
  39. data/spec/isodoc/blocks_spec.rb +100 -221
  40. data/spec/isodoc/footnotes_spec.rb +4 -5
  41. data/spec/isodoc/i18n_spec.rb +89 -16
  42. data/spec/isodoc/inline_spec.rb +185 -163
  43. data/spec/isodoc/lists_spec.rb +1 -1
  44. data/spec/isodoc/metadata_spec.rb +69 -19
  45. data/spec/isodoc/postproc_spec.rb +33 -8
  46. data/spec/isodoc/presentation_xml_spec.rb +584 -1
  47. data/spec/isodoc/ref_spec.rb +328 -10
  48. data/spec/isodoc/section_spec.rb +9 -9
  49. data/spec/isodoc/table_spec.rb +1 -1
  50. data/spec/isodoc/terms_spec.rb +1 -1
  51. data/spec/isodoc/xref_spec.rb +35 -35
  52. data/spec/spec_helper.rb +6 -0
  53. metadata +36 -7
  54. data/.github/workflows/macos.yml +0 -42
  55. data/.github/workflows/ubuntu.yml +0 -62
  56. data/.github/workflows/windows.yml +0 -44
@@ -180,11 +180,10 @@ RSpec.describe IsoDoc do
180
180
  </div>
181
181
  <p class="zzSTDTitle1"></p>
182
182
  </main>
183
- <script type="text/x-mathjax-config">
184
- MathJax.Hub.Config({
185
- asciimath2jax: { delimiters: [['(#(', ')#)']] }
186
- });
187
- </script>
183
+ <script type='text/x-mathjax-config'>
184
+ MathJax.Hub.Config({ "HTML-CSS": { preferredFont: "STIX" }, asciimath2jax:
185
+ { delimiters: [['(#(', ')#)']] } });
186
+ </script>
188
187
  <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=MML_HTMLorMML-full" async="async"></script>
189
188
  <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script></body>
190
189
  OUTPUT
@@ -68,9 +68,9 @@ RSpec.describe IsoDoc do
68
68
  INPUT
69
69
 
70
70
  presxml = <<~"PRESXML"
71
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
71
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
72
72
  <bibdata>
73
- <language>en</language>
73
+ <language current="true">en</language>
74
74
  </bibdata>
75
75
  <preface>
76
76
  <foreword obligation='informative'>
@@ -226,12 +226,12 @@ PRESXML
226
226
  </body>
227
227
  </html>
228
228
  OUTPUT
229
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
229
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
230
230
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
231
231
  end
232
232
 
233
233
  it "defaults to English" do
234
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
234
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
235
235
  <iso-standard xmlns="http://riboseinc.com/isoxml">
236
236
  <bibdata>
237
237
  <language>tlh</language>
@@ -296,9 +296,9 @@ PRESXML
296
296
  </iso-standard>
297
297
  INPUT
298
298
  <?xml version='1.0'?>
299
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
299
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
300
300
  <bibdata>
301
- <language>tlh</language>
301
+ <language current="true">tlh</language>
302
302
  </bibdata>
303
303
  <preface>
304
304
  <foreword obligation='informative'>
@@ -449,9 +449,9 @@ PRESXML
449
449
  INPUT
450
450
 
451
451
  presxml = <<~"PRESXML"
452
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
452
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
453
453
  <bibdata>
454
- <language>fr</language>
454
+ <language current="true">fr</language>
455
455
  </bibdata>
456
456
  <preface>
457
457
  <foreword obligation='informative'>
@@ -607,7 +607,7 @@ PRESXML
607
607
  </body>
608
608
  </html>
609
609
  OUTPUT
610
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
610
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
611
611
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
612
612
  end
613
613
 
@@ -689,10 +689,10 @@ PRESXML
689
689
  INPUT
690
690
 
691
691
  presxml = <<~"PRESXML"
692
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
692
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
693
693
  <bibdata>
694
- <language>zh</language>
695
- <script>Hans</script>
694
+ <language current="true">zh</language>
695
+ <script current="true">Hans</script>
696
696
  </bibdata>
697
697
  <preface>
698
698
  <foreword obligation='informative'>
@@ -862,21 +862,31 @@ PRESXML
862
862
  </body>
863
863
  </html>
864
864
  OUTPUT
865
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
865
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
866
866
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
867
867
  end
868
868
 
869
869
  it "processes i18n file" do
870
+ mock_i18n
870
871
  input = <<~"INPUT"
871
872
  <iso-standard xmlns="http://riboseinc.com/isoxml">
872
873
  <bibdata>
873
874
  <language>eo</language>
874
875
  <script>Latn</script>
876
+ <status>
877
+ <stage>published</stage>
878
+ <substage>withdrawn</substage>
879
+ </status>
880
+ <ext>
881
+ <doctype>brochure</doctype>
882
+ </ext>
875
883
  </bibdata>
876
884
  <preface>
877
885
  <foreword obligation="informative">
878
886
  <title>Foreword</title>
879
887
  <p id="A">See <xref target="M"/></p>
888
+ <p id="A">See <xref target="tab"/></p>
889
+ <table id="tab"/>
880
890
  </foreword>
881
891
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
882
892
  <title>Introduction Subsection</title>
@@ -908,6 +918,7 @@ PRESXML
908
918
  </definitions>
909
919
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
910
920
  <title>Introduction</title>
921
+ <note id="M-n1"/>
911
922
  </clause>
912
923
  <clause id="O" inline-header="false" obligation="normative">
913
924
  <title>Clause 4.2</title>
@@ -944,15 +955,57 @@ PRESXML
944
955
  INPUT
945
956
 
946
957
  presxml = <<~OUTPUT
947
- <iso-standard xmlns="http://riboseinc.com/isoxml">
958
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
948
959
  <bibdata>
949
- <language>eo</language>
950
- <script>Latn</script>
960
+ <language current="true">eo</language>
961
+ <script current="true">Latn</script>
962
+ <status>
963
+ <stage language=''>published</stage>
964
+ <stage language='eo'>publikigita</stage>
965
+ <substage language=''>withdrawn</substage>
966
+ <substage language='eo'>fortirita</substage>
967
+ </status>
968
+ <ext>
969
+ <doctype language=''>brochure</doctype>
970
+ <doctype language='eo'>bro&#x15D;uro</doctype>
971
+ </ext>
951
972
  </bibdata>
973
+ <localized-strings>
974
+ <localized-string key='foreword' language='eo'>Anta&#x16D;parolo</localized-string>
975
+ <localized-string key='introduction' language='eo'>Enkonduko</localized-string>
976
+ <localized-string key='clause' language='eo'>kla&#x16D;zo</localized-string>
977
+ <localized-string key='table' language='eo'>tabelo</localized-string>
978
+ <localized-string key='source' language='eo'>SOURCE</localized-string>
979
+ <localized-string key='modified' language='eo'>modified</localized-string>
980
+ <localized-string key='scope' language='eo'>Amplekso</localized-string>
981
+ <localized-string key='symbols' language='eo'>Simboloj kai mallongigitaj terminoj</localized-string>
982
+ <localized-string key='annex' language='eo'>Aldono</localized-string>
983
+ <localized-string key='normref' language='eo'>Normaj cita&#x135;oj</localized-string>
984
+ <localized-string key='bibliography' language='eo'>Bibliografio</localized-string>
985
+ <localized-string key='inform_annex' language='eo'>informa</localized-string>
986
+ <localized-string key='all_parts' language='eo'>&#x109;iuj partoj</localized-string>
987
+ <localized-string key='norm_annex' language='eo'>normative</localized-string>
988
+ <localized-string key='note' language='eo'>NOTO</localized-string>
989
+ <localized-string key='locality.table' language='eo'>Tabelo</localized-string>
990
+ <localized-string key='doctype_dict.brochure' language='eo'>bro&#x15D;uro</localized-string>
991
+ <localized-string key='doctype_dict.conference_proceedings' language='eo'>konferencaktoj</localized-string>
992
+ <localized-string key='stage_dict.published' language='eo'>publikigita</localized-string>
993
+ <localized-string key='substage_dict.withdrawn' language='eo'>fortirita</localized-string>
994
+ <localized-string key='array.0' language='eo'>elem1</localized-string>
995
+ <localized-string key='array.1' language='eo'>elem2</localized-string>
996
+ <localized-string key='array.2.elem3' language='eo'>elem4</localized-string>
997
+ <localized-string key='array.2.elem5' language='eo'>elem6</localized-string>
998
+ <localized-string key='language' language='eo'>eo</localized-string>
999
+ <localized-string key='script' language='eo'>Latn</localized-string>
1000
+ </localized-strings>
952
1001
  <preface>
953
1002
  <foreword obligation="informative">
954
1003
  <title>Foreword</title>
955
1004
  <p id='A'>See <xref target='M'>kla&#x16D;zo 5</xref></p>
1005
+ <p id='A'>See <xref target='tab'>tabelo 1</xref></p>
1006
+ <table id='tab'>
1007
+ <name>Tabelo 1</name>
1008
+ </table>
956
1009
  </foreword>
957
1010
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
958
1011
  <title depth="2">Introduction Subsection</title>
@@ -984,6 +1037,7 @@ PRESXML
984
1037
  </definitions>
985
1038
  <clause id="M" inline-header="false" obligation="normative"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
986
1039
  <title depth="2">5.1.<tab/>Introduction</title>
1040
+ <note id='M-n1'><name>NOTO </name></note>
987
1041
  </clause>
988
1042
  <clause id="O" inline-header="false" obligation="normative">
989
1043
  <title depth="2">5.2.<tab/>Clause 4.2</title>
@@ -1039,6 +1093,12 @@ PRESXML
1039
1093
  See
1040
1094
  <a href='#M'>kla&#365;zo 5</a>
1041
1095
  </p>
1096
+ <p id='A'>
1097
+ See
1098
+ <a href='#tab'>tabelo 1</a>
1099
+ </p>
1100
+ <p class='TableTitle' style='text-align:center;'>Tabelo 1</p>
1101
+ <table id='tab' class='MsoISOTable' style='border-width:1px;border-spacing:0;'/>
1042
1102
  </div>
1043
1103
  <br/>
1044
1104
  <div class='Section3' id='B'>
@@ -1091,6 +1151,12 @@ PRESXML
1091
1151
  <h1>5.&#160; Clause 4</h1>
1092
1152
  <div id='N'>
1093
1153
  <h2>5.1.&#160; Introduction</h2>
1154
+ <div id='M-n1' class='Note'>
1155
+ <p>
1156
+ <span class='note_label'>NOTO </span>
1157
+ &#160;
1158
+ </p>
1159
+ </div>
1094
1160
  </div>
1095
1161
  <div id='O'>
1096
1162
  <h2>5.2.&#160; Clause 4.2</h2>
@@ -1128,4 +1194,11 @@ PRESXML
1128
1194
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1129
1195
  expect(xmlpp(IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1130
1196
  end
1197
+
1198
+ private
1199
+
1200
+ def mock_i18n
1201
+ allow_any_instance_of(::IsoDoc::I18n).to receive(:load_yaml).with("eo", "Latn", "spec/assets/i18n.yaml").and_return(IsoDoc::I18n.new("eo", "Latn").normalise_hash(YAML.load_file("spec/assets/i18n.yaml")))
1202
+ end
1203
+
1131
1204
  end
@@ -1,61 +1,47 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "cases xrefs" do
4
+ it "droplocs xrefs" do
5
5
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <sections>
8
8
  <clause id="A">
9
- <table id="B">
10
- </table>
9
+ <formula id="B">
10
+ </formula>
11
11
  </clause>
12
12
  <clause id="C">
13
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>
14
+ This is <xref target="A" droploc="true"/> and <xref target="B" droploc="true"/>.</p>
18
15
  </clause>
19
16
  </sections>
20
17
  </iso-standard>
21
18
  INPUT
22
- <?xml version='1.0'?>
23
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
19
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
24
20
  <sections>
25
21
  <clause id='A'>
26
- <title>1.</title>
27
- <table id='B'>
28
- <name>Tabelo 1</name>
29
- </table>
22
+ <title>1.</title>
23
+ <formula id='B'>
24
+ <name>1</name>
25
+ </formula>
30
26
  </clause>
31
27
  <clause id='C'>
32
- <title>2.</title>
28
+ <title>2.</title>
33
29
  <p>
34
30
  This is
35
31
  <xref target='A'>kla&#x16D;zo 1</xref>
36
32
  and
37
- <xref target='B'>Tabelo 1</xref>
33
+ <xref target='B'>kla&#x16D;zo 1, Formula (1)</xref>
38
34
  . This is
39
- <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
35
+ <xref target='A' droploc='true'>1</xref>
40
36
  and
41
- <xref target='B' case='lowercase'>tabelo 1</xref>
37
+ <xref target='B' droploc='true'>(1)</xref>
42
38
  .
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
39
  </p>
54
40
  </clause>
55
41
  </sections>
56
42
  </iso-standard>
57
43
  OUTPUT
58
- end
44
+ end
59
45
 
60
46
  it "processes inline formatting" do
61
47
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -238,119 +224,132 @@ end
238
224
  </iso-standard>
239
225
  INPUT
240
226
  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
322
- #{HTML_HDR}
323
- <br/>
324
- <div>
325
- <h1 class="ForewordTitle">Foreword</h1>
326
- <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>
339
- </div>
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">
346
- <h1>2.&#160; Clause 1</h1>
347
- </div>
348
- </div>
349
- </body>
350
- </html>
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)
227
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
228
+ <preface>
229
+ <foreword>
230
+ <p>
231
+ <ul>
232
+ <li>
233
+ <em>
234
+ <xref target='clause1'>Clause 2</xref>
235
+ </em>
236
+ </li>
237
+ <li>
238
+ <em>
239
+ <xref target='clause1'>w[o]rd</xref>
240
+ </em>
241
+ </li>
242
+ <li>
243
+ <em>
244
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
245
+ </em>
246
+ </li>
247
+ <li>
248
+ <em>
249
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
250
+ </em>
251
+ </li>
252
+ <li>
253
+ <em>
254
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
255
+ <locality type='clause'>
256
+ <referenceFrom>3.1</referenceFrom>
257
+ </locality>
258
+ <locality type='figure'>
259
+ <referenceFrom>a</referenceFrom>
260
+ </locality>
261
+ ISO 712, Clause 3.1, Figure a
262
+ </eref>
263
+ </em>
264
+ </li>
265
+ <li>
266
+ <em>
267
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
268
+ <localityStack>
269
+ <locality type='clause'>
270
+ <referenceFrom>3.1</referenceFrom>
271
+ </locality>
272
+ </localityStack>
273
+ <localityStack>
274
+ <locality type='figure'>
275
+ <referenceFrom>b</referenceFrom>
276
+ </locality>
277
+ </localityStack>
278
+ ISO 712, Clause 3.1; Figure b
279
+ </eref>
280
+ </em>
281
+ </li>
282
+ <li>
283
+ <em>
284
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
285
+ <localityStack>
286
+ <locality type='clause'>
287
+ <referenceFrom>3.1</referenceFrom>
288
+ </locality>
289
+ </localityStack>
290
+ <localityStack>
291
+ <locality type='figure'>
292
+ <referenceFrom>b</referenceFrom>
293
+ </locality>
294
+ </localityStack>
295
+ <em>word</em>
296
+ </eref>
297
+ </em>
298
+ </li>
299
+ <li>
300
+ [term defined in
301
+ <termref base='IEV' target='135-13-13'/>
302
+ ]
303
+ </li>
304
+ <li>
305
+ <em>
306
+ <termref base='IEV' target='135-13-13'>
307
+ <em>word</em>
308
+ word
309
+ </termref>
310
+ </em>
311
+ </li>
312
+ </ul>
313
+ </p>
314
+ </foreword>
315
+ </preface>
316
+ <sections>
317
+ <clause id='clause1'>
318
+ <title depth='1'>
319
+ 2.
320
+ <tab/>
321
+ Clause 1
322
+ </title>
323
+ </clause>
324
+ </sections>
325
+ <bibliography>
326
+ <references id='_normative_references' obligation='informative' normative='true'>
327
+ <title depth='1'>
328
+ 1.
329
+ <tab/>
330
+ Normative References
331
+ </title>
332
+ <p>
333
+ The following documents are referred to in the text in such a way that
334
+ some or all of their content constitutes requirements of this document.
335
+ For dated references, only the edition cited applies. For undated
336
+ references, the latest edition of the referenced document (including any
337
+ amendments) applies.
338
+ </p>
339
+ <bibitem id='ISO712' type='standard'>
340
+ <title format='text/plain'>Cereals or cereal products</title>
341
+ <title type='main' format='text/plain'>Cereals and cereal products</title>
342
+ <docidentifier type='ISO'>ISO 712</docidentifier>
343
+ <contributor>
344
+ <role type='publisher'/>
345
+ <organization>
346
+ <name>International Organization for Standardization</name>
347
+ </organization>
348
+ </contributor>
349
+ </bibitem>
350
+ </references>
351
+ </bibliography>
352
+ </iso-standard>
354
353
  end
355
354
 
356
355
  it "processes embedded inline formatting" do
@@ -606,7 +605,7 @@ OUTPUT
606
605
  </iso-standard>
607
606
  INPUT
608
607
  presxml = <<~OUTPUT
609
- <iso-standard xmlns="http://riboseinc.com/isoxml">
608
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
610
609
  <preface><foreword>
611
610
  <p>
612
611
  <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
@@ -728,7 +727,7 @@ html = <<~OUTPUT
728
727
  </iso-standard>
729
728
  INPUT
730
729
  presxml = <<~OUTPUT
731
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
730
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
732
731
  <preface>
733
732
  <foreword>
734
733
  <p>
@@ -903,7 +902,7 @@ OUTPUT
903
902
  end
904
903
 
905
904
  it "processes variant" do
906
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
905
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
907
906
  <iso-standard xmlns="http://riboseinc.com/isoxml">
908
907
  <bibdata>
909
908
  <language>en</language>
@@ -911,28 +910,46 @@ OUTPUT
911
910
  </bibdata>
912
911
  <preface>
913
912
  <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
913
+ <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
914
+ <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
914
915
  <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
915
916
  <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
917
+ <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
918
+ <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
919
+ <p>A <variant><variant lang="en">B</variant><variant lang="fr">C</variant></variant> D <variant><variant lang="en" script="Latn">E</variant><variant lang="fr" script="Latn">F</variant></variant></p>
916
920
  </preface>
917
921
  </iso-standard>
918
922
  INPUT
919
- #{HTML_HDR}
920
- <br/>
921
- <div class='Section3' id='A'>
922
- <h1 class='IntroTitle'>ABC</h1>
923
- </div>
924
- <br/>
925
- <div class='Section3' id='B'>
926
- <h1 class='IntroTitle'>GHI</h1>
927
- </div>
928
- <br/>
929
- <div class='Section3' id='C'>
930
- <h1 class='IntroTitle'>DEF</h1>
931
- </div>
932
- <p class='zzSTDTitle1'/>
933
- </div>
934
- </body>
935
- </html>
923
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
924
+ <bibdata>
925
+ <language current='true'>en</language>
926
+ <script current='true'>Latn</script>
927
+ </bibdata>
928
+ <preface>
929
+ <clause id='A'>
930
+ <title depth='1'>ABC</title>
931
+ </clause>
932
+ <clause id='A1'>
933
+ <title depth='1'>ABC/DEF</title>
934
+ </clause>
935
+ <clause id='A2'>
936
+ <title depth='1'>ABC</title>
937
+ </clause>
938
+ <clause id='B'>
939
+ <title depth='1'>GHI/JKL</title>
940
+ </clause>
941
+ <clause id='C'>
942
+ <title depth='1'>DEF</title>
943
+ </clause>
944
+ <clause id='C1'>
945
+ <title depth='1'>ABC/DEF</title>
946
+ </clause>
947
+ <clause id='C2'>
948
+ <title depth='1'>DEF</title>
949
+ </clause>
950
+ <p>A B D E</p>
951
+ </preface>
952
+ </iso-standard>
936
953
  OUTPUT
937
954
  end
938
955
 
@@ -947,6 +964,7 @@ it "cases xrefs" do
947
964
  <clause id="C">
948
965
  <p>This is <xref target="A"/> and <xref target="B"/>.
949
966
  This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
967
+ This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
950
968
  <xref target="A"/> is clause <em>initial.</em><br/>
951
969
  <xref target="A"/> is too. </p>
952
970
  <p><xref target="A"/> is also.</p>
@@ -955,7 +973,7 @@ it "cases xrefs" do
955
973
  </iso-standard>
956
974
  INPUT
957
975
  <?xml version='1.0'?>
958
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
976
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
959
977
  <sections>
960
978
  <clause id='A'>
961
979
  <title>1.</title>
@@ -969,11 +987,15 @@ INPUT
969
987
  This is
970
988
  <xref target='A'>kla&#x16D;zo 1</xref>
971
989
  and
972
- <xref target='B'>Tabelo 1</xref>
990
+ <xref target='B'>tabelo 1</xref>
973
991
  . This is
974
992
  <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
975
993
  and
976
994
  <xref target='B' case='lowercase'>tabelo 1</xref>
995
+ . This is
996
+ <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
997
+ and
998
+ <xref target='B' case='capital'>Tabelo 1</xref>
977
999
  .
978
1000
  <xref target='A'>Kla&#x16D;zo 1</xref>
979
1001
  is clause