esvg 4.6.4 → 4.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe664ae9953d8b20081e1d3529b1e042d4d04ee27bf6809344dc789a1a39a0ec
4
- data.tar.gz: be6e44e7c78d0e29b491e97c31168e3b0c997503b35ab67aeb0f690c0596354e
3
+ metadata.gz: a923b958651d7138656c6c84a668b9dbb2f71256d8d5d05804fec04415a6cb41
4
+ data.tar.gz: 0a2bce06990bf4d10357d16403bee18c4ff58aceba9384d42c87676660a0b782
5
5
  SHA512:
6
- metadata.gz: 69d6b09086c7e00930740b007c7795f5b13a93c29952309d1896dc9168047c07b4eee2d5143d815e9b86d13da5673ccd8c15ba1c547b6da7e1d21f6f93ebb393
7
- data.tar.gz: '0807ef7dfb18fedfb541d00e45b4b9e7261cb91fe1f96e2fd179987d0d72d82fe3ae1b4bb128ac254adb1b746529590d02dae129b9c97f2884b911a3077636f7'
6
+ metadata.gz: 4d6779bebdb391b4077f614acb9945b887393e2abaec8fbe22d26e099dabaa2fc382c5edc1a8c5bc85c67e922ef201a77caa6948e74606d0e30285813fae9b92
7
+ data.tar.gz: 8d763eca1893d21b749df6c947e9e8ef87925ec7c86cf1e356475f326660cceb97c6f244fd5bb06b5371e9999da24132ca53094fda7d8448e11388f1a05707ee
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ### 4.6.5 (2018-01-10)
4
+ - Fix: If a viewbox is missing, Esvg recontstructs it from width and height parameters.
5
+
6
+ ### 4.6.4 (2018-01-10)
7
+ - JS files now load via ERB for code readability.
8
+ - Embed of SVGs is now triggered by document.body existing using requestAnimationFrame. DomContentLoaded wasn't fast enough for some cases.
9
+
3
10
  ### 4.6.3 (2018-12-19)
4
11
  - Fix: Reworked configuration model, fixing build optimization failures.
5
12
 
@@ -59,8 +59,12 @@ module Esvg
59
59
 
60
60
  # Scale width based on propotion to height
61
61
  def scale_width( h )
62
- s = split_unit( h )
63
- "#{( s[:size] / height * width ).round(2)}#{s[:unit]}"
62
+ begin
63
+ s = split_unit( h )
64
+ "#{( s[:size] / height * width ).round(2)}#{s[:unit]}"
65
+ rescue StandardError
66
+ binding.pry
67
+ end
64
68
  end
65
69
 
66
70
  # Scale height based on propotion to width
@@ -282,7 +286,17 @@ module Esvg
282
286
  height: (coords[3].to_i - coords[1].to_i).abs
283
287
  }
284
288
  else
285
- {}
289
+ # In case a viewbox hasn't been set, derive one.
290
+ if height = @content.scan(/<svg.+(height=["'](.+?)["'])/).flatten.last &&
291
+ width = @content.scan(/<svg.+(width=["'](.+?)["'])/).flatten.last
292
+ {
293
+ viewBox: "0 0 #{width} #{height}",
294
+ width: width.to_i,
295
+ height: height.to_i
296
+ }
297
+ else
298
+ {}
299
+ end
286
300
  end
287
301
  end
288
302
 
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "4.6.4"
2
+ VERSION = "4.6.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esvg
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.4
4
+ version: 4.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -116,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.7.6
119
+ rubygems_version: 3.0.3
121
120
  signing_key:
122
121
  specification_version: 4
123
122
  summary: Embed svgs in HTML or CSS