dragonfly_svg 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/dragonfly_svg/analysers/svg_properties.rb +2 -1
- data/lib/dragonfly_svg/processors/extend_ids.rb +2 -1
- data/lib/dragonfly_svg/processors/remove_namespaces.rb +2 -1
- data/lib/dragonfly_svg/processors/set_attribute.rb +2 -1
- data/lib/dragonfly_svg/processors/set_dimensions.rb +2 -1
- data/lib/dragonfly_svg/processors/set_namespace.rb +2 -1
- data/lib/dragonfly_svg/processors/set_preserve_aspect_ratio.rb +3 -2
- data/lib/dragonfly_svg/processors/set_tag_value.rb +2 -1
- data/lib/dragonfly_svg/processors/set_view_box.rb +3 -2
- data/lib/dragonfly_svg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 523e0e029765f89106d5ebe4c6f9e8763081102969ed6281a64933b1ff0474ee
|
4
|
+
data.tar.gz: ffc4473d9511ef375334762116587de492821ceac31450193ddedd5a19a9e413
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbeb5215c375a1fe99eac7f51a1a9298204d76ba75f287e5f2bc04b33795a3c423cc8a7c699de56e3855d12a26f404ac321ce7cdc8355bc380b43f032a1d8b79
|
7
|
+
data.tar.gz: cf6ca544b60e6eb83991f10df5ccbe80a7d64b0ab8164a82571becc5d84b204ba3949e5b4fa8efa586b7d78ee971a4b7119f03b20b8e08aeaa5ed1a23a270ade
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,8 @@ module DragonflySvg
|
|
4
4
|
module Analysers
|
5
5
|
class SvgProperties
|
6
6
|
def call(content)
|
7
|
-
return {} unless
|
7
|
+
return {} unless content.ext
|
8
|
+
return {} unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
return {} unless doc = Nokogiri::XML(content.data)
|
9
10
|
return {} unless node = doc.xpath("//*[name()='svg']").first
|
10
11
|
|
@@ -5,7 +5,8 @@ module DragonflySvg
|
|
5
5
|
module Processors
|
6
6
|
class ExtendIds
|
7
7
|
def call(content, append_str = SecureRandom.urlsafe_base64(8), options = {})
|
8
|
-
raise UnsupportedFormat unless
|
8
|
+
raise UnsupportedFormat unless content.ext
|
9
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
9
10
|
|
10
11
|
doc = Nokogiri::XML(content.data)
|
11
12
|
|
@@ -4,7 +4,8 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class RemoveNamespaces
|
6
6
|
def call(content)
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
doc = Nokogiri::XML(content.data)
|
10
11
|
doc.remove_namespaces!
|
@@ -4,7 +4,8 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class SetAttribute
|
6
6
|
def call(content, xpath, attribute_name, value)
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
doc = Nokogiri::XML(content.data)
|
10
11
|
doc.xpath(xpath).each do |node|
|
@@ -4,7 +4,8 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class SetDimensions
|
6
6
|
def call(content, width, height)
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
SetAttribute.new.call(content, "//*[name()='svg']", 'width', width) if width
|
10
11
|
SetAttribute.new.call(content, "//*[name()='svg']", 'height', height) if height
|
@@ -4,7 +4,8 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class SetNamespace
|
6
6
|
def call(content, namespace = 'http://www.w3.org/2000/svg')
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
doc = Nokogiri::XML(content.data)
|
10
11
|
|
@@ -4,8 +4,9 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class SetPreserveAspectRatio
|
6
6
|
def call(content, value = 'xMinYMin meet')
|
7
|
-
raise UnsupportedFormat unless
|
8
|
-
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
9
|
+
|
9
10
|
SetAttribute.new.call(content, "//*[name()='svg']", 'preserveAspectRatio', value)
|
10
11
|
end
|
11
12
|
end
|
@@ -4,7 +4,8 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class SetTagValue
|
6
6
|
def call(content, xpath, value)
|
7
|
-
raise UnsupportedFormat unless
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
8
9
|
|
9
10
|
doc = Nokogiri::XML(content.data)
|
10
11
|
doc.xpath(xpath).each do |node|
|
@@ -4,8 +4,9 @@ module DragonflySvg
|
|
4
4
|
module Processors
|
5
5
|
class SetViewBox
|
6
6
|
def call(content, min_x, min_y, width, height)
|
7
|
-
raise UnsupportedFormat unless
|
8
|
-
|
7
|
+
raise UnsupportedFormat unless content.ext
|
8
|
+
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
|
9
|
+
|
9
10
|
value = [min_x, min_y, width, height].map(&:to_s).join(' ')
|
10
11
|
SetAttribute.new.call(content, "//*[name()='svg']", 'viewBox', value)
|
11
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly_svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dragonfly
|