isodoc 2.0.2 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/convert.rb +36 -18
  3. data/lib/isodoc/function/inline.rb +24 -13
  4. data/lib/isodoc/function/references.rb +18 -6
  5. data/lib/isodoc/html_function/html.rb +6 -0
  6. data/lib/isodoc/i18n.rb +20 -7
  7. data/lib/isodoc/metadata.rb +1 -1
  8. data/lib/isodoc/metadata_contributor.rb +1 -1
  9. data/lib/isodoc/presentation_function/bibdata.rb +26 -9
  10. data/lib/isodoc/presentation_function/block.rb +24 -0
  11. data/lib/isodoc/presentation_function/image.rb +3 -4
  12. data/lib/isodoc/presentation_function/inline.rb +118 -76
  13. data/lib/isodoc/presentation_function/math.rb +1 -0
  14. data/lib/isodoc/presentation_function/xrefs.rb +100 -0
  15. data/lib/isodoc/presentation_xml_convert.rb +1 -0
  16. data/lib/isodoc/version.rb +1 -1
  17. data/lib/isodoc/word_function/body.rb +11 -1
  18. data/lib/isodoc/word_function/postprocess.rb +4 -6
  19. data/lib/isodoc/word_function/postprocess_cover.rb +82 -1
  20. data/lib/isodoc/xref/xref_anchor.rb +1 -0
  21. data/lib/isodoc/xref/xref_gen.rb +2 -1
  22. data/lib/isodoc/xref/xref_sect_gen.rb +14 -8
  23. data/lib/isodoc/xslfo_convert.rb +19 -19
  24. data/lib/isodoc-yaml/i18n-ar.yaml +11 -0
  25. data/lib/isodoc-yaml/i18n-de.yaml +11 -0
  26. data/lib/isodoc-yaml/i18n-en.yaml +11 -0
  27. data/lib/isodoc-yaml/i18n-es.yaml +11 -0
  28. data/lib/isodoc-yaml/i18n-fr.yaml +11 -0
  29. data/lib/isodoc-yaml/i18n-ru.yaml +11 -0
  30. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +11 -0
  31. data/spec/isodoc/blocks_spec.rb +13 -77
  32. data/spec/isodoc/inline_spec.rb +565 -22
  33. data/spec/isodoc/metadata_spec.rb +1 -1
  34. data/spec/isodoc/postproc_spec.rb +466 -2
  35. data/spec/isodoc/presentation_xml_spec.rb +380 -78
  36. data/spec/isodoc/ref_spec.rb +96 -11
  37. data/spec/isodoc/section_spec.rb +1 -2
  38. data/spec/isodoc/table_spec.rb +1 -1
  39. data/spec/isodoc/terms_spec.rb +8 -8
  40. data/spec/isodoc/xref_spec.rb +71 -1190
  41. data/spec/isodoc/xslfo_convert_spec.rb +12 -7
  42. metadata +3 -2
@@ -27,6 +27,7 @@ RSpec.describe IsoDoc do
27
27
  </bibdata>
28
28
  <preface>
29
29
  <p>
30
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>...</mn></math></stem>
30
31
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>64212149677264515</mn></math></stem>
31
32
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>642121496772645.15</mn></math></stem>
32
33
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
@@ -41,6 +42,7 @@ RSpec.describe IsoDoc do
41
42
  </bibdata>
42
43
  <preface>
43
44
  <p displayorder="1">
45
+ ...
44
46
  64,212,149,677,264,515
45
47
  642,121,496,772,645.15 30,000
46
48
  <stem type='MathML'>
@@ -844,84 +846,84 @@ RSpec.describe IsoDoc do
844
846
  </html>
845
847
  OUTPUT
846
848
  doc = <<~OUTPUT
847
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
848
- <head>
849
- <style>
850
- </style>
851
- </head>
852
- <body lang='EN-US' link='blue' vlink='#954F72'>
853
- <div class='WordSection1'>
854
- <p>&#160;</p>
855
- </div>
856
- <p>
857
- <br clear='all' class='section'/>
858
- </p>
859
- <div class='WordSection2'>
860
- <p>&#160;</p>
861
- </div>
862
- <p>
863
- <br clear='all' class='section'/>
864
- </p>
865
- <div class='WordSection3'>
866
- <p class='zzSTDTitle1'/>
867
- <div id='_'>
868
- <h1>
869
- <b>Annex A</b>
870
- <br/>
871
- (normative).
872
- <span style='mso-tab-count:1'>&#160; </span>
873
- Clause
874
- </h1>
875
- <p id='_'>Text</p>
876
- <div id='_'>
877
- <h1>
878
- <b>Annex A</b>
879
- <br/>
880
- (normative).
881
- <span style='mso-tab-count:1'>&#160; </span>
882
- Subclause
883
- <br/>
884
- <br/>
885
- &#8220;A&#8221; &#8216;B&#8217;
886
- </h1>
887
- <p style='display:none;' class='variant-title-toc'>
888
- Clause
889
- <i>A</i>
890
- <span class='stem'>
891
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
892
- <mi>x</mi>
893
- </math>
894
- </span>
895
- </p>
896
- <p id='_'>Text</p>
897
- </div>
898
- </div>
899
- <p>
900
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
901
- </p>
902
- <div id='_' class='Section3'>
903
- <h1 class='Annex'>
904
- <b>Annex A</b>
905
- <br/>
906
- (normative)
907
- <br/>
908
- <br/>
909
- <b>Clause</b>
910
- </h1>
911
- <p style='display:none;' class='variant-title-toc'>
912
- Clause
913
- <i>A</i>
914
- <span class='stem'>
915
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
916
- <mi>x</mi>
917
- </math>
918
- </span>
919
- </p>
920
- <p id='_'>Text</p>
921
- </div>
922
- </div>
923
- </body>
924
- </html>
849
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
850
+ <head>
851
+ <style>
852
+ </style>
853
+ </head>
854
+ <body lang='EN-US' link='blue' vlink='#954F72'>
855
+ <div class='WordSection1'>
856
+ <p>&#160;</p>
857
+ </div>
858
+ <p>
859
+ <br clear='all' class='section'/>
860
+ </p>
861
+ <div class='WordSection2'>
862
+ <p>&#160;</p>
863
+ </div>
864
+ <p>
865
+ <br clear='all' class='section'/>
866
+ </p>
867
+ <div class='WordSection3'>
868
+ <p class='zzSTDTitle1'/>
869
+ <div id='_'>
870
+ <h1>
871
+ <b>Annex A</b>
872
+ <br/>
873
+ (normative).
874
+ <span style='mso-tab-count:1'>&#160; </span>
875
+ Clause
876
+ </h1>
877
+ <p id='_'>Text</p>
878
+ <div id='_'>
879
+ <h1>
880
+ <b>Annex A</b>
881
+ <br/>
882
+ (normative).
883
+ <span style='mso-tab-count:1'>&#160; </span>
884
+ Subclause
885
+ <br/>
886
+ <br/>
887
+ &#8220;A&#8221; &#8216;B&#8217;
888
+ </h1>
889
+ <p style='display:none;' class='variant-title-toc'>
890
+ Clause
891
+ <i>A</i>
892
+ <span class='stem'>
893
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
894
+ <mi>x</mi>
895
+ </math>
896
+ </span>
897
+ </p>
898
+ <p id='_'>Text</p>
899
+ </div>
900
+ </div>
901
+ <p>
902
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
903
+ </p>
904
+ <div id='_' class='Section3'>
905
+ <h1 class='Annex'>
906
+ <b>Annex A</b>
907
+ <br/>
908
+ (normative)
909
+ <br/>
910
+ <br/>
911
+ <b>Clause</b>
912
+ </h1>
913
+ <p style='display:none;' class='variant-title-toc'>
914
+ Clause
915
+ <i>A</i>
916
+ <span class='stem'>
917
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
918
+ <mi>x</mi>
919
+ </math>
920
+ </span>
921
+ </p>
922
+ <p id='_'>Text</p>
923
+ </div>
924
+ </div>
925
+ </body>
926
+ </html>
925
927
  OUTPUT
926
928
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
927
929
  .convert("test", input, true))
@@ -993,6 +995,306 @@ RSpec.describe IsoDoc do
993
995
  .to be_equivalent_to (output)
994
996
  end
995
997
 
998
+ it "adds types to ordered lists" do
999
+ input = <<~INPUT
1000
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1001
+ <bibdata/>
1002
+ <sections>
1003
+ <clause id='A' inline-header='false' obligation='normative'>
1004
+ <title>Clause</title>
1005
+ <ol id="B1">
1006
+ <li>A1
1007
+ <ol id="B2">
1008
+ <li>A2
1009
+ <ol id="B3">
1010
+ <li>A3
1011
+ <ol id="B4">
1012
+ <li>A4
1013
+ <ol id="B5">
1014
+ <li>A5
1015
+ <ol id="B6">
1016
+ <li>A6
1017
+ <ol id="B7">
1018
+ <li>A7
1019
+ <ol id="B8">
1020
+ <li>A8
1021
+ <ol id="B9">
1022
+ <li>A9
1023
+ <ol id="B0">
1024
+ <li>A0</li>
1025
+ </ol></li>
1026
+ </ol></li>
1027
+ </ol></li>
1028
+ </ol></li>
1029
+ </ol></li>
1030
+ </ol></li>
1031
+ </ol></li>
1032
+ </ol></li>
1033
+ </ol></li>
1034
+ </ol>
1035
+ </clause>
1036
+ </sections>
1037
+ </iso-standard>#{' '}
1038
+ INPUT
1039
+ presxml = <<~OUTPUT
1040
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1041
+ <bibdata/>
1042
+ <sections>
1043
+ <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1044
+ <title depth='1'>
1045
+ 1.
1046
+ <tab/>
1047
+ Clause
1048
+ </title>
1049
+ <ol id='B1' type='alphabet'>
1050
+ <li>
1051
+ A1
1052
+ <ol id='B2' type='arabic'>
1053
+ <li>
1054
+ A2
1055
+ <ol id='B3' type='roman'>
1056
+ <li>
1057
+ A3
1058
+ <ol id='B4' type='alphabet_upper'>
1059
+ <li>
1060
+ A4
1061
+ <ol id='B5' type='roman_upper'>
1062
+ <li>
1063
+ A5
1064
+ <ol id='B6' type='alphabet'>
1065
+ <li>
1066
+ A6
1067
+ <ol id='B7' type='arabic'>
1068
+ <li>
1069
+ A7
1070
+ <ol id='B8' type='roman'>
1071
+ <li>
1072
+ A8
1073
+ <ol id='B9' type='alphabet_upper'>
1074
+ <li>
1075
+ A9
1076
+ <ol id='B0' type='roman_upper'>
1077
+ <li>A0</li>
1078
+ </ol>
1079
+ </li>
1080
+ </ol>
1081
+ </li>
1082
+ </ol>
1083
+ </li>
1084
+ </ol>
1085
+ </li>
1086
+ </ol>
1087
+ </li>
1088
+ </ol>
1089
+ </li>
1090
+ </ol>
1091
+ </li>
1092
+ </ol>
1093
+ </li>
1094
+ </ol>
1095
+ </li>
1096
+ </ol>
1097
+ </clause>
1098
+ </sections>
1099
+ </iso-standard>
1100
+ OUTPUT
1101
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1102
+ .convert("test", input, true))
1103
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1104
+ .to be_equivalent_to xmlpp(presxml)
1105
+ end
1106
+
1107
+ it "considers ul when adding types to ordered lists" do
1108
+ input = <<~INPUT
1109
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1110
+ <bibdata/>
1111
+ <sections>
1112
+ <clause id='A' inline-header='false' obligation='normative'>
1113
+ <title>Clause</title>
1114
+ <ol id="B1">
1115
+ <li>A1
1116
+ <ul id="B2">
1117
+ <li>A2
1118
+ <ol id="B3">
1119
+ <li>A3
1120
+ </ol></li>
1121
+ </ul></li>
1122
+ </ol>
1123
+ </clause>
1124
+ </sections>
1125
+ </iso-standard>
1126
+ INPUT
1127
+ presxml = <<~OUTPUT
1128
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1129
+ <bibdata/>
1130
+
1131
+ <sections>
1132
+ <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1133
+ <title depth='1'>
1134
+ 1.
1135
+ <tab/>
1136
+ Clause
1137
+ </title>
1138
+ <ol id='B1' type='alphabet'>
1139
+ <li>
1140
+ A1
1141
+ <ul id='B2'>
1142
+ <li>
1143
+ A2
1144
+ <ol id='B3' type='roman'>
1145
+ <li>A3 </li>
1146
+ </ol>
1147
+ </li>
1148
+ </ul>
1149
+ </li>
1150
+ </ol>
1151
+ </clause>
1152
+ </sections>
1153
+ </iso-standard>
1154
+ OUTPUT
1155
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1156
+ .convert("test", input, true))
1157
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1158
+ .to be_equivalent_to xmlpp(presxml)
1159
+ end
1160
+
1161
+
1162
+ it "inserts toc metadata" do
1163
+ input = <<~INPUT
1164
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1165
+ <bibdata/>
1166
+ <sections>
1167
+ </sections>
1168
+ </iso-standard>
1169
+ INPUT
1170
+ presxml = <<~OUTPUT
1171
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1172
+ <bibdata/>
1173
+ <misc-container>
1174
+ <toc type='figure'>
1175
+ <title>List of figures</title>
1176
+ </toc>
1177
+ <toc type='table'>
1178
+ <title>List of tables</title>
1179
+ </toc>
1180
+ <toc type='recommendation'>
1181
+ <title>List of recommendations</title>
1182
+ </toc>
1183
+ </misc-container>
1184
+ <sections> </sections>
1185
+ </iso-standard>
1186
+ OUTPUT
1187
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1188
+ .new({ tocfigures: true,
1189
+ toctables: true,
1190
+ tocrecommendations: true })
1191
+ .convert("test", input, true))
1192
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1193
+ .to be_equivalent_to xmlpp(presxml)
1194
+ end
1195
+
1196
+ it "processes multiple-target xrefs" do
1197
+ input = <<~INPUT
1198
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1199
+ <bibdata/>
1200
+ <sections>
1201
+ <clause id="A" inline-header="false" obligation="normative">
1202
+ <title>Section</title>
1203
+ <p id="A"><xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/></xref>
1204
+ <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/>text</xref>
1205
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/></xref>
1206
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/><location target="ref3" connective="and"/></xref>
1207
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/>text</xref>
1208
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/></xref>
1209
+ <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/><location target="ref3" connective="or"/></xref>
1210
+ <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/><location target="ref3" connective="and"/><location target="ref4" connective="to"/></xref></p>
1211
+ </clause>
1212
+ <clause id="ref1"/>
1213
+ <clause id="ref2"/>
1214
+ <clause id="ref3"/>
1215
+ <clause id="ref4"/>
1216
+ </sections>
1217
+ </iso-standard>
1218
+ INPUT
1219
+ presxml = <<~OUTPUT
1220
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1221
+ <bibdata/>
1222
+
1223
+ <sections>
1224
+ <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1225
+ <title depth='1'>
1226
+ 1.
1227
+ <tab/>
1228
+ Section
1229
+ </title>
1230
+ <p id='A'>
1231
+ <xref target='ref1'>
1232
+ <location target='ref1' connective='from'/>
1233
+ <location target='ref2' connective='to'/>
1234
+ Clause 2 to 3
1235
+ </xref>
1236
+ <xref target='ref1'>
1237
+ <location target='ref1' connective='from'/>
1238
+ <location target='ref2' connective='to'/>
1239
+ text
1240
+ </xref>
1241
+ <xref target='ref1'>
1242
+ <location target='ref1' connective='and'/>
1243
+ <location target='ref2' connective='and'/>
1244
+ Clause 2 and 3
1245
+ </xref>
1246
+ <xref target='ref1'>
1247
+ <location target='ref1' connective='and'/>
1248
+ <location target='ref2' connective='and'/>
1249
+ <location target='ref3' connective='and'/>
1250
+ Clause 2, 3, and 4
1251
+ </xref>
1252
+ <xref target='ref1'>
1253
+ <location target='ref1' connective='and'/>
1254
+ <location target='ref2' connective='and'/>
1255
+ text
1256
+ </xref>
1257
+ <xref target='ref1'>
1258
+ <location target='ref1' connective='and'/>
1259
+ <location target='ref2' connective='or'/>
1260
+ Clause 2 or 3
1261
+ </xref>
1262
+ <xref target='ref1'>
1263
+ <location target='ref1' connective='and'/>
1264
+ <location target='ref2' connective='or'/>
1265
+ <location target='ref3' connective='or'/>
1266
+ Clause 2, 3, or 4
1267
+ </xref>
1268
+ <xref target='ref1'>
1269
+ <location target='ref1' connective='from'/>
1270
+ <location target='ref2' connective='to'/>
1271
+ <location target='ref3' connective='and'/>
1272
+ <location target='ref4' connective='to'/>
1273
+ Clause 2 to 3 and 4 to 5
1274
+ </xref>
1275
+ </p>
1276
+ </clause>
1277
+ <clause id='ref1' displayorder='2'>
1278
+ <title>2.</title>
1279
+ </clause>
1280
+ <clause id='ref2' displayorder='3'>
1281
+ <title>3.</title>
1282
+ </clause>
1283
+ <clause id='ref3' displayorder='4'>
1284
+ <title>4.</title>
1285
+ </clause>
1286
+ <clause id='ref4' displayorder='5'>
1287
+ <title>5.</title>
1288
+ </clause>
1289
+ </sections>
1290
+ </iso-standard>
1291
+ OUTPUT
1292
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1293
+ .convert("test", input, true))
1294
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1295
+ .to be_equivalent_to xmlpp(presxml)
1296
+ end
1297
+
996
1298
  private
997
1299
 
998
1300
  def mock_symbols
@@ -654,8 +654,9 @@ RSpec.describe IsoDoc do
654
654
  </body>
655
655
  </html>
656
656
  OUTPUT
657
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml,
658
- true))).to be_equivalent_to xmlpp(html)
657
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
658
+ .convert("test", presxml, true)))
659
+ .to be_equivalent_to xmlpp(html)
659
660
  end
660
661
 
661
662
  it "processes hidden references sections in Relaton bibliographies" do
@@ -730,14 +731,14 @@ RSpec.describe IsoDoc do
730
731
  <div>
731
732
  <h1 class='ForewordTitle'>Foreword</h1>
732
733
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
733
- <a href='#ISO712'>[110]</a>
734
- <a href='#ISBN'>[1]</a>
735
- <a href='#ISSN'>[2]</a>
734
+ [110]
735
+ [1]
736
+ [2]
736
737
  <a href='#ISO16634'>ISO 16634:-- (all parts)</a>
737
- <a href='#ref1'>ICC/167</a>
738
- <a href='#ref10'>[10]</a>
739
- <a href='#ref12'>Citn</a>
740
- <a href='#zip_ffs'>[5]</a>
738
+ ICC/167
739
+ [10]
740
+ Citn
741
+ [5]
741
742
  </p>
742
743
  </div>
743
744
  <p class='zzSTDTitle1'/>
@@ -766,7 +767,91 @@ RSpec.describe IsoDoc do
766
767
  </body>
767
768
  </html>
768
769
  OUTPUT
769
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml,
770
- true))).to be_equivalent_to xmlpp(html)
770
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
771
+ .convert("test", presxml, true)))
772
+ .to be_equivalent_to xmlpp(html)
771
773
  end
774
+
775
+ it "selects the primary identifier" do
776
+ input = <<~INPUT
777
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
778
+ <bibdata>
779
+ <language>en</language>
780
+ </bibdata>
781
+ <preface><foreword>
782
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
783
+ <eref bibitemid="ISO712"/>
784
+ </p>
785
+ </foreword></preface>
786
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
787
+ <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>
788
+ <bibitem id="ISO712" type="standard">
789
+ <title format="text/plain">Cereals or cereal products</title>
790
+ <title type="main" format="text/plain">Cereals and cereal products</title>
791
+ <docidentifier type="ISO">ISO 712</docidentifier>
792
+ <docidentifier type="IEC" primary="true">IEC 217</docidentifier>
793
+ <contributor>
794
+ <role type="publisher"/>
795
+ <organization>
796
+ <name>International Organization for Standardization</name>
797
+ </organization>
798
+ </contributor>
799
+ </bibitem>
800
+ </references></bibliography></iso-standard>
801
+ INPUT
802
+ presxml = <<~PRESXML
803
+ <foreword displayorder='1'>
804
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
805
+ <eref bibitemid='ISO712'>IEC 217</eref>
806
+ </p>
807
+ </foreword>
808
+ PRESXML
809
+ expect(xmlpp(Nokogiri::XML(
810
+ IsoDoc::PresentationXMLConvert.new({})
811
+ .convert("test", input, true),
812
+ ).at("//xmlns:foreword").to_xml))
813
+ .to be_equivalent_to xmlpp(presxml)
814
+ end
815
+
816
+ it "selects multiple primary identifiers" do
817
+ input = <<~INPUT
818
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
819
+ <bibdata>
820
+ <language>en</language>
821
+ </bibdata>
822
+ <preface><foreword>
823
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">
824
+ <eref bibitemid="ISO712"/>
825
+ </p>
826
+ </foreword></preface>
827
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
828
+ <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>
829
+ <bibitem id="ISO712" type="standard">
830
+ <title format="text/plain">Cereals or cereal products</title>
831
+ <title type="main" format="text/plain">Cereals and cereal products</title>
832
+ <docidentifier type="ISO" primary="true">ISO 712</docidentifier>
833
+ <docidentifier type="IEC" primary="true">IEC 217</docidentifier>
834
+ <contributor>
835
+ <role type="publisher"/>
836
+ <organization>
837
+ <name>International Organization for Standardization</name>
838
+ </organization>
839
+ </contributor>
840
+ </bibitem>
841
+ </references></bibliography></iso-standard>
842
+ INPUT
843
+ presxml = <<~PRESXML
844
+ <foreword displayorder='1'>
845
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
846
+ <eref bibitemid='ISO712'>ISO 712&#xA0;/ IEC 217</eref>
847
+ </p>
848
+ </foreword>
849
+ PRESXML
850
+ expect(xmlpp(Nokogiri::XML(
851
+ IsoDoc::PresentationXMLConvert.new({})
852
+ .convert("test", input, true),
853
+ ).at("//xmlns:foreword").to_xml))
854
+ .to be_equivalent_to xmlpp(presxml)
855
+ end
856
+
772
857
  end
@@ -1,7 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- =begin
5
4
  it "processes prefatory blocks" do
6
5
  input = <<~INPUT
7
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -1496,7 +1495,7 @@ RSpec.describe IsoDoc do
1496
1495
  .new({ suppressheadingnumbers: true })
1497
1496
  .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1498
1497
  end
1499
- =end
1498
+
1500
1499
  it "processes floating titles" do
1501
1500
  input = <<~INPUT
1502
1501
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -174,7 +174,7 @@ RSpec.describe IsoDoc do
174
174
  <sup>1</sup>
175
175
  </a>
176
176
  </p>
177
- <table id="tableD-1" class="MsoISOTable" style="border-width:1px;border-spacing:0;width:70%;page-break-after: avoid;page-break-inside: avoid;" title="tool tip" >
177
+ <table id="tableD-1" class="MsoISOTable" style="border-width:1px;border-spacing:0;width:70%;page-break-after: avoid;page-break-inside: avoid;table-layout:fixed;" title="tool tip" >
178
178
  <caption>
179
179
  <span style="display:none">long desc</span>
180
180
  </caption>