isodoc 1.7.3.1 → 1.7.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +7 -4
  3. data/lib/isodoc/class_utils.rb +2 -2
  4. data/lib/isodoc/convert.rb +2 -0
  5. data/lib/isodoc/function/blocks_example_note.rb +85 -79
  6. data/lib/isodoc/function/cleanup.rb +181 -175
  7. data/lib/isodoc/function/inline.rb +110 -108
  8. data/lib/isodoc/function/inline_simple.rb +55 -55
  9. data/lib/isodoc/function/lists.rb +75 -71
  10. data/lib/isodoc/function/references.rb +165 -160
  11. data/lib/isodoc/function/section.rb +140 -190
  12. data/lib/isodoc/function/section_titles.rb +82 -0
  13. data/lib/isodoc/function/table.rb +90 -87
  14. data/lib/isodoc/function/terms.rb +58 -56
  15. data/lib/isodoc/function/to_word_html.rb +3 -1
  16. data/lib/isodoc/function/utils.rb +34 -14
  17. data/lib/isodoc/html_function/comments.rb +107 -111
  18. data/lib/isodoc/html_function/footnotes.rb +68 -67
  19. data/lib/isodoc/html_function/html.rb +113 -103
  20. data/lib/isodoc/html_function/mathvariant_to_plain.rb +5 -3
  21. data/lib/isodoc/presentation_function/block.rb +73 -78
  22. data/lib/isodoc/presentation_function/concept.rb +68 -0
  23. data/lib/isodoc/presentation_function/image.rb +112 -0
  24. data/lib/isodoc/presentation_function/inline.rb +6 -39
  25. data/lib/isodoc/presentation_function/math.rb +9 -0
  26. data/lib/isodoc/presentation_function/section.rb +12 -1
  27. data/lib/isodoc/presentation_xml_convert.rb +3 -0
  28. data/lib/isodoc/version.rb +1 -1
  29. data/lib/isodoc/word_function/body.rb +176 -174
  30. data/lib/isodoc/word_function/comments.rb +117 -112
  31. data/lib/isodoc/word_function/footnotes.rb +88 -86
  32. data/lib/isodoc/word_function/inline.rb +42 -67
  33. data/lib/isodoc/word_function/postprocess_cover.rb +121 -110
  34. data/lib/isodoc/xref/xref_gen.rb +153 -150
  35. data/lib/isodoc/xslfo_convert.rb +2 -2
  36. data/spec/assets/odf.svg +1 -4
  37. data/spec/isodoc/blocks_spec.rb +187 -32
  38. data/spec/isodoc/inline_spec.rb +300 -116
  39. data/spec/isodoc/postproc_spec.rb +38 -0
  40. data/spec/isodoc/presentation_xml_spec.rb +144 -0
  41. data/spec/isodoc/section_spec.rb +764 -0
  42. data/spec/isodoc/terms_spec.rb +116 -0
  43. metadata +63 -18
@@ -738,10 +738,13 @@ RSpec.describe IsoDoc do
738
738
  <foreword displayorder="1">
739
739
  <figure id='figureA-1'>
740
740
  <name>Figure 1</name>
741
- <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
742
- <circle fill='#009' r='45' cx='50' cy='50'/>
743
- <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
744
- </svg>
741
+ <image id='_d3731866-1a07-435a-a6c2-1acd41023a4e' src='' mimetype='image/svg+xml' height='auto' width='auto'>
742
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
743
+ <circle fill='#009' r='45' cx='50' cy='50'/>
744
+ <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
745
+ </svg>
746
+ <emf src='data:application/x-msmetafile;base64,AQAAAPgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAVAQAACgAAAACAAAARgAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADEAIAAoAGMANABlADgAZgA5AGUALAAgADIAMAAyADEALQAwADUALQAyADQAKQAgAAAAaQBtAGEAZwBlADIAMAAyADEAMAA5ADIANQAtADMANQAzADAAOAAtADEAaAA2AG8AeABmAGYALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAVAQAAA=='/>
747
+ </image>
745
748
  </figure>
746
749
  </foreword>
747
750
  </preface>
@@ -787,7 +790,7 @@ RSpec.describe IsoDoc do
787
790
  <div>
788
791
  <h1 class='ForewordTitle'>Foreword</h1>
789
792
  <div id='figureA-1' class='figure'>
790
- <img src='_.emf'/>
793
+ <img src='_.emf' height='auto' width='auto'/>
791
794
  <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
792
795
  </div>
793
796
  </div>
@@ -805,7 +808,9 @@ RSpec.describe IsoDoc do
805
808
 
806
809
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
807
810
  .convert("test", input, true)
808
- .gsub(/&lt;/, "&#x3c;"))).to be_equivalent_to xmlpp(presxml)
811
+ .gsub(/&lt;/, "&#x3c;")
812
+ .gsub(%r{data:application/x-msmetafile[^"']+}, 'data:application/x-msmetafile')
813
+ )).to be_equivalent_to xmlpp(presxml.gsub(%r{data:application/x-msmetafile[^"']+}, 'data:application/x-msmetafile'))
809
814
  expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({})
810
815
  .convert("test", presxml, true)))).to be_equivalent_to xmlpp(html)
811
816
  expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
@@ -829,6 +834,31 @@ RSpec.describe IsoDoc do
829
834
  </foreword></preface>
830
835
  </iso-standard>
831
836
  INPUT
837
+ presxml = <<~OUTPUT
838
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
839
+ <preface>
840
+ <foreword displayorder='1'>
841
+ <figure id='figureA-1'>
842
+ <name>Figure 1</name>
843
+ <image src='spec/assets/odf.svg' mimetype='image/svg+xml'>
844
+ <emf src='spec/assets/odf.emf'/>
845
+ </image>
846
+ <image src='spec/assets/odf1.svg' mimetype='image/svg+xml'>
847
+ <emf src='data:application/x-msmetafile;base64,AQAAAMwAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAKAQAACgAAAACAAAALwAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADEAIAAoAGMANABlADgAZgA5AGUALAAgADIAMAAyADEALQAwADUALQAyADQAKQAgAAAAbwBkAGYAMQAuAGUAbQBmAAAAAAAAAAAAEQAAAAwAAAABAAAAJAAAACQAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAACAAAARgAAACwAAAAgAAAAU2NyZWVuPTEwMjA1eDEzMTgxcHgsIDIxNngyNzltbQBGAAAAMAAAACMAAABEcmF3aW5nPTEwMC4weDEwMC4wcHgsIDI2LjV4MjYuNW1tAAASAAAADAAAAAEAAAATAAAADAAAAAIAAAAWAAAADAAAABgAAAAYAAAADAAAAAAAAAAUAAAADAAAAA0AAAAnAAAAGAAAAAEAAAAAAAAAAACZAAYAAAAlAAAADAAAAAEAAAA7AAAACAAAABsAAAAQAAAApAQAAHECAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAApAQAAKgDAACoAwAApAQAAHECAACkBAAABQAAADQAAAAAAAAAAAAAAP//////////AwAAADoBAACkBAAAPwAAAKgDAAA/AAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAAA/AAAAOgEAADoBAAA/AAAAcQIAAD8AAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAqAMAAD8AAACkBAAAOgEAAKQEAABxAgAAPQAAAAgAAAA8AAAACAAAAD4AAAAYAAAAAAAAAAAAAAD//////////yUAAAAMAAAABQAAgCgAAAAMAAAAAQAAACcAAAAYAAAAAQAAAAAAAAD///8ABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACdAQAARQEAADYAAAAQAAAAzwMAAEUBAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAXwQAAO0BAABkBAAA4wIAANsDAACRAwAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAFIDAAA+BAAAYQIAAHMEAACdAQAADgQAADYAAAAQAAAAnQEAAMkCAAA2AAAAEAAAAOICAADJAgAANgAAABAAAADiAgAAGgIAADYAAAAQAAAAnQEAABoCAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAADgAAABQAAAAAAAAAAAAAACgEAAA='/>
848
+ </image>
849
+ <image src='' id='_d3731866-1a07-435a-a6c2-1acd41023a4e' mimetype='image/svg+xml' height='auto' width='auto'>
850
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
851
+ <circle fill='#009' r='45' cx='50' cy='50'/>
852
+ <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
853
+ </svg>
854
+ <emf src='data:application/x-msmetafile;base64,AQAAAPgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAVAQAACgAAAACAAAARQAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADEAIAAoAGMANABlADgAZgA5AGUALAAgADIAMAAyADEALQAwADUALQAyADQAKQAgAAAAaQBtAGEAZwBlADIAMAAyADEAMAA5ADIANQAtADMANAA4ADgANQAtAHkAeQA0ADkANQA2AC4AZQBtAGYAAAAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAVAQAAA=='/>
855
+ </image>
856
+ <image src='data:application/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9Ii4uLy4uLy4uL3hzbC9yZXNfZG9jL2ltZ2ZpbGUueHNsIj8+CjwhRE9DVFlQRSBpbWdmaWxlLmNvbnRlbnQgU1lTVEVNICIuLi8uLi8uLi9kdGQvdGV4dC5lbnQiPgo8aW1nZmlsZS5jb250ZW50IG1vZHVsZT0iZnVuZGFtZW50YWxzX29mX3Byb2R1Y3RfZGVzY3JpcHRpb25fYW5kX3N1cHBvcnQiIGZpbGU9ImFjdGlvbl9zY2hlbWFleHBnMS54bWwiPgo8aW1nIHNyYz0iYWN0aW9uX3NjaGVtYWV4cGcxLmdpZiI+CjxpbWcuYXJlYSBzaGFwZT0icmVjdCIgY29vcmRzPSIyMTAsMTg2LDM0MywyMjciIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9iYXNpY19hdHRyaWJ1dGVfc2NoZW1hL2Jhc2ljX2F0dHJpYnV0ZV9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMTAsMTAsOTYsNTEiIGhyZWY9Ii4uLy4uL3Jlc291cmNlcy9hY3Rpb25fc2NoZW1hL2FjdGlvbl9zY2hlbWEueG1sIiAvPgo8aW1nLmFyZWEgc2hhcGU9InJlY3QiIGNvb3Jkcz0iMjEwLDI2NCwzNTgsMzA1IiBocmVmPSIuLi8uLi9yZXNvdXJjZXMvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEvc3VwcG9ydF9yZXNvdXJjZV9zY2hlbWEueG1sIiAvPgo8L2ltZz4KPC9pbWdmaWxlLmNvbnRlbnQ+Cg==' height='20' width='auto' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f2' mimetype='application/xml'/>
857
+ </figure>
858
+ </foreword>
859
+ </preface>
860
+ </iso-standard>
861
+ OUTPUT
832
862
  output = <<~OUTPUT
833
863
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
834
864
  <head>
@@ -850,9 +880,10 @@ RSpec.describe IsoDoc do
850
880
  <h1 class='ForewordTitle'>Foreword</h1>
851
881
  <div id='figureA-1' class='figure'>
852
882
  <img src='spec/assets/odf.emf'/>
853
- <img src='spec/assets/odf1.emf'/>
883
+ <img src='_.emf'/>
854
884
  <img src='_.emf' height='auto' width='auto'/>
855
885
  <img src='_.xml' height='20' width='auto'/>
886
+ <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
856
887
  </div>
857
888
  </div>
858
889
  <p>&#160;</p>
@@ -866,8 +897,14 @@ RSpec.describe IsoDoc do
866
897
  </body>
867
898
  </html>
868
899
  OUTPUT
900
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
901
+ .convert("test", input, true)
902
+ .gsub(/&lt;/, "&#x3c;")
903
+ .gsub(%r{data:application/x-msmetafile[^"']+}, 'data:application/x-msmetafile')))
904
+ .to be_equivalent_to xmlpp(presxml
905
+ .gsub( %r{data:application/x-msmetafile[^"']+}, 'data:application/x-msmetafile'))
869
906
  expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
870
- .convert("test", input, true)
907
+ .convert("test", presxml, true)
871
908
  .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.emf['"]/, "'_.emf'")
872
909
  .gsub(/['"][^'".]+\.(gif|xml)['"]/, "'_.\\1'")
873
910
  .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
@@ -877,9 +914,9 @@ RSpec.describe IsoDoc do
877
914
  context "disable inkscape" do
878
915
  it "converts SVG (Word) with inkscape disabled" do
879
916
  FileUtils.rm_rf "spec/assets/odf1.emf"
880
- allow(IsoDoc::WordFunction::Body)
917
+ allow(IsoDoc::PresentationXMLConvert)
881
918
  .to receive(:inkscape_installed?).and_return(nil)
882
- allow_any_instance_of(IsoDoc::WordFunction::Body)
919
+ allow_any_instance_of(IsoDoc::PresentationXMLConvert)
883
920
  .to receive(:inkscape_installed?)
884
921
 
885
922
  input = <<~INPUT
@@ -893,6 +930,27 @@ RSpec.describe IsoDoc do
893
930
  </foreword></preface>
894
931
  </iso-standard>
895
932
  INPUT
933
+ presxml = <<~OUTPUT
934
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
935
+ <preface>
936
+ <foreword displayorder='1'>
937
+ <figure id='figureA-1'>
938
+ <name>Figure 1</name>
939
+ <image src='spec/assets/odf.svg' mimetype='image/svg+xml'>
940
+ <emf src='spec/assets/odf.emf'/>
941
+ </image>
942
+ <image src='spec/assets/odf1.svg' mimetype='image/svg+xml'/>
943
+ <image src='' id='_d3731866-1a07-435a-a6c2-1acd41023a4e' mimetype='image/svg+xml' height='auto' width='auto'>
944
+ <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'>
945
+ <circle fill='#009' r='45' cx='50' cy='50'/>
946
+ <path d='M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z' fill='#FFF'/>
947
+ </svg>
948
+ </image>
949
+ </figure>
950
+ </foreword>
951
+ </preface>
952
+ </iso-standard>
953
+ OUTPUT
896
954
  output = <<~OUTPUT
897
955
  <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
898
956
  <head>
@@ -915,7 +973,8 @@ RSpec.describe IsoDoc do
915
973
  <div id='figureA-1' class='figure'>
916
974
  <img src='spec/assets/odf.emf'/>
917
975
  <img src='spec/assets/odf1.svg'/>
918
- <img src='_.svg' height='auto' width='auto'/>
976
+ <img src='' height='auto' width='auto'/>
977
+ <p class='FigureTitle' style='text-align:center;'>Figure 1</p>
919
978
  </div>
920
979
  </div>
921
980
  <p>&#160;</p>
@@ -929,8 +988,14 @@ RSpec.describe IsoDoc do
929
988
  </body>
930
989
  </html>
931
990
  OUTPUT
991
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
992
+ .convert("test", input, true)
993
+ .gsub(/&lt;/, "&#x3c;")
994
+ .gsub(%r{data:application/x-msmetafile[^"']+}, 'data:application/x-msmetafile')))
995
+ .to be_equivalent_to xmlpp(presxml
996
+ .gsub( %r{data:application/x-msmetafile[^"']+}, 'data:application/x-msmetafile'))
932
997
  expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({})
933
- .convert("test", input, true)
998
+ .convert("test", presxml, true)
934
999
  .gsub(/['"][^'".]+(?<!odf1)(?<!odf)\.svg['"]/, "'_.svg'")
935
1000
  .gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))))
936
1001
  .to be_equivalent_to xmlpp(output)
@@ -2433,10 +2498,14 @@ RSpec.describe IsoDoc do
2433
2498
  <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2434
2499
  <sections>
2435
2500
  <figure id='_'>
2436
- <image src='action_schemaexpg1.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto'/>
2501
+ <image src='action_schemaexpg1.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto'>
2502
+ <emf src='./action_schemaexpg1.emf'/>
2503
+ </image>
2437
2504
  </figure>
2438
2505
  <figure id='_'>
2439
- <image src='action_schemaexpg2.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto' alt='Workmap'/>
2506
+ <image src='action_schemaexpg2.svg' id='_' mimetype='image/svg+xml' height='auto' width='auto' alt='Workmap'>
2507
+ <emf src='./action_schemaexpg2.emf'/>
2508
+ </image>
2440
2509
  </figure>
2441
2510
  </sections>
2442
2511
  <bibliography>
@@ -2450,7 +2519,10 @@ RSpec.describe IsoDoc do
2450
2519
  OUTPUT
2451
2520
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2452
2521
  .convert("test", input, true))
2453
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
2522
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")
2523
+ .gsub(%r{"\.\\}, '"./')
2524
+ .gsub(%r{'\.\\}, "'./")
2525
+ )
2454
2526
  .to be_equivalent_to xmlpp(output)
2455
2527
  end
2456
2528
 
@@ -2534,52 +2606,131 @@ RSpec.describe IsoDoc do
2534
2606
  </sections>
2535
2607
  </standard-document>
2536
2608
  INPUT
2609
+ presxml = <<~INPUT
2610
+ <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation" version="1.10.2">
2611
+ <bibdata type="standard">
2612
+ <title language="en" format="text/plain">Document title</title>
2613
+ <language current="true">en</language>
2614
+ <script current="true">Latn</script>
2615
+ <status>
2616
+ <stage language="">published</stage>
2617
+ </status>
2618
+ <copyright>
2619
+ <from>2021</from>
2620
+ </copyright>
2621
+ <ext>
2622
+ <doctype language="">article</doctype>
2623
+ </ext>
2624
+ </bibdata>
2625
+ <sections>
2626
+ <clause id="clause1" inline-header="false" obligation="normative" displayorder="1">
2627
+ <title depth="1">1.<tab/>Clause 1</title>
2628
+ <clause id="clause1A" inline-header="false" obligation="normative">
2629
+ <title depth="2">1.1.<tab/>Clause 1A</title>
2630
+ <clause id="clause1Aa" inline-header="false" obligation="normative">
2631
+ <title depth="3">1.1.1.<tab/>Clause 1Aa</title>
2632
+ </clause>
2633
+ <clause id="clause1Ab" inline-header="false" obligation="normative">
2634
+ <title depth="3">1.1.2.<tab/>Clause 1Ab</title>
2635
+ </clause>
2636
+ </clause>
2637
+ <clause id="clause1B" inline-header="false" obligation="normative">
2638
+ <title depth="2">1.2.<tab/>Clause 1B</title>
2639
+ <clause id="clause1Ba" inline-header="false" obligation="normative">
2640
+ <title depth="3">1.2.1.<tab/>Clause 1Ba</title>
2641
+ </clause>
2642
+ </clause>
2643
+ </clause>
2644
+ <clause id="clause2" inline-header="false" obligation="normative" displayorder="2">
2645
+ <title depth="1">2.<tab/>Clause 2</title>
2646
+ <p id="A">And introducing: </p>
2647
+ <toc>
2648
+ <ul id="B">
2649
+ <li>
2650
+ <xref target="clause1A">1.1<tab/>Clause 1A</xref>
2651
+ </li>
2652
+ <li>
2653
+ <ul id="C">
2654
+ <li>
2655
+ <xref target="clause1Aa">1.1.1<tab/>Clause 1Aa</xref>
2656
+ </li>
2657
+ <li>
2658
+ <xref target="clause1Ab">1.1.2<tab/>Clause 1Ab</xref>
2659
+ </li>
2660
+ </ul>
2661
+ </li>
2662
+ <li>
2663
+ <xref target="clause1B">1.2<tab/>Clause 1B</xref>
2664
+ </li>
2665
+ <li>
2666
+ <ul id="D">
2667
+ <li>
2668
+ <xref target="clause1Ba">1.2.1<tab/>Clause 1Ba</xref>
2669
+ </li>
2670
+ </ul>
2671
+ </li>
2672
+ </ul>
2673
+ </toc>
2674
+ <toc>
2675
+ <ul id="E">
2676
+ <li>
2677
+ <xref target="clause1A">1.1<tab/>Clause 1A</xref>
2678
+ </li>
2679
+ <li>
2680
+ <xref target="clause1B">1.2<tab/>Clause 1B</xref>
2681
+ </li>
2682
+ </ul>
2683
+ </toc>
2684
+ </clause>
2685
+ </sections>
2686
+ </standard-document>
2687
+ INPUT
2537
2688
  output = <<~OUTPUT
2538
- #{HTML_HDR}
2539
- <p class='zzSTDTitle1'>Document title</p>
2689
+ #{HTML_HDR}
2690
+ <p class='zzSTDTitle1'>Document title</p>
2540
2691
  <div id='clause1'>
2541
- <h1>Clause 1</h1>
2692
+ <h1>1.&#160; Clause 1</h1>
2542
2693
  <div id='clause1A'>
2543
- <h2>Clause 1A</h2>
2694
+ <h2>1.1.&#160; Clause 1A</h2>
2544
2695
  <div id='clause1Aa'>
2545
- <h3>Clause 1Aa</h3>
2696
+ <h3>1.1.1.&#160; Clause 1Aa</h3>
2546
2697
  </div>
2547
2698
  <div id='clause1Ab'>
2548
- <h3>Clause 1Ab</h3>
2699
+ <h3>1.1.2.&#160; Clause 1Ab</h3>
2549
2700
  </div>
2550
2701
  </div>
2551
2702
  <div id='clause1B'>
2552
- <h2>Clause 1B</h2>
2703
+ <h2>1.2.&#160; Clause 1B</h2>
2553
2704
  <div id='clause1Ba'>
2554
- <h3>Clause 1Ba</h3>
2705
+ <h3>1.2.1.&#160; Clause 1Ba</h3>
2555
2706
  </div>
2556
2707
  </div>
2557
2708
  </div>
2558
2709
  <div id='clause2'>
2559
- <h1>Clause 2</h1>
2710
+ <h1>2.&#160; Clause 2</h1>
2560
2711
  <p id='A'>And introducing: </p>
2561
2712
  <div class='toc'>
2562
2713
  <ul id='B'>
2563
2714
  <li>
2564
- <a href='#clause1A'>Clause 1A</a>
2715
+ <a href='#clause1A'>1.1&#160; Clause 1A</a>
2565
2716
  </li>
2566
2717
  <li>
2567
2718
  <ul id='C'>
2568
2719
  <li>
2569
- <a href='#clause1Aa'>Clause 1Aa</a>
2720
+ <a href='#clause1Aa'>1.1.1&#160; Clause 1Aa</a>
2570
2721
  </li>
2571
2722
  <li>
2572
- <a href='#clause1Ab'>Clause 1Ab</a>
2723
+ <a href='#clause1Ab'>1.1.2&#160; Clause 1Ab</a>
2573
2724
  </li>
2574
2725
  </ul>
2575
2726
  </li>
2576
2727
  <li>
2577
- <a href='#clause1B'>Clause 1B</a>
2728
+ <a href='#clause1B'>1.2&#160; Clause 1B</a>
2578
2729
  </li>
2579
2730
  <li>
2580
2731
  <ul id='D'>
2581
2732
  <li>
2582
- <a href='#clause1Ba'>Clause 1Ba</a>
2733
+ <a href='#clause1Ba'>1.2.1&#160; Clause 1Ba</a>
2583
2734
  </li>
2584
2735
  </ul>
2585
2736
  </li>
@@ -2588,10 +2739,10 @@ RSpec.describe IsoDoc do
2588
2739
  <div class='toc'>
2589
2740
  <ul id='E'>
2590
2741
  <li>
2591
- <a href='#clause1A'>Clause 1A</a>
2742
+ <a href='#clause1A'>1.1&#160; Clause 1A</a>
2592
2743
  </li>
2593
2744
  <li>
2594
- <a href='#clause1B'>Clause 1B</a>
2745
+ <a href='#clause1B'>1.2&#160; Clause 1B</a>
2595
2746
  </li>
2596
2747
  </ul>
2597
2748
  </div>
@@ -2600,7 +2751,11 @@ RSpec.describe IsoDoc do
2600
2751
  </body>
2601
2752
  </html>
2602
2753
  OUTPUT
2754
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2755
+ .convert("test", input, true)
2756
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
2757
+ .to be_equivalent_to xmlpp(presxml)
2603
2758
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
2604
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2759
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
2605
2760
  end
2606
2761
  end