isodoc 1.7.5 → 1.7.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -2535,154 +2607,154 @@ RSpec.describe IsoDoc do
2535
2607
  </standard-document>
2536
2608
  INPUT
2537
2609
  presxml = <<~INPUT
2538
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation" version="1.10.2">
2539
- <bibdata type="standard">
2540
- <title language="en" format="text/plain">Document title</title>
2541
- <language current="true">en</language>
2542
- <script current="true">Latn</script>
2543
- <status>
2544
- <stage language="">published</stage>
2545
- </status>
2546
- <copyright>
2547
- <from>2021</from>
2548
- </copyright>
2549
- <ext>
2550
- <doctype language="">article</doctype>
2551
- </ext>
2552
- </bibdata>
2553
- <sections>
2554
- <clause id="clause1" inline-header="false" obligation="normative" displayorder="1">
2555
- <title depth="1">1.<tab/>Clause 1</title>
2556
- <clause id="clause1A" inline-header="false" obligation="normative">
2557
- <title depth="2">1.1.<tab/>Clause 1A</title>
2558
- <clause id="clause1Aa" inline-header="false" obligation="normative">
2559
- <title depth="3">1.1.1.<tab/>Clause 1Aa</title>
2560
- </clause>
2561
- <clause id="clause1Ab" inline-header="false" obligation="normative">
2562
- <title depth="3">1.1.2.<tab/>Clause 1Ab</title>
2563
- </clause>
2564
- </clause>
2565
- <clause id="clause1B" inline-header="false" obligation="normative">
2566
- <title depth="2">1.2.<tab/>Clause 1B</title>
2567
- <clause id="clause1Ba" inline-header="false" obligation="normative">
2568
- <title depth="3">1.2.1.<tab/>Clause 1Ba</title>
2569
- </clause>
2570
- </clause>
2571
- </clause>
2572
- <clause id="clause2" inline-header="false" obligation="normative" displayorder="2">
2573
- <title depth="1">2.<tab/>Clause 2</title>
2574
- <p id="A">And introducing: </p>
2575
- <toc>
2576
- <ul id="B">
2577
- <li>
2578
- <xref target="clause1A">1.1<tab/>Clause 1A</xref>
2579
- </li>
2580
- <li>
2581
- <ul id="C">
2582
- <li>
2583
- <xref target="clause1Aa">1.1.1<tab/>Clause 1Aa</xref>
2584
- </li>
2585
- <li>
2586
- <xref target="clause1Ab">1.1.2<tab/>Clause 1Ab</xref>
2587
- </li>
2588
- </ul>
2589
- </li>
2590
- <li>
2591
- <xref target="clause1B">1.2<tab/>Clause 1B</xref>
2592
- </li>
2593
- <li>
2594
- <ul id="D">
2595
- <li>
2596
- <xref target="clause1Ba">1.2.1<tab/>Clause 1Ba</xref>
2597
- </li>
2598
- </ul>
2599
- </li>
2600
- </ul>
2601
- </toc>
2602
- <toc>
2603
- <ul id="E">
2604
- <li>
2605
- <xref target="clause1A">1.1<tab/>Clause 1A</xref>
2606
- </li>
2607
- <li>
2608
- <xref target="clause1B">1.2<tab/>Clause 1B</xref>
2609
- </li>
2610
- </ul>
2611
- </toc>
2612
- </clause>
2613
- </sections>
2614
- </standard-document>
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>
2615
2687
  INPUT
2616
2688
  output = <<~OUTPUT
2617
- #{HTML_HDR}
2618
- <p class='zzSTDTitle1'>Document title</p>
2619
- <div id='clause1'>
2620
- <h1>1.&#160; Clause 1</h1>
2621
- <div id='clause1A'>
2622
- <h2>1.1.&#160; Clause 1A</h2>
2623
- <div id='clause1Aa'>
2624
- <h3>1.1.1.&#160; Clause 1Aa</h3>
2625
- </div>
2626
- <div id='clause1Ab'>
2627
- <h3>1.1.2.&#160; Clause 1Ab</h3>
2628
- </div>
2629
- </div>
2630
- <div id='clause1B'>
2631
- <h2>1.2.&#160; Clause 1B</h2>
2632
- <div id='clause1Ba'>
2633
- <h3>1.2.1.&#160; Clause 1Ba</h3>
2634
- </div>
2635
- </div>
2636
- </div>
2637
- <div id='clause2'>
2638
- <h1>2.&#160; Clause 2</h1>
2639
- <p id='A'>And introducing: </p>
2640
- <div class='toc'>
2641
- <ul id='B'>
2642
- <li>
2643
- <a href='#clause1A'>1.1&#160; Clause 1A</a>
2644
- </li>
2645
- <li>
2646
- <ul id='C'>
2647
- <li>
2648
- <a href='#clause1Aa'>1.1.1&#160; Clause 1Aa</a>
2649
- </li>
2650
- <li>
2651
- <a href='#clause1Ab'>1.1.2&#160; Clause 1Ab</a>
2652
- </li>
2653
- </ul>
2654
- </li>
2655
- <li>
2656
- <a href='#clause1B'>1.2&#160; Clause 1B</a>
2657
- </li>
2658
- <li>
2659
- <ul id='D'>
2660
- <li>
2661
- <a href='#clause1Ba'>1.2.1&#160; Clause 1Ba</a>
2662
- </li>
2663
- </ul>
2664
- </li>
2665
- </ul>
2666
- </div>
2667
- <div class='toc'>
2668
- <ul id='E'>
2669
- <li>
2670
- <a href='#clause1A'>1.1&#160; Clause 1A</a>
2671
- </li>
2672
- <li>
2673
- <a href='#clause1B'>1.2&#160; Clause 1B</a>
2674
- </li>
2675
- </ul>
2676
- </div>
2677
- </div>
2678
- </div>
2679
- </body>
2680
- </html>
2689
+ #{HTML_HDR}
2690
+ <p class='zzSTDTitle1'>Document title</p>
2691
+ <div id='clause1'>
2692
+ <h1>1.&#160; Clause 1</h1>
2693
+ <div id='clause1A'>
2694
+ <h2>1.1.&#160; Clause 1A</h2>
2695
+ <div id='clause1Aa'>
2696
+ <h3>1.1.1.&#160; Clause 1Aa</h3>
2697
+ </div>
2698
+ <div id='clause1Ab'>
2699
+ <h3>1.1.2.&#160; Clause 1Ab</h3>
2700
+ </div>
2701
+ </div>
2702
+ <div id='clause1B'>
2703
+ <h2>1.2.&#160; Clause 1B</h2>
2704
+ <div id='clause1Ba'>
2705
+ <h3>1.2.1.&#160; Clause 1Ba</h3>
2706
+ </div>
2707
+ </div>
2708
+ </div>
2709
+ <div id='clause2'>
2710
+ <h1>2.&#160; Clause 2</h1>
2711
+ <p id='A'>And introducing: </p>
2712
+ <div class='toc'>
2713
+ <ul id='B'>
2714
+ <li>
2715
+ <a href='#clause1A'>1.1&#160; Clause 1A</a>
2716
+ </li>
2717
+ <li>
2718
+ <ul id='C'>
2719
+ <li>
2720
+ <a href='#clause1Aa'>1.1.1&#160; Clause 1Aa</a>
2721
+ </li>
2722
+ <li>
2723
+ <a href='#clause1Ab'>1.1.2&#160; Clause 1Ab</a>
2724
+ </li>
2725
+ </ul>
2726
+ </li>
2727
+ <li>
2728
+ <a href='#clause1B'>1.2&#160; Clause 1B</a>
2729
+ </li>
2730
+ <li>
2731
+ <ul id='D'>
2732
+ <li>
2733
+ <a href='#clause1Ba'>1.2.1&#160; Clause 1Ba</a>
2734
+ </li>
2735
+ </ul>
2736
+ </li>
2737
+ </ul>
2738
+ </div>
2739
+ <div class='toc'>
2740
+ <ul id='E'>
2741
+ <li>
2742
+ <a href='#clause1A'>1.1&#160; Clause 1A</a>
2743
+ </li>
2744
+ <li>
2745
+ <a href='#clause1B'>1.2&#160; Clause 1B</a>
2746
+ </li>
2747
+ </ul>
2748
+ </div>
2749
+ </div>
2750
+ </div>
2751
+ </body>
2752
+ </html>
2681
2753
  OUTPUT
2682
2754
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2683
2755
  .convert("test", input, true)
2684
2756
  .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
2685
- .to be_equivalent_to xmlpp(presxml)
2757
+ .to be_equivalent_to xmlpp(presxml)
2686
2758
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
2687
2759
  .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
2688
2760
  end
@@ -413,32 +413,32 @@ RSpec.describe IsoDoc do
413
413
 
414
414
  it "processes concept attributes" do
415
415
  input = <<~INPUT
416
- <iso-standard xmlns="http://riboseinc.com/isoxml">
417
- <preface><foreword>
418
- <p>
419
- <ul>
420
- <li><concept ital="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
421
- <li><concept ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
422
- <li><concept ital="true" ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
423
- <li><concept ital="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
424
- <li><concept ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
425
- <li><concept ital="false" ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
426
- <li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
427
- <li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
428
- <li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
429
- <li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
430
- <li><concept ital="true" ref="true" linkmention="true" linkref="true"><strong>error!</strong></concept></li>
431
- <li><concept ital="false" ref="false" linkmention="true">
432
- <refterm>CV_DiscreteCoverage</refterm>
433
- <renderterm>CV_DiscreteCoverage</renderterm>
434
- <xref target="term-cv_discretecoverage"/>
435
- </concept></li>
436
- </ul></p>
437
- </foreword></preface>
438
- <sections>
439
- <clause id="clause1"><title>Clause 1</title></clause>
440
- </sections>
441
- </iso-standard>
416
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
417
+ <preface><foreword>
418
+ <p>
419
+ <ul>
420
+ <li><concept ital="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
421
+ <li><concept ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
422
+ <li><concept ital="true" ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
423
+ <li><concept ital="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
424
+ <li><concept ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
425
+ <li><concept ital="false" ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
426
+ <li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
427
+ <li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
428
+ <li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
429
+ <li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
430
+ <li><concept ital="true" ref="true" linkmention="true" linkref="true"><strong>error!</strong></concept></li>
431
+ <li><concept ital="false" ref="false" linkmention="true">
432
+ <refterm>CV_DiscreteCoverage</refterm>
433
+ <renderterm>CV_DiscreteCoverage</renderterm>
434
+ <xref target="term-cv_discretecoverage"/>
435
+ </concept></li>
436
+ </ul></p>
437
+ </foreword></preface>
438
+ <sections>
439
+ <clause id="clause1"><title>Clause 1</title></clause>
440
+ </sections>
441
+ </iso-standard>
442
442
  INPUT
443
443
  presxml = <<~OUTPUT
444
444
  <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
@@ -1388,6 +1388,65 @@ RSpec.describe IsoDoc do
1388
1388
  .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1389
1389
  end
1390
1390
 
1391
+ it "processes eref content with Unicode characters" do
1392
+ input = <<~INPUT
1393
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1394
+ <preface><foreword>
1395
+ <p>
1396
+ <eref type="inline" bibitemid="ISO712" citeas="BSI BS EN ISO 19011:2018&#8201;&#8212;&#8201;TC"/>
1397
+ </foreword></preface>
1398
+ <bibliography>
1399
+ <references id='_normative_references' obligation='informative' normative='true' displayorder="2">
1400
+ <title>Normative References</title>
1401
+ <bibitem id='ISO712' type='standard'>
1402
+ <title format='text/plain'>Cereals and cereal products</title>
1403
+ <uri type='citation'>http://www.example.com</uri>
1404
+ <docidentifier>ISO 712</docidentifier>
1405
+ <contributor>
1406
+ <role type='publisher'/>
1407
+ <organization>
1408
+ <abbreviation>ISO</abbreviation>
1409
+ </organization>
1410
+ </contributor>
1411
+ </bibitem>
1412
+ </references></bibliography>
1413
+ </iso-standard>
1414
+ INPUT
1415
+ presxml = <<~OUTPUT
1416
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1417
+ <preface>
1418
+ <foreword displayorder='1'>
1419
+ <p>
1420
+ <eref type='inline' bibitemid='ISO712' citeas='BSI BS EN ISO 19011:2018&#x2009;&#x2014;&#x2009;TC'>BSI BS EN ISO 19011:2018&#x2009;&#x2014;&#x2009;TC</eref>
1421
+ </p>
1422
+ </foreword>
1423
+ <bibliography displayorder='2'>
1424
+ <references id='_normative_references' obligation='informative' normative='true' displayorder='3'>
1425
+ <title depth='1'>
1426
+ 1.
1427
+ <tab/>
1428
+ Normative References
1429
+ </title>
1430
+ <bibitem id='ISO712' type='standard'>
1431
+ <title format='text/plain'>Cereals and cereal products</title>
1432
+ <uri type='citation'>http://www.example.com</uri>
1433
+ <docidentifier>ISO 712</docidentifier>
1434
+ <contributor>
1435
+ <role type='publisher'/>
1436
+ <organization>
1437
+ <abbreviation>ISO</abbreviation>
1438
+ </organization>
1439
+ </contributor>
1440
+ </bibitem>
1441
+ </references>
1442
+ </bibliography>
1443
+ </preface>
1444
+ </iso-standard>
1445
+ OUTPUT
1446
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1447
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1448
+ end
1449
+
1391
1450
  it "processes variant" do
1392
1451
  input = <<~INPUT
1393
1452
  <iso-standard xmlns="http://riboseinc.com/isoxml">