isodoc 1.0.24 → 1.0.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +14 -4
  3. data/.github/workflows/ubuntu.yml +19 -5
  4. data/.github/workflows/windows.yml +14 -4
  5. data/isodoc.gemspec +1 -1
  6. data/lib/isodoc-yaml/i18n-en.yaml +3 -1
  7. data/lib/isodoc-yaml/i18n-fr.yaml +3 -1
  8. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +3 -1
  9. data/lib/isodoc/convert.rb +1 -0
  10. data/lib/isodoc/function/blocks.rb +43 -49
  11. data/lib/isodoc/function/{blocks_example.rb → blocks_example_note.rb} +57 -2
  12. data/lib/isodoc/function/cleanup.rb +16 -2
  13. data/lib/isodoc/function/i18n.rb +1 -0
  14. data/lib/isodoc/function/inline.rb +79 -77
  15. data/lib/isodoc/function/inline_simple.rb +72 -0
  16. data/lib/isodoc/function/lists.rb +12 -6
  17. data/lib/isodoc/function/references.rb +51 -39
  18. data/lib/isodoc/function/reqt.rb +13 -4
  19. data/lib/isodoc/function/section.rb +19 -8
  20. data/lib/isodoc/function/table.rb +3 -4
  21. data/lib/isodoc/function/terms.rb +1 -1
  22. data/lib/isodoc/function/to_word_html.rb +23 -13
  23. data/lib/isodoc/function/utils.rb +13 -6
  24. data/lib/isodoc/function/xref_counter.rb +43 -9
  25. data/lib/isodoc/function/xref_gen.rb +2 -1
  26. data/lib/isodoc/function/xref_gen_seq.rb +11 -10
  27. data/lib/isodoc/function/xref_sect_gen.rb +24 -24
  28. data/lib/isodoc/headlesshtml_convert.rb +5 -0
  29. data/lib/isodoc/html_convert.rb +5 -0
  30. data/lib/isodoc/html_function/footnotes.rb +3 -3
  31. data/lib/isodoc/html_function/html.rb +16 -1
  32. data/lib/isodoc/html_function/postprocess.rb +6 -5
  33. data/lib/isodoc/metadata.rb +10 -3
  34. data/lib/isodoc/metadata_date.rb +19 -7
  35. data/lib/isodoc/pdf_convert.rb +5 -0
  36. data/lib/isodoc/version.rb +1 -1
  37. data/lib/isodoc/word_convert.rb +5 -0
  38. data/lib/isodoc/word_function/body.rb +13 -51
  39. data/lib/isodoc/word_function/footnotes.rb +3 -3
  40. data/lib/isodoc/word_function/inline.rb +75 -0
  41. data/lib/isodoc/word_function/postprocess.rb +13 -2
  42. data/lib/isodoc/word_function/table.rb +3 -3
  43. data/lib/isodoc/xslfo_convert.rb +5 -0
  44. data/spec/assets/i18n.yaml +4 -1
  45. data/spec/assets/odf.emf +0 -0
  46. data/spec/assets/odf.svg +4 -0
  47. data/spec/assets/odf1.svg +4 -0
  48. data/spec/isodoc/blocks_spec.rb +274 -51
  49. data/spec/isodoc/cleanup_spec.rb +317 -25
  50. data/spec/isodoc/footnotes_spec.rb +20 -5
  51. data/spec/isodoc/i18n_spec.rb +12 -12
  52. data/spec/isodoc/inline_spec.rb +299 -4
  53. data/spec/isodoc/lists_spec.rb +8 -8
  54. data/spec/isodoc/metadata_spec.rb +112 -3
  55. data/spec/isodoc/postproc_spec.rb +39 -21
  56. data/spec/isodoc/ref_spec.rb +121 -52
  57. data/spec/isodoc/section_spec.rb +236 -207
  58. data/spec/isodoc/table_spec.rb +28 -28
  59. data/spec/isodoc/terms_spec.rb +57 -13
  60. data/spec/isodoc/xref_spec.rb +218 -71
  61. metadata +10 -5
@@ -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">
@@ -715,7 +715,7 @@ INPUT
715
715
  OUTPUT
716
716
  end
717
717
 
718
- it "breaks up very long strings in tables" do
718
+ it "does not break up very long strings in tables by default" do
719
719
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
720
720
  <html xmlns:epub="http://www.idpf.org/2007/ops">
721
721
  <head>
@@ -739,6 +739,7 @@ INPUT
739
739
  <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
740
740
  <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
741
741
  </tr>
742
+ </thead>
742
743
  <tbody>
743
744
  <tr>
744
745
  <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
@@ -775,26 +776,102 @@ INPUT
775
776
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
776
777
  <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
777
778
  </tr>
779
+ </thead>
778
780
  <tbody>
779
781
  <tr>
780
782
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
781
- http://www.example.com/
782
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/
783
- BBBBBBBBBBBBBBBBBBBBBBBBBBBB
783
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
784
784
  </td>
785
785
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
786
- http://www.example.com/
787
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
788
- AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
786
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB </td>
787
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
788
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
789
+ </td>
790
+ </tr>
791
+ </tbody>
792
+ </table>
793
+ </div>
794
+ </div>
795
+ </body>
796
+ </head>
797
+ </html>
798
+ OUTPUT
799
+ end
800
+
801
+ it "does not break up very long strings in tables on request in HTML" do
802
+ expect(xmlpp(IsoDoc::HtmlConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
803
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
804
+ <head>
805
+ <title>test</title>
806
+ <body lang="EN-US" link="blue" vlink="#954F72">
807
+ <div class="WordSection1">
808
+ <p>&#160;</p>
809
+ </div>
810
+ <br clear="all" class="section"/>
811
+ <div class="WordSection2">
812
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
813
+ <div>
814
+ <h1 class="ForewordTitle">Foreword</h1>
815
+ <p class="TableTitle" align="center">
816
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
817
+ </p>
818
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
819
+ <thead>
820
+ <tr>
821
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
822
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
823
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
824
+ </tr>
825
+ </thead>
826
+ <tbody>
827
+ <tr>
828
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
829
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
830
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
831
+ </tr>
832
+ </tbody>
833
+ </table>
834
+ </div>
835
+ </div>
836
+ </body>
837
+ </html>
838
+ INPUT
839
+ <?xml version='1.0'?>
840
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
841
+ <head>
842
+ <title>test</title>
843
+ <body lang='EN-US' link='blue' vlink='#954F72'>
844
+ <div class='WordSection1'>
845
+ <p>&#xA0;</p>
846
+ </div>
847
+ <br clear='all' class='section'/>
848
+ <div class='WordSection2'>
849
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
850
+ <div>
851
+ <h1 class='ForewordTitle'>Foreword</h1>
852
+ <p class='TableTitle' align='center'>
853
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
854
+ </p>
855
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
856
+ <thead>
857
+ <tr>
858
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
859
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
860
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
861
+ </tr>
862
+ </thead>
863
+ <tbody>
864
+ <tr>
865
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
866
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
789
867
  </td>
868
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
869
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
790
870
  <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
791
- www.example.com/
792
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
793
- ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
871
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
794
872
  </td>
795
873
  </tr>
796
874
  </tbody>
797
- </thead>
798
875
  </table>
799
876
  </div>
800
877
  </div>
@@ -804,7 +881,8 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
804
881
  OUTPUT
805
882
  end
806
883
 
807
- it "breaks up very long strings in tables (Word)" do
884
+
885
+ it "does not break up very long strings in tables by default (Word)" do
808
886
  expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
809
887
  <html xmlns:epub="http://www.idpf.org/2007/ops">
810
888
  <head>
@@ -828,16 +906,17 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
828
906
  <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
829
907
  <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
830
908
  </tr>
909
+ </thead>
831
910
  <tbody>
832
911
  <tr>
833
912
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
834
- http://www.example.com/ &amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
913
+ http://www.example.com/&amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
835
914
  </td>
836
915
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
837
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
916
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
838
917
  </td>
839
918
  <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
840
- www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
919
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
841
920
  </td>
842
921
  </tr>
843
922
  </tbody>
@@ -870,20 +949,20 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
870
949
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
871
950
  <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
872
951
  </tr>
952
+ </thead>
873
953
  <tbody>
874
954
  <tr>
875
955
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
876
- http://www.example.com/ &amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
956
+ http://www.example.com/&amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
877
957
  </td>
878
958
  <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
879
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
959
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
880
960
  </td>
881
961
  <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
882
- www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
962
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
883
963
  </td>
884
964
  </tr>
885
965
  </tbody>
886
- </thead>
887
966
  </table>
888
967
  </div>
889
968
  </div>
@@ -893,4 +972,217 @@ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
893
972
  OUTPUT
894
973
  end
895
974
 
975
+ it "breaks up very long strings in tables on request (Word)" do
976
+ expect(xmlpp(IsoDoc::WordConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
977
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
978
+ <head>
979
+ <title>test</title>
980
+ <body lang="EN-US" link="blue" vlink="#954F72">
981
+ <div class="WordSection1">
982
+ <p>&#160;</p>
983
+ </div>
984
+ <br clear="all" class="section"/>
985
+ <div class="WordSection2">
986
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
987
+ <div>
988
+ <h1 class="ForewordTitle">Foreword</h1>
989
+ <p class="TableTitle" align="center">
990
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
991
+ </p>
992
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
993
+ <thead>
994
+ <tr>
995
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
996
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
997
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
998
+ </tr>
999
+ </thead>
1000
+ <tbody>
1001
+ <tr>
1002
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1003
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1004
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1005
+ </tr>
1006
+ </tbody>
1007
+ </table>
1008
+ </div>
1009
+ </div>
1010
+ </body>
1011
+ </html>
1012
+ INPUT
1013
+ <?xml version='1.0'?>
1014
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
1015
+ <head>
1016
+ <title>test</title>
1017
+ <body lang='EN-US' link='blue' vlink='#954F72'>
1018
+ <div class='WordSection1'>
1019
+ <p>&#xA0;</p>
1020
+ </div>
1021
+ <br clear='all' class='section'/>
1022
+ <div class='WordSection2'>
1023
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1024
+ <div>
1025
+ <h1 class='ForewordTitle'>Foreword</h1>
1026
+ <p class='TableTitle' align='center'>
1027
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
1028
+ </p>
1029
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
1030
+ <thead>
1031
+ <tr>
1032
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
1033
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
1034
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
1035
+ </tr>
1036
+ </thead>
1037
+ <tbody>
1038
+ <tr>
1039
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
1040
+ http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
1041
+ </td>
1042
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
1043
+ http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
1044
+ </td>
1045
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
1046
+ www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
1047
+ </td>
1048
+ </tr>
1049
+ </tbody>
1050
+ </table>
1051
+ </div>
1052
+ </div>
1053
+ </body>
1054
+ </head>
1055
+ </html>
1056
+ OUTPUT
1057
+ end
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
+
896
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>