isodoc 1.7.5 → 1.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +7 -6
- data/lib/isodoc/class_utils.rb +2 -2
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +2 -1
- data/lib/isodoc/function/utils.rb +34 -14
- data/lib/isodoc/html_function/comments.rb +107 -111
- data/lib/isodoc/html_function/footnotes.rb +68 -67
- data/lib/isodoc/html_function/html.rb +113 -103
- data/lib/isodoc/presentation_function/block.rb +1 -33
- data/lib/isodoc/presentation_function/concept.rb +68 -0
- data/lib/isodoc/presentation_function/image.rb +112 -0
- data/lib/isodoc/presentation_function/inline.rb +3 -68
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +176 -174
- data/lib/isodoc/word_function/comments.rb +117 -112
- data/lib/isodoc/word_function/footnotes.rb +88 -86
- data/lib/isodoc/word_function/inline.rb +42 -67
- data/lib/isodoc/word_function/postprocess_cover.rb +121 -110
- data/lib/isodoc/xref/xref_gen.rb +153 -150
- data/spec/assets/odf.svg +1 -4
- data/spec/isodoc/blocks_spec.rb +229 -157
- data/spec/isodoc/inline_spec.rb +85 -26
- data/spec/isodoc/postproc_spec.rb +38 -0
- data/spec/isodoc/presentation_xml_spec.rb +60 -0
- metadata +46 -30
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -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
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
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(/</, "<")
|
811
|
+
.gsub(/</, "<")
|
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='
|
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> </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(/</, "<")
|
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",
|
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::
|
917
|
+
allow(IsoDoc::PresentationXMLConvert)
|
881
918
|
.to receive(:inkscape_installed?).and_return(nil)
|
882
|
-
allow_any_instance_of(IsoDoc::
|
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='
|
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> </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(/</, "<")
|
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",
|
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
|
-
|
2539
|
-
|
2540
|
-
|
2541
|
-
|
2542
|
-
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2551
|
-
|
2552
|
-
|
2553
|
-
|
2554
|
-
|
2555
|
-
|
2556
|
-
|
2557
|
-
|
2558
|
-
|
2559
|
-
|
2560
|
-
|
2561
|
-
|
2562
|
-
|
2563
|
-
|
2564
|
-
|
2565
|
-
|
2566
|
-
|
2567
|
-
|
2568
|
-
|
2569
|
-
|
2570
|
-
|
2571
|
-
|
2572
|
-
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
|
2583
|
-
|
2584
|
-
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
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
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2648
|
-
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2669
|
-
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2689
|
+
#{HTML_HDR}
|
2690
|
+
<p class='zzSTDTitle1'>Document title</p>
|
2691
|
+
<div id='clause1'>
|
2692
|
+
<h1>1.  Clause 1</h1>
|
2693
|
+
<div id='clause1A'>
|
2694
|
+
<h2>1.1.  Clause 1A</h2>
|
2695
|
+
<div id='clause1Aa'>
|
2696
|
+
<h3>1.1.1.  Clause 1Aa</h3>
|
2697
|
+
</div>
|
2698
|
+
<div id='clause1Ab'>
|
2699
|
+
<h3>1.1.2.  Clause 1Ab</h3>
|
2700
|
+
</div>
|
2701
|
+
</div>
|
2702
|
+
<div id='clause1B'>
|
2703
|
+
<h2>1.2.  Clause 1B</h2>
|
2704
|
+
<div id='clause1Ba'>
|
2705
|
+
<h3>1.2.1.  Clause 1Ba</h3>
|
2706
|
+
</div>
|
2707
|
+
</div>
|
2708
|
+
</div>
|
2709
|
+
<div id='clause2'>
|
2710
|
+
<h1>2.  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  Clause 1A</a>
|
2716
|
+
</li>
|
2717
|
+
<li>
|
2718
|
+
<ul id='C'>
|
2719
|
+
<li>
|
2720
|
+
<a href='#clause1Aa'>1.1.1  Clause 1Aa</a>
|
2721
|
+
</li>
|
2722
|
+
<li>
|
2723
|
+
<a href='#clause1Ab'>1.1.2  Clause 1Ab</a>
|
2724
|
+
</li>
|
2725
|
+
</ul>
|
2726
|
+
</li>
|
2727
|
+
<li>
|
2728
|
+
<a href='#clause1B'>1.2  Clause 1B</a>
|
2729
|
+
</li>
|
2730
|
+
<li>
|
2731
|
+
<ul id='D'>
|
2732
|
+
<li>
|
2733
|
+
<a href='#clause1Ba'>1.2.1  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  Clause 1A</a>
|
2743
|
+
</li>
|
2744
|
+
<li>
|
2745
|
+
<a href='#clause1B'>1.2  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
|
-
|
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
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -413,32 +413,32 @@ RSpec.describe IsoDoc do
|
|
413
413
|
|
414
414
|
it "processes concept attributes" do
|
415
415
|
input = <<~INPUT
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
<refterm>CV_DiscreteCoverage</refterm>
|
433
|
-
<renderterm>CV_DiscreteCoverage</renderterm>
|
434
|
-
<xref target="term-cv_discretecoverage"/>
|
435
|
-
</concept></li>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
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 — 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 — TC'>BSI BS EN ISO 19011:2018 — 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">
|