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
@@ -807,6 +807,44 @@ RSpec.describe IsoDoc do
|
|
807
807
|
OUTPUT
|
808
808
|
end
|
809
809
|
|
810
|
+
it "moves images in HTML" do
|
811
|
+
FileUtils.rm_f "test.html"
|
812
|
+
FileUtils.rm_rf "test_htmlimages"
|
813
|
+
IsoDoc::HtmlConvert.new(
|
814
|
+
{ baseassetpath: "spec/assets",
|
815
|
+
wordstylesheet: "word.css",
|
816
|
+
htmlstylesheet: "html.scss" },
|
817
|
+
).convert("test", <<~"INPUT", false)
|
818
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
819
|
+
<preface><foreword>
|
820
|
+
<figure id="_">
|
821
|
+
<name>Split-it-right sample divider</name>
|
822
|
+
<image src="rice_image1.png" id="_" mimetype="image/png"/>
|
823
|
+
</figure>
|
824
|
+
</foreword></preface>
|
825
|
+
</iso-standard>
|
826
|
+
INPUT
|
827
|
+
html = File.read("test.html")
|
828
|
+
.sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
829
|
+
.sub(%r{</main>.*$}m, "</main>")
|
830
|
+
expect(`ls test_htmlimages`).to match(/\.png$/)
|
831
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
|
832
|
+
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
833
|
+
<main class='main-section'>
|
834
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
835
|
+
<br/>
|
836
|
+
<div>
|
837
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
838
|
+
<div id='_' class='figure'>
|
839
|
+
<img src='test_htmlimages/_.png' height='776' width='922'/>
|
840
|
+
<p class='FigureTitle' style='text-align:center;'>Split-it-right sample divider</p>
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
<p class='zzSTDTitle1'/>
|
844
|
+
</main>
|
845
|
+
OUTPUT
|
846
|
+
end
|
847
|
+
|
810
848
|
describe "mathvariant to plain" do
|
811
849
|
context "when `mathvariant` attr equal to `script`" do
|
812
850
|
it "converts mathvariant text chars into associated plain chars" do
|
@@ -762,6 +762,66 @@ RSpec.describe IsoDoc do
|
|
762
762
|
.to be_equivalent_to xmlpp(output)
|
763
763
|
end
|
764
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
|
+
|
765
825
|
private
|
766
826
|
|
767
827
|
def mock_symbols
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isodoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciimath
|
@@ -67,21 +67,21 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: emf2svg
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1
|
75
|
+
version: '1'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1
|
82
|
+
version: '1'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: mathml2asciimath
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: metanorma-utils
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,7 +109,21 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: nokogiri
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.12.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.12.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: relaton-cli
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
@@ -123,21 +137,21 @@ dependencies:
|
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: roman-numerals
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - ">="
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
145
|
+
version: '0'
|
132
146
|
type: :runtime
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - ">="
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: thread_safe
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - ">="
|
@@ -151,21 +165,21 @@ dependencies:
|
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: '0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
168
|
+
name: twitter_cldr
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
156
170
|
requirements:
|
157
171
|
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version:
|
173
|
+
version: 6.6.0
|
160
174
|
type: :runtime
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
180
|
+
version: 6.6.0
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
182
|
+
name: uuidtools
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - ">="
|
@@ -234,6 +248,20 @@ dependencies:
|
|
234
248
|
- - "~>"
|
235
249
|
- !ruby/object:Gem::Version
|
236
250
|
version: '4.7'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: metanorma-iso
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
type: :development
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
237
265
|
- !ruby/object:Gem::Dependency
|
238
266
|
name: rake
|
239
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,20 +346,6 @@ dependencies:
|
|
318
346
|
- - "~>"
|
319
347
|
- !ruby/object:Gem::Version
|
320
348
|
version: '0.15'
|
321
|
-
- !ruby/object:Gem::Dependency
|
322
|
-
name: metanorma-iso
|
323
|
-
requirement: !ruby/object:Gem::Requirement
|
324
|
-
requirements:
|
325
|
-
- - ">="
|
326
|
-
- !ruby/object:Gem::Version
|
327
|
-
version: '0'
|
328
|
-
type: :development
|
329
|
-
prerelease: false
|
330
|
-
version_requirements: !ruby/object:Gem::Requirement
|
331
|
-
requirements:
|
332
|
-
- - ">="
|
333
|
-
- !ruby/object:Gem::Version
|
334
|
-
version: '0'
|
335
349
|
- !ruby/object:Gem::Dependency
|
336
350
|
name: timecop
|
337
351
|
requirement: !ruby/object:Gem::Requirement
|
@@ -432,6 +446,8 @@ files:
|
|
432
446
|
- lib/isodoc/pdf_convert.rb
|
433
447
|
- lib/isodoc/presentation_function/bibdata.rb
|
434
448
|
- lib/isodoc/presentation_function/block.rb
|
449
|
+
- lib/isodoc/presentation_function/concept.rb
|
450
|
+
- lib/isodoc/presentation_function/image.rb
|
435
451
|
- lib/isodoc/presentation_function/inline.rb
|
436
452
|
- lib/isodoc/presentation_function/math.rb
|
437
453
|
- lib/isodoc/presentation_function/section.rb
|