metanorma-utils 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a355e89f8c66d323f0ca9954226b2255c1c4706ab9346db5004aa7984ceade6c
4
- data.tar.gz: cc240e1eec9ea056d87b38bae0fea45ac16f1e6f2cef1a6cb2d04c2d20de50e9
3
+ metadata.gz: e32e0167b7ef50067c61aca6c6d270c239d6095f428b2d94cae193ef0ff97643
4
+ data.tar.gz: 4d374d23469c0ba74cae811f155a430fb6a7c0865558fd5e332555ed4cd646b3
5
5
  SHA512:
6
- metadata.gz: 20d8d717e2113249d060bf15f15faf1150cf5e06d29368f9faf00b0a496aa7c3e711a80c83dbb6fd328cf39ac2e65359825a6632199fb6cdf13cb882934ac11f
7
- data.tar.gz: be4fe517ccc3731678ebaa5fedf2b7ec0923e510c83193a5f73d26db3b9a290cbe3be3aaeda4dbfa90fd76fd8c1bf14099f283b6bd158b00c5138d488c2fdf14
6
+ metadata.gz: 9e560c04556fc4439ac3af71692e7f552048737c71148cbed4448e97fc12be5bcea60c467c03bb1ade45e53b2e482a6ca5781f81561a17a570e77a9f127ce959
7
+ data.tar.gz: 3befc32a1486a098183b21f341741cf857161c93c56ad51261c6d2035c9d117f6d12638693ace505701e228dcc1034fcfc4a3264746e52e34dcb58c97e0dbab5
data/lib/utils/image.rb CHANGED
@@ -50,7 +50,7 @@ module Metanorma
50
50
  path = svgmap_rewrite0_path(src, localdirectory)
51
51
  File.file?(path) or return false
52
52
  svg = Nokogiri::XML(File.read(path, encoding: "utf-8"))
53
- i.replace(svgmap_rewrite1(svgmap, svg, namespace))
53
+ i.replace(svgmap_rewrite1(svgmap, svg.root, namespace))
54
54
  /^data:/.match(src) and i["src"] = datauri(path)
55
55
  elsif i = svgmap.at(".//m:svg", "m" => SVG_NS)
56
56
  i.replace(svgmap_rewrite1(svgmap, i, namespace))
@@ -75,6 +75,7 @@ module Metanorma
75
75
  a[p] and x = targ[File.expand_path(a[p])] and a[p] = x
76
76
  end
77
77
  end
78
+ svg.xpath("processing-instruction()|.//processing-instruction()").remove
78
79
  svg.to_xml
79
80
  end
80
81
 
data/lib/utils/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Utils
3
- VERSION = "1.2.0".freeze
3
+ VERSION = "1.2.1".freeze
4
4
  end
5
5
  end
data/spec/utils_spec.rb CHANGED
@@ -158,9 +158,7 @@ RSpec.describe Metanorma::Utils do
158
158
  </target>
159
159
  </svgmap>
160
160
  <figure>
161
- <?xml version="1.0" encoding="utf-8"??>
162
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
163
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
161
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
164
162
  <style/>
165
163
  <image/>
166
164
  <a xlink:href='#ref1'>
@@ -176,9 +174,7 @@ RSpec.describe Metanorma::Utils do
176
174
  </figure>
177
175
  <svgmap id='_60dadf08-48d4-4164-845c-b4e293e00abd'>
178
176
  <figure>
179
- <?xml version="1.0" encoding="utf-8"??>
180
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
181
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
177
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
182
178
  <style/>
183
179
  <image/>
184
180
  <a xlink:href='mn://action_schema'>
@@ -204,7 +200,7 @@ RSpec.describe Metanorma::Utils do
204
200
  </target>
205
201
  </svgmap>
206
202
  <figure>
207
- <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
203
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
208
204
  <a href='#ref1'>
209
205
  <rect x='123.28' y='273.93' class='st0' width='88.05' height='41.84'/>
210
206
  </a>
@@ -218,9 +214,7 @@ RSpec.describe Metanorma::Utils do
218
214
  </figure>
219
215
  <svgmap id='_60dadf08-48d4-4164-845c-b4e293e00abd'>
220
216
  <figure>
221
- <?xml version="1.0" encoding="utf-8"??>
222
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
223
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
217
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
224
218
  <style/>
225
219
  <image/>
226
220
  <a xlink:href='mn://action_schema'>
@@ -287,6 +281,7 @@ RSpec.describe Metanorma::Utils do
287
281
  INPUT
288
282
  Metanorma::Utils.svgmap_rewrite(xmldoc)
289
283
  expect(xmlpp(xmldoc.to_xml.gsub(%r{<image.*?</image>}m, "<image/>").gsub(%r{<style.*?</style>}m, "<style/>"))).to be_equivalent_to xmlpp(<<~OUTPUT)
284
+ <?xml version='1.0'?>
290
285
  <standard-document type="semantic" version="1.8.2" xmlns="http://www.example.com">
291
286
  <bibdata type="standard">
292
287
  <title language="en" format="text/plain">Document title</title>
@@ -307,9 +302,7 @@ RSpec.describe Metanorma::Utils do
307
302
  </bibdata>
308
303
  <sections><svgmap id="_d5b5049a-dd53-4ea0-bc6f-e8773bd59052"><target href="mn://action_schema"><xref target="ref1">Computer</xref></target></svgmap>
309
304
  <figure>
310
- <?xml version="1.0" encoding="utf-8"??>
311
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
312
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
305
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
313
306
  <style/>
314
307
  <image/>
315
308
  <a xlink:href='#ref1'>
@@ -325,9 +318,7 @@ RSpec.describe Metanorma::Utils do
325
318
  </figure>
326
319
  <svgmap id='_60dadf08-48d4-4164-845c-b4e293e00abd'>
327
320
  <figure>
328
- <?xml version="1.0" encoding="utf-8"??>
329
- <!-- Generator: Adobe Illustrator 25.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
330
- <svg xmlns='http://www.w3.org/2000/svg' version='1.1' id='Layer_1' x='0px' y='0px' viewbox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve' xmlns:xlink='http://www.w3.org/1999/xlink'>
321
+ <svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.1' id='Layer_1' x='0px' y='0px' viewBox='0 0 595.28 841.89' style='enable-background:new 0 0 595.28 841.89;' xml:space='preserve'>
331
322
  <style/>
332
323
  <image/>
333
324
  <a xlink:href='mn://action_schema'>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.