svg_optimizer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of svg_optimizer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/svg_optimizer/plugins/cleanup_id.rb +9 -1
- data/lib/svg_optimizer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b58103eace64dcab3740e83ce4a1c328dd6ae06
|
4
|
+
data.tar.gz: 68ee27f69693afcd6eab21e0b1ffa57905d1c90b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08e57257160f937494ee265a804e887033e59246d1e5a74b903ba99d8a5b4bc47687fd0e0ad9f1affa4afee2c6aa4bbd0d37c1ef5be1fe2d0036473f83c983b5'
|
7
|
+
data.tar.gz: f6b6caf4b7ff9f4ae069d23a1c22267e55cde26d134fc2368ff5f26efabd767e03687a1e1c21060a9313124e12c14809498e9128f2dd72201fb71e1830fc7a57
|
@@ -9,6 +9,7 @@ module SvgOptimizer
|
|
9
9
|
].freeze
|
10
10
|
|
11
11
|
IDS = LETTERS.dup.concat(LETTERS.combination(2).to_a).freeze
|
12
|
+
XLINK_NAMESPACE = "http://www.w3.org/1999/xlink".freeze
|
12
13
|
|
13
14
|
def ids
|
14
15
|
@ids ||= IDS.dup
|
@@ -57,8 +58,15 @@ module SvgOptimizer
|
|
57
58
|
nodes.any?
|
58
59
|
end
|
59
60
|
|
61
|
+
def xlink_namespace?
|
62
|
+
xml.root.namespace_definitions.map(&:href).include?(XLINK_NAMESPACE)
|
63
|
+
end
|
64
|
+
|
60
65
|
def replace_href_references(old_id, new_id)
|
61
|
-
|
66
|
+
scopes = ["[href='##{old_id}']"]
|
67
|
+
scopes << "[xlink|href='##{old_id}']" if xlink_namespace?
|
68
|
+
|
69
|
+
nodes = xml.css(scopes.join(","))
|
62
70
|
|
63
71
|
nodes.each do |node|
|
64
72
|
node.attributes.map(&:last).each do |attr|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svg_optimizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|