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
@@ -925,87 +925,23 @@ RSpec.describe IsoDoc do
925
925
  .to receive(:inkscape_installed?)
926
926
 
927
927
  input = <<~INPUT
928
- <iso-standard xmlns="http://riboseinc.com/isoxml">
929
- <preface><foreword>
930
- <figure id="figureA-1">
931
- <image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
932
- <image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
933
- <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
934
- </figure>
935
- </foreword></preface>
936
- </iso-standard>
937
- INPUT
938
- presxml = <<~OUTPUT
939
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
928
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
940
929
  <preface>
941
- <foreword displayorder='1'>
942
- <figure id='figureA-1'>
943
- <name>Figure 1</name>
944
- <image src='spec/assets/odf.svg' mimetype='image/svg+xml'>
945
- <emf src='spec/assets/odf.emf'/>
946
- </image>
947
- <image src='spec/assets/odf1.svg' mimetype='image/svg+xml'/>
948
- <image src='' id='_d3731866-1a07-435a-a6c2-1acd41023a4e' mimetype='image/svg+xml' height='auto' width='auto'>
949
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
950
- <circle fill='#009' r='45' cx='50' cy='50'/>
951
- <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
952
- </svg>
953
- </image>
930
+ <foreword>
931
+ <figure id="figureA-1">
932
+ <image src="spec/assets/odf.svg" mimetype="image/svg+xml"/>
933
+ <image src="spec/assets/odf1.svg" mimetype="image/svg+xml"/>
934
+ <image src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj4KICA8Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPgogIDxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz4KPC9zdmc+Cg==" id="_d3731866-1a07-435a-a6c2-1acd41023a4e" mimetype="image/svg+xml" height="auto" width="auto"/>
954
935
  </figure>
955
936
  </foreword>
956
937
  </preface>
957
938
  </iso-standard>
958
- OUTPUT
959
- output = <<~OUTPUT
960
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
961
- <head>
962
- <style>
963
- </style>
964
- </head>
965
- <body lang='EN-US' link='blue' vlink='#954F72'>
966
- <div class='WordSection1'>
967
- <p>&#160;</p>
968
- </div>
969
- <p>
970
- <br clear='all' class='section'/>
971
- </p>
972
- <div class='WordSection2'>
973
- <p>
974
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
975
- </p>
976
- <div>
977
- <h1 class='ForewordTitle'>Foreword</h1>
978
- <div id='figureA-1' class='figure'>
979
- <img src='spec/assets/odf.emf'/>
980
- <img src='spec/assets/odf1.svg'/>
981
- <img src='' height='auto' width='auto'/>
982
- <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
983
- </div>
984
- </div>
985
- <p>&#160;</p>
986
- </div>
987
- <p>
988
- <br clear='all' class='section'/>
989
- </p>
990
- <div class='WordSection3'>
991
- <p class='zzSTDTitle1'/>
992
- </div>
993
- </body>
994
- </html>
995
- OUTPUT
996
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
997
- .convert("test", input, true)
998
- .gsub(/&lt;/, "&#x3c;")
999
- .gsub(%r{data:application/x-msmetafile[^"']+},
1000
- "data:application/x-msmetafile")))
1001
- .to be_equivalent_to xmlpp(presxml
1002
- .gsub(%r{data:application/x-msmetafile[^"']+},
1003
- "data:application/x-msmetafile"))
1004
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
1005
- .convert("test", presxml, true)
1006
- .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
1007
- .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
1008
- .to be_equivalent_to xmlpp(output)
939
+ INPUT
940
+ expect do
941
+ IsoDoc::PresentationXMLConvert.new({})
942
+ .convert("test", input, true)
943
+ end.to raise_error("Inkscape missing in PATH, unable" \
944
+ "to convert EMF to SVG. Aborting.")
1009
945
  end
1010
946
  end
1011
947
 
@@ -1593,7 +1529,7 @@ RSpec.describe IsoDoc do
1593
1529
 
1594
1530
 
1595
1531
  <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<i>Oryza sativa</i> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p>
1596
- <p class="QuoteAttribution">&#8212; ISO, <a href="#ISO7301">ISO 7301:2011, Clause 1</a></p></div>
1532
+ <p class="QuoteAttribution">&#8212; ISO, ISO 7301:2011, Clause 1</p></div>
1597
1533
  </div>
1598
1534
  <p class="zzSTDTitle1"/>
1599
1535
  </div>