isodoc 1.7.3 → 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 -4
- data/lib/isodoc/class_utils.rb +2 -2
- data/lib/isodoc/convert.rb +2 -0
- data/lib/isodoc/function/blocks_example_note.rb +85 -79
- data/lib/isodoc/function/cleanup.rb +181 -175
- data/lib/isodoc/function/inline.rb +110 -108
- data/lib/isodoc/function/inline_simple.rb +55 -55
- data/lib/isodoc/function/lists.rb +75 -71
- data/lib/isodoc/function/references.rb +165 -160
- data/lib/isodoc/function/section.rb +140 -190
- data/lib/isodoc/function/section_titles.rb +82 -0
- data/lib/isodoc/function/table.rb +90 -87
- data/lib/isodoc/function/terms.rb +58 -56
- data/lib/isodoc/function/to_word_html.rb +3 -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/html_function/mathvariant_to_plain.rb +5 -3
- data/lib/isodoc/presentation_function/block.rb +73 -78
- 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 +6 -39
- data/lib/isodoc/presentation_function/math.rb +9 -0
- data/lib/isodoc/presentation_function/section.rb +12 -1
- data/lib/isodoc/presentation_xml_convert.rb +3 -0
- 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/lib/isodoc/xslfo_convert.rb +2 -2
- data/lib/isodoc.rb +1 -1
- data/spec/assets/odf.svg +1 -4
- data/spec/isodoc/blocks_spec.rb +187 -32
- data/spec/isodoc/inline_spec.rb +300 -116
- data/spec/isodoc/postproc_spec.rb +38 -0
- data/spec/isodoc/presentation_xml_spec.rb +144 -0
- data/spec/isodoc/section_spec.rb +764 -0
- data/spec/isodoc/terms_spec.rb +116 -0
- metadata +63 -18
@@ -678,6 +678,150 @@ RSpec.describe IsoDoc do
|
|
678
678
|
.to be_equivalent_to xmlpp(output)
|
679
679
|
end
|
680
680
|
|
681
|
+
it "strips variant-title" do
|
682
|
+
input = <<~INPUT
|
683
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
684
|
+
<bibdata/>
|
685
|
+
<sections>
|
686
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
687
|
+
<title>Clause</title>
|
688
|
+
<p id='_'>Text</p>
|
689
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
690
|
+
<title>Subclause</title>
|
691
|
+
<variant-title variant_title='true' type='sub' id='_'>“A” ‘B’</variant-title>
|
692
|
+
<variant-title variant_title='true' type='toc' id='_'>
|
693
|
+
Clause
|
694
|
+
<em>A</em>
|
695
|
+
<stem type='MathML'>
|
696
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
697
|
+
<mi>x</mi>
|
698
|
+
</math>
|
699
|
+
</stem>
|
700
|
+
</variant-title>
|
701
|
+
<p id='_'>Text</p>
|
702
|
+
</clause>
|
703
|
+
</clause>
|
704
|
+
</sections>
|
705
|
+
<annex id='_' inline-header='false' obligation='normative'>
|
706
|
+
<title>Clause</title>
|
707
|
+
<variant-title variant_title='true' type='toc' id='_'>
|
708
|
+
Clause
|
709
|
+
<em>A</em>
|
710
|
+
<stem type='MathML'>
|
711
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
712
|
+
<mi>x</mi>
|
713
|
+
</math>
|
714
|
+
</stem>
|
715
|
+
</variant-title>
|
716
|
+
<p id='_'>Text</p>
|
717
|
+
</annex>
|
718
|
+
</iso-standard>
|
719
|
+
INPUT
|
720
|
+
output = <<~OUTPUT
|
721
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
722
|
+
<bibdata/>
|
723
|
+
<sections>
|
724
|
+
<clause id='_' inline-header='false' obligation='normative' displayorder='1'>
|
725
|
+
<title depth='1'>
|
726
|
+
<strong>Annex A</strong>
|
727
|
+
<br/>
|
728
|
+
(normative).
|
729
|
+
<tab/>
|
730
|
+
Clause
|
731
|
+
</title>
|
732
|
+
<p id='_'>Text</p>
|
733
|
+
<clause id='_' inline-header='false' obligation='normative'>
|
734
|
+
<title depth='1'>
|
735
|
+
<strong>Annex A</strong>
|
736
|
+
<br/>
|
737
|
+
(normative).
|
738
|
+
<tab/>
|
739
|
+
Subclause
|
740
|
+
</title>
|
741
|
+
<variant-title variant_title='true' type='sub' id='_'>“A” ‘B’</variant-title>
|
742
|
+
<p id='_'>Text</p>
|
743
|
+
</clause>
|
744
|
+
</clause>
|
745
|
+
</sections>
|
746
|
+
<annex id='_' inline-header='false' obligation='normative' displayorder='2'>
|
747
|
+
<title>
|
748
|
+
<strong>Annex A</strong>
|
749
|
+
<br/>
|
750
|
+
(normative)
|
751
|
+
<br/>
|
752
|
+
<br/>
|
753
|
+
<strong>Clause</strong>
|
754
|
+
</title>
|
755
|
+
<p id='_'>Text</p>
|
756
|
+
</annex>
|
757
|
+
</iso-standard>
|
758
|
+
OUTPUT
|
759
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
760
|
+
.convert("test", input, true))
|
761
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
762
|
+
.to be_equivalent_to xmlpp(output)
|
763
|
+
end
|
764
|
+
|
765
|
+
it "duplicates EMF and SVG files" do
|
766
|
+
input = <<~INPUT
|
767
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
768
|
+
<bibdata/>
|
769
|
+
<sections>
|
770
|
+
<clause id='A' inline-header='false' obligation='normative'>
|
771
|
+
<title>Clause</title>
|
772
|
+
<figure id="B">
|
773
|
+
<image src="spec/assets/odf.svg" mimetype="image/svg+xml" alt="1"/>
|
774
|
+
<image src="spec/assets/odf.emf" mimetype="image/x-emf" alt="2"/>
|
775
|
+
<image src="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPjxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz48L3N2Zz4=" mimetype="image/svg+xml" alt="3"/>
|
776
|
+
<image src="data:application/x-msmetafile;base64,AQAAAMgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAJAQAACgAAAACAAAALgAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADAAIAAoADQAMAAzADUAYQA0AGYALAAgADIAMAAyADAALQAwADUALQAwADEAKQAgAAAAbwBkAGYALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAJAQAAA==" mimetype="image/x-emf" alt="4"/>
|
777
|
+
</figure>
|
778
|
+
</clause>
|
779
|
+
</sections>
|
780
|
+
</iso-standard>
|
781
|
+
INPUT
|
782
|
+
output = <<~OUTPUT
|
783
|
+
<?xml version="1.0"?>
|
784
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
785
|
+
<bibdata/>
|
786
|
+
<sections>
|
787
|
+
<clause id="A" inline-header="false" obligation="normative" displayorder="1">
|
788
|
+
<title depth="1">1.<tab/>Clause</title>
|
789
|
+
<figure id="B"><name>Figure 1</name>
|
790
|
+
<image src="spec/assets/odf.svg" mimetype="image/svg+xml" alt="1"><emf src="spec/assets/odf.emf"/></image>
|
791
|
+
<image src="" mimetype="image/svg+xml" alt="2">
|
792
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1275.0000" height="1275.0000">
|
793
|
+
<g transform="translate(-0.0000, -0.0000)">
|
794
|
+
<g transform="matrix(1.0000 0.0000 0.0000 1.0000 0.0000 0.0000)">
|
795
|
+
<path d="M 1188.0000,625.0000 C 1188.0000,936.0000 936.0000,1188.0000 625.0000,1188.0000 C 314.0000,1188.0000 63.0000,936.0000 63.0000,625.0000 C 63.0000,314.0000 314.0000,63.0000 625.0000,63.0000 C 936.0000,63.0000 1188.0000,314.0000 1188.0000,625.0000 Z " fill="#000099" stroke="none"/>
|
796
|
+
<path d="M 413.0000,325.0000 L 975.0000,325.0000 C 1119.0000,493.0000 1124.0000,739.0000 987.0000,913.0000 C 850.0000,1086.0000 609.0000,1139.0000 413.0000,1038.0000 L 413.0000,713.0000 L 738.0000,713.0000 L 738.0000,538.0000 L 413.0000,538.0000 Z " fill="#FFFFFF" stroke="none"/>
|
797
|
+
</g>
|
798
|
+
</g>
|
799
|
+
</svg>
|
800
|
+
<emf src="data:application/x-msmetafile;base64"/></image>
|
801
|
+
<image src="" mimetype="image/svg+xml" alt="3"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle fill="#009" r="45" cx="50" cy="50"/><path d="M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z" fill="#FFF"/></svg><emf src="data:application/x-msmetafile;base64"/></image>
|
802
|
+
<image src="" mimetype="image/svg+xml" alt="4">
|
803
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1275.0000" height="1275.0000">
|
804
|
+
<g transform="translate(-0.0000, -0.0000)">
|
805
|
+
<g transform="matrix(1.0000 0.0000 0.0000 1.0000 0.0000 0.0000)">
|
806
|
+
<path d="M 1188.0000,625.0000 C 1188.0000,936.0000 936.0000,1188.0000 625.0000,1188.0000 C 314.0000,1188.0000 63.0000,936.0000 63.0000,625.0000 C 63.0000,314.0000 314.0000,63.0000 625.0000,63.0000 C 936.0000,63.0000 1188.0000,314.0000 1188.0000,625.0000 Z " fill="#000099" stroke="none"/>
|
807
|
+
<path d="M 413.0000,325.0000 L 975.0000,325.0000 C 1119.0000,493.0000 1124.0000,739.0000 987.0000,913.0000 C 850.0000,1086.0000 609.0000,1139.0000 413.0000,1038.0000 L 413.0000,713.0000 L 738.0000,713.0000 L 738.0000,538.0000 L 413.0000,538.0000 Z " fill="#FFFFFF" stroke="none"/>
|
808
|
+
</g>
|
809
|
+
</g>
|
810
|
+
</svg>
|
811
|
+
<emf src="data:application/x-msmetafile;base64"/></image>
|
812
|
+
</figure>
|
813
|
+
</clause>
|
814
|
+
</sections>
|
815
|
+
</iso-standard>
|
816
|
+
OUTPUT
|
817
|
+
expect(IsoDoc::PresentationXMLConvert.new({})
|
818
|
+
.convert("test", input, true)
|
819
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")
|
820
|
+
.gsub(%r{"data:application/x-msmetafile;base64,[^"]+"},
|
821
|
+
'"data:application/x-msmetafile;base64"'))
|
822
|
+
.to be_equivalent_to (output)
|
823
|
+
end
|
824
|
+
|
681
825
|
private
|
682
826
|
|
683
827
|
def mock_symbols
|