isodoc 1.2.6 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) 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 +2 -1
  5. data/lib/isodoc-yaml/i18n-en.yaml +56 -0
  6. data/lib/isodoc-yaml/i18n-fr.yaml +64 -7
  7. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  8. data/lib/isodoc/base_style/all.css +4 -0
  9. data/lib/isodoc/base_style/blocks.scss +2 -2
  10. data/lib/isodoc/base_style/reset.css +4 -0
  11. data/lib/isodoc/base_style/reset.scss +5 -0
  12. data/lib/isodoc/base_style/typography.scss +1 -1
  13. data/lib/isodoc/convert.rb +13 -98
  14. data/lib/isodoc/css.rb +95 -0
  15. data/lib/isodoc/function/inline.rb +0 -33
  16. data/lib/isodoc/function/inline_simple.rb +4 -1
  17. data/lib/isodoc/function/lists.rb +2 -1
  18. data/lib/isodoc/function/references.rb +8 -13
  19. data/lib/isodoc/function/section.rb +1 -1
  20. data/lib/isodoc/function/table.rb +10 -0
  21. data/lib/isodoc/function/to_word_html.rb +2 -2
  22. data/lib/isodoc/gem_tasks.rb +4 -0
  23. data/lib/isodoc/html_function/html.rb +1 -0
  24. data/lib/isodoc/html_function/mathvariant_to_plain.rb +82 -0
  25. data/lib/isodoc/html_function/postprocess.rb +41 -20
  26. data/lib/isodoc/i18n.rb +15 -2
  27. data/lib/isodoc/metadata.rb +28 -109
  28. data/lib/isodoc/metadata_contributor.rb +91 -0
  29. data/lib/isodoc/metadata_date.rb +6 -0
  30. data/lib/isodoc/presentation_function/bibdata.rb +79 -7
  31. data/lib/isodoc/presentation_function/block.rb +14 -9
  32. data/lib/isodoc/presentation_function/inline.rb +126 -22
  33. data/lib/isodoc/presentation_function/section.rb +9 -0
  34. data/lib/isodoc/presentation_xml_convert.rb +5 -0
  35. data/lib/isodoc/version.rb +1 -1
  36. data/lib/isodoc/word_convert.rb +0 -20
  37. data/lib/isodoc/word_function/body.rb +12 -0
  38. data/lib/isodoc/word_function/postprocess.rb +38 -80
  39. data/lib/isodoc/word_function/postprocess_cover.rb +55 -0
  40. data/lib/isodoc/word_function/table.rb +10 -0
  41. data/lib/isodoc/xref.rb +1 -0
  42. data/lib/isodoc/xref/xref_counter.rb +20 -9
  43. data/lib/isodoc/xref/xref_gen.rb +20 -2
  44. data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
  45. data/spec/assets/html.scss +14 -0
  46. data/spec/assets/i18n.yaml +17 -9
  47. data/spec/isodoc/blocks_spec.rb +89 -241
  48. data/spec/isodoc/cleanup_spec.rb +0 -1
  49. data/spec/isodoc/footnotes_spec.rb +4 -5
  50. data/spec/isodoc/i18n_spec.rb +73 -38
  51. data/spec/isodoc/inline_spec.rb +177 -199
  52. data/spec/isodoc/lists_spec.rb +1 -1
  53. data/spec/isodoc/metadata_spec.rb +50 -7
  54. data/spec/isodoc/postproc_spec.rb +472 -11
  55. data/spec/isodoc/presentation_xml_spec.rb +584 -1
  56. data/spec/isodoc/ref_spec.rb +327 -12
  57. data/spec/isodoc/table_spec.rb +28 -0
  58. data/spec/isodoc/xref_spec.rb +162 -17
  59. data/spec/spec_helper.rb +2 -0
  60. metadata +22 -7
  61. data/.github/workflows/macos.yml +0 -42
  62. data/.github/workflows/ubuntu.yml +0 -62
  63. data/.github/workflows/windows.yml +0 -44
@@ -1186,5 +1186,4 @@ modified — with adjustments]
1186
1186
  </html>
1187
1187
  OUTPUT
1188
1188
  end
1189
-
1190
1189
  end
@@ -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
@@ -70,11 +70,8 @@ RSpec.describe IsoDoc do
70
70
  presxml = <<~"PRESXML"
71
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
- <local_bibdata>
76
- <language>en</language>
77
- </local_bibdata>
78
75
  <preface>
79
76
  <foreword obligation='informative'>
80
77
  <title>Foreword</title>
@@ -229,12 +226,12 @@ PRESXML
229
226
  </body>
230
227
  </html>
231
228
  OUTPUT
232
- 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)
233
230
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
234
231
  end
235
232
 
236
233
  it "defaults to English" do
237
- 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")
238
235
  <iso-standard xmlns="http://riboseinc.com/isoxml">
239
236
  <bibdata>
240
237
  <language>tlh</language>
@@ -301,11 +298,8 @@ PRESXML
301
298
  <?xml version='1.0'?>
302
299
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
303
300
  <bibdata>
304
- <language>tlh</language>
301
+ <language current="true">tlh</language>
305
302
  </bibdata>
306
- <local_bibdata>
307
- <language>tlh</language>
308
- </local_bibdata>
309
303
  <preface>
310
304
  <foreword obligation='informative'>
311
305
  <title>Foreword</title>
@@ -457,11 +451,8 @@ PRESXML
457
451
  presxml = <<~"PRESXML"
458
452
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
459
453
  <bibdata>
460
- <language>fr</language>
454
+ <language current="true">fr</language>
461
455
  </bibdata>
462
- <local_bibdata>
463
- <language>fr</language>
464
- </local_bibdata>
465
456
  <preface>
466
457
  <foreword obligation='informative'>
467
458
  <title>Foreword</title>
@@ -616,7 +607,7 @@ PRESXML
616
607
  </body>
617
608
  </html>
618
609
  OUTPUT
619
- 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)
620
611
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
621
612
  end
622
613
 
@@ -700,13 +691,9 @@ PRESXML
700
691
  presxml = <<~"PRESXML"
701
692
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
702
693
  <bibdata>
703
- <language>zh</language>
704
- <script>Hans</script>
694
+ <language current="true">zh</language>
695
+ <script current="true">Hans</script>
705
696
  </bibdata>
706
- <local_bibdata>
707
- <language>zh</language>
708
- <script>Hans</script>
709
- </local_bibdata>
710
697
  <preface>
711
698
  <foreword obligation='informative'>
712
699
  <title>Foreword</title>
@@ -875,11 +862,12 @@ PRESXML
875
862
  </body>
876
863
  </html>
877
864
  OUTPUT
878
- 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)
879
866
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
880
867
  end
881
868
 
882
869
  it "processes i18n file" do
870
+ mock_i18n
883
871
  input = <<~"INPUT"
884
872
  <iso-standard xmlns="http://riboseinc.com/isoxml">
885
873
  <bibdata>
@@ -897,6 +885,8 @@ PRESXML
897
885
  <foreword obligation="informative">
898
886
  <title>Foreword</title>
899
887
  <p id="A">See <xref target="M"/></p>
888
+ <p id="A">See <xref target="tab"/></p>
889
+ <table id="tab"/>
900
890
  </foreword>
901
891
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
902
892
  <title>Introduction Subsection</title>
@@ -928,6 +918,7 @@ PRESXML
928
918
  </definitions>
929
919
  <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
930
920
  <title>Introduction</title>
921
+ <note id="M-n1"/>
931
922
  </clause>
932
923
  <clause id="O" inline-header="false" obligation="normative">
933
924
  <title>Clause 4.2</title>
@@ -966,31 +957,55 @@ PRESXML
966
957
  presxml = <<~OUTPUT
967
958
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
968
959
  <bibdata>
969
- <language>eo</language>
970
- <script>Latn</script>
960
+ <language current="true">eo</language>
961
+ <script current="true">Latn</script>
971
962
  <status>
972
- <stage>published</stage>
973
- <substage>withdrawn</substage>
963
+ <stage language=''>published</stage>
964
+ <stage language='eo'>publikigita</stage>
965
+ <substage language=''>withdrawn</substage>
966
+ <substage language='eo'>fortirita</substage>
974
967
  </status>
975
968
  <ext>
976
- <doctype>brochure</doctype>
969
+ <doctype language=''>brochure</doctype>
970
+ <doctype language='eo'>bro&#x15D;uro</doctype>
977
971
  </ext>
978
972
  </bibdata>
979
- <local_bibdata>
980
- <language>eo</language>
981
- <script>Latn</script>
982
- <status>
983
- <stage>publikigita</stage>
984
- <substage>fortirita</substage>
985
- </status>
986
- <ext>
987
- <doctype>bro&#x15D;uro</doctype>
988
- </ext>
989
- </local_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>
990
1001
  <preface>
991
1002
  <foreword obligation="informative">
992
1003
  <title>Foreword</title>
993
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>
994
1009
  </foreword>
995
1010
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
996
1011
  <title depth="2">Introduction Subsection</title>
@@ -1022,6 +1037,7 @@ PRESXML
1022
1037
  </definitions>
1023
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">
1024
1039
  <title depth="2">5.1.<tab/>Introduction</title>
1040
+ <note id='M-n1'><name>NOTO </name></note>
1025
1041
  </clause>
1026
1042
  <clause id="O" inline-header="false" obligation="normative">
1027
1043
  <title depth="2">5.2.<tab/>Clause 4.2</title>
@@ -1077,6 +1093,12 @@ PRESXML
1077
1093
  See
1078
1094
  <a href='#M'>kla&#365;zo 5</a>
1079
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;'/>
1080
1102
  </div>
1081
1103
  <br/>
1082
1104
  <div class='Section3' id='B'>
@@ -1129,6 +1151,12 @@ PRESXML
1129
1151
  <h1>5.&#160; Clause 4</h1>
1130
1152
  <div id='N'>
1131
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>
1132
1160
  </div>
1133
1161
  <div id='O'>
1134
1162
  <h2>5.2.&#160; Clause 4.2</h2>
@@ -1166,4 +1194,11 @@ PRESXML
1166
1194
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1167
1195
  expect(xmlpp(IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1168
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
+
1169
1204
  end
@@ -1,62 +1,6 @@
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' type="presentation">
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
-
60
4
  it "droplocs xrefs" do
61
5
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
62
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -173,7 +117,7 @@ OUTPUT
173
117
  end
174
118
 
175
119
  it "ignores index entries" do
176
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
120
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
177
121
  <iso-standard xmlns="http://riboseinc.com/isoxml">
178
122
  <preface><foreword>
179
123
  <p><index primary="A" secondary="B" tertiary="C"/></p>
@@ -181,16 +125,14 @@ OUTPUT
181
125
  <sections>
182
126
  </iso-standard>
183
127
  INPUT
184
- #{HTML_HDR}
185
- <br/>
186
- <div>
187
- <h1 class='ForewordTitle'>Foreword</h1>
188
- <p/>
189
- </div>
190
- <p class='zzSTDTitle1'/>
191
- </div>
192
- </body>
193
- </html>
128
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
129
+ <preface>
130
+ <foreword>
131
+ <p/>
132
+ </foreword>
133
+ </preface>
134
+ <sections> </sections>
135
+ </iso-standard>
194
136
  OUTPUT
195
137
  end
196
138
 
@@ -280,119 +222,132 @@ OUTPUT
280
222
  </iso-standard>
281
223
  INPUT
282
224
  presxml = <<~OUTPUT
283
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
284
- <preface><foreword>
285
- <p>
286
- <ul>
287
- <li><concept term="term">
288
- <xref target="clause1">Clause 2</xref>
289
- </concept></li>
290
- <li><concept term="term">
291
- <xref target="clause1">w[o]rd</xref>
292
- </concept></li>
293
- <li><concept term="term">
294
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>
295
- </concept></li>
296
- <li><concept term="term">
297
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
298
- </concept></li>
299
- <li><concept>
300
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
301
- <referenceFrom>3.1</referenceFrom>
302
- </locality><locality type="figure">
303
- <referenceFrom>a</referenceFrom>
304
- </locality>ISO 712, Clause 3.1, Figure a</eref>
305
- </concept></li>
306
- <li><concept>
307
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
308
- <locality type="clause">
309
- <referenceFrom>3.1</referenceFrom>
310
- </locality>
311
- </localityStack><localityStack>
312
- <locality type="figure">
313
- <referenceFrom>b</referenceFrom>
314
- </locality>
315
- </localityStack>ISO 712, Clause 3.1; Figure b</eref>
316
- </concept></li>
317
- <li><concept>
318
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
319
- <localityStack>
320
- <locality type="clause">
321
- <referenceFrom>3.1</referenceFrom>
322
- </locality>
323
- </localityStack>
324
- <localityStack>
325
- <locality type="figure">
326
- <referenceFrom>b</referenceFrom>
327
- </locality>
328
- </localityStack>
329
- <em>word</em>
330
- </eref>
331
- </concept></li>
332
- <li><concept term="term">
333
- <termref base="IEV" target="135-13-13"/>
334
- </concept></li>
335
- <li><concept term="term">
336
- <termref base="IEV" target="135-13-13"><em>word</em> word</termref>
337
- </concept></li>
338
- </ul>
339
- </p>
340
- </foreword></preface>
341
- <sections>
342
- <clause id="clause1"><title depth='1'>2.<tab/>Clause 1</title>
343
- </clause>
344
- </sections>
345
- <bibliography><references id="_normative_references" obligation="informative" normative="true">
346
- <title depth='1'>1.<tab/>Normative References</title>
347
- <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>
348
- <bibitem id="ISO712" type="standard">
349
- <title format="text/plain">Cereals or cereal products</title>
350
- <title type="main" format="text/plain">Cereals and cereal products</title>
351
- <docidentifier type="ISO">ISO 712</docidentifier>
352
- <contributor>
353
- <role type="publisher"/>
354
- <organization>
355
- <name>International Organization for Standardization</name>
356
- </organization>
357
- </contributor>
358
- </bibitem>
359
- </references></bibliography>
360
- </iso-standard>
361
- OUTPUT
362
-
363
- html = <<~OUTPUT
364
- #{HTML_HDR}
365
- <br/>
366
- <div>
367
- <h1 class="ForewordTitle">Foreword</h1>
368
- <p>
369
- <ul>
370
- <li>Clause 2</li>
371
- <li>w[o]rd</li>
372
- <li>ISO 712</li>
373
- <li>word</li>
374
- <li>ISO 712, Clause 3.1, Figure a</li>
375
- <li>ISO 712, Clause 3.1; Figure b</li>
376
- <li><i>word</i></li>
377
- <li>[Term defined in Termbase IEV, term ID 135-13-13]</li>
378
- <li><i>word</i> word</li>
379
- </ul>
380
- </p>
381
- </div>
382
- <p class="zzSTDTitle1"/>
383
- <div><h1>1.&#160; Normative References</h1>
384
- <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>
385
- <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
386
- </div>
387
- <div id="clause1">
388
- <h1>2.&#160; Clause 1</h1>
389
- </div>
390
- </div>
391
- </body>
392
- </html>
393
- OUTPUT
394
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
395
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
225
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
226
+ <preface>
227
+ <foreword>
228
+ <p>
229
+ <ul>
230
+ <li>
231
+ <em>
232
+ <xref target='clause1'>Clause 2</xref>
233
+ </em>
234
+ </li>
235
+ <li>
236
+ <em>
237
+ <xref target='clause1'>w[o]rd</xref>
238
+ </em>
239
+ </li>
240
+ <li>
241
+ <em>
242
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
243
+ </em>
244
+ </li>
245
+ <li>
246
+ <em>
247
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
248
+ </em>
249
+ </li>
250
+ <li>
251
+ <em>
252
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
253
+ <locality type='clause'>
254
+ <referenceFrom>3.1</referenceFrom>
255
+ </locality>
256
+ <locality type='figure'>
257
+ <referenceFrom>a</referenceFrom>
258
+ </locality>
259
+ ISO 712, Clause 3.1, Figure a
260
+ </eref>
261
+ </em>
262
+ </li>
263
+ <li>
264
+ <em>
265
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
266
+ <localityStack>
267
+ <locality type='clause'>
268
+ <referenceFrom>3.1</referenceFrom>
269
+ </locality>
270
+ </localityStack>
271
+ <localityStack>
272
+ <locality type='figure'>
273
+ <referenceFrom>b</referenceFrom>
274
+ </locality>
275
+ </localityStack>
276
+ ISO 712, Clause 3.1; Figure b
277
+ </eref>
278
+ </em>
279
+ </li>
280
+ <li>
281
+ <em>
282
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
283
+ <localityStack>
284
+ <locality type='clause'>
285
+ <referenceFrom>3.1</referenceFrom>
286
+ </locality>
287
+ </localityStack>
288
+ <localityStack>
289
+ <locality type='figure'>
290
+ <referenceFrom>b</referenceFrom>
291
+ </locality>
292
+ </localityStack>
293
+ <em>word</em>
294
+ </eref>
295
+ </em>
296
+ </li>
297
+ <li>
298
+ [term defined in
299
+ <termref base='IEV' target='135-13-13'/>
300
+ ]
301
+ </li>
302
+ <li>
303
+ <em>
304
+ <termref base='IEV' target='135-13-13'>
305
+ <em>word</em>
306
+ word
307
+ </termref>
308
+ </em>
309
+ </li>
310
+ </ul>
311
+ </p>
312
+ </foreword>
313
+ </preface>
314
+ <sections>
315
+ <clause id='clause1'>
316
+ <title depth='1'>
317
+ 2.
318
+ <tab/>
319
+ Clause 1
320
+ </title>
321
+ </clause>
322
+ </sections>
323
+ <bibliography>
324
+ <references id='_normative_references' obligation='informative' normative='true'>
325
+ <title depth='1'>
326
+ 1.
327
+ <tab/>
328
+ Normative References
329
+ </title>
330
+ <p>
331
+ The following documents are referred to in the text in such a way that
332
+ some or all of their content constitutes requirements of this document.
333
+ For dated references, only the edition cited applies. For undated
334
+ references, the latest edition of the referenced document (including any
335
+ amendments) applies.
336
+ </p>
337
+ <bibitem id='ISO712' type='standard'>
338
+ <title format='text/plain'>Cereals or cereal products</title>
339
+ <title type='main' format='text/plain'>Cereals and cereal products</title>
340
+ <docidentifier type='ISO'>ISO 712</docidentifier>
341
+ <contributor>
342
+ <role type='publisher'/>
343
+ <organization>
344
+ <name>International Organization for Standardization</name>
345
+ </organization>
346
+ </contributor>
347
+ </bibitem>
348
+ </references>
349
+ </bibliography>
350
+ </iso-standard>
396
351
  end
397
352
 
398
353
  it "processes embedded inline formatting" do
@@ -945,7 +900,7 @@ OUTPUT
945
900
  end
946
901
 
947
902
  it "processes variant" do
948
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
903
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
949
904
  <iso-standard xmlns="http://riboseinc.com/isoxml">
950
905
  <bibdata>
951
906
  <language>en</language>
@@ -953,28 +908,46 @@ OUTPUT
953
908
  </bibdata>
954
909
  <preface>
955
910
  <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
911
+ <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
912
+ <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
956
913
  <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
957
914
  <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
915
+ <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
916
+ <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
917
+ <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>
958
918
  </preface>
959
919
  </iso-standard>
960
920
  INPUT
961
- #{HTML_HDR}
962
- <br/>
963
- <div class='Section3' id='A'>
964
- <h1 class='IntroTitle'>ABC</h1>
965
- </div>
966
- <br/>
967
- <div class='Section3' id='B'>
968
- <h1 class='IntroTitle'>GHI</h1>
969
- </div>
970
- <br/>
971
- <div class='Section3' id='C'>
972
- <h1 class='IntroTitle'>DEF</h1>
973
- </div>
974
- <p class='zzSTDTitle1'/>
975
- </div>
976
- </body>
977
- </html>
921
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
922
+ <bibdata>
923
+ <language current='true'>en</language>
924
+ <script current='true'>Latn</script>
925
+ </bibdata>
926
+ <preface>
927
+ <clause id='A'>
928
+ <title depth='1'>ABC</title>
929
+ </clause>
930
+ <clause id='A1'>
931
+ <title depth='1'>ABC/DEF</title>
932
+ </clause>
933
+ <clause id='A2'>
934
+ <title depth='1'>ABC</title>
935
+ </clause>
936
+ <clause id='B'>
937
+ <title depth='1'>GHI/JKL</title>
938
+ </clause>
939
+ <clause id='C'>
940
+ <title depth='1'>DEF</title>
941
+ </clause>
942
+ <clause id='C1'>
943
+ <title depth='1'>ABC/DEF</title>
944
+ </clause>
945
+ <clause id='C2'>
946
+ <title depth='1'>DEF</title>
947
+ </clause>
948
+ <p>A B D E</p>
949
+ </preface>
950
+ </iso-standard>
978
951
  OUTPUT
979
952
  end
980
953
 
@@ -989,6 +962,7 @@ it "cases xrefs" do
989
962
  <clause id="C">
990
963
  <p>This is <xref target="A"/> and <xref target="B"/>.
991
964
  This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
965
+ This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
992
966
  <xref target="A"/> is clause <em>initial.</em><br/>
993
967
  <xref target="A"/> is too. </p>
994
968
  <p><xref target="A"/> is also.</p>
@@ -1011,11 +985,15 @@ INPUT
1011
985
  This is
1012
986
  <xref target='A'>kla&#x16D;zo 1</xref>
1013
987
  and
1014
- <xref target='B'>Tabelo 1</xref>
988
+ <xref target='B'>tabelo 1</xref>
1015
989
  . This is
1016
990
  <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
1017
991
  and
1018
992
  <xref target='B' case='lowercase'>tabelo 1</xref>
993
+ . This is
994
+ <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
995
+ and
996
+ <xref target='B' case='capital'>Tabelo 1</xref>
1019
997
  .
1020
998
  <xref target='A'>Kla&#x16D;zo 1</xref>
1021
999
  is clause