esvg 2.6.0 → 2.7.0
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 -1
- data/README.md +6 -0
- data/lib/esvg/svg.rb +7 -0
- data/lib/esvg/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa6229774082f4aea9f199648b775df39740ceab
|
4
|
+
data.tar.gz: 0ae1d189e08fc4052453ca6a2e2a3b60e80c7824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcf42cf652f2ba221b232a933a0585e63bd7b74a7cf85827f7c355735351cc7df2c5d24fdb8da1d6acef206b637e33de629687424429bc92efa89586a0f7e2c7
|
7
|
+
data.tar.gz: dfdd9c185afb48597d998fefab052bc6ba5c6dfc11ca6f7903f7566b7e6498bfc48d38f0da478653207f0eeea55eec2ef82ed211e1bfe215876d995aa501abd8
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 2.7.0 (2015-12-08)
|
4
|
+
- New: Now option style can append to inlines styles
|
5
|
+
|
3
6
|
### 2.6.0 (2015-12-07)
|
4
|
-
- New
|
7
|
+
- New: Alias mapping so several different names can be used to reference icons
|
5
8
|
|
6
9
|
### 2.5.0 (2015-11-03)
|
7
10
|
- Improved logging
|
data/README.md
CHANGED
@@ -65,6 +65,12 @@ To place an SVG icon, use the `svg_icon` helper. This helper will embed an SVG `
|
|
65
65
|
# Output:
|
66
66
|
# <svg class="icon kitten-icon adorbs"><use xlink:href="#kitten-icon"/></svg>
|
67
67
|
|
68
|
+
# Add custom styles
|
69
|
+
<%= svg_icon 'kitten', style: 'color: #c0ffee' %>
|
70
|
+
|
71
|
+
# Output:
|
72
|
+
# <svg class="icon kitten-icon" style="color: #coffee;"><use xlink:href="#kitten-icon"/></svg>
|
73
|
+
|
68
74
|
# Add title and desc tags for SVG accessibility.
|
69
75
|
<%= svg_icon 'kitten', title: "Mr. Snuggles", desc: "A graphic of a cat snuggling a ball of yarn" %>
|
70
76
|
|
data/lib/esvg/svg.rb
CHANGED
@@ -148,6 +148,13 @@ module Esvg
|
|
148
148
|
def svg_icon(file, options={})
|
149
149
|
embed = use_icon(file)
|
150
150
|
embed = embed.sub(/class="(.+?)"/, 'class="\1 '+options[:class]+'"') if options[:class]
|
151
|
+
if options[:style]
|
152
|
+
if embed.match(/style/)
|
153
|
+
embed = embed.sub(/style="(.+?)"/, 'style="\1; '+options[:style]+'"')
|
154
|
+
else
|
155
|
+
embed = embed.sub(/><use/, %Q{ style="#{options[:style]}"><use})
|
156
|
+
end
|
157
|
+
end
|
151
158
|
embed = embed.sub(/><\/svg/, ">#{title(options)}#{desc(options)}</svg")
|
152
159
|
embed
|
153
160
|
end
|
data/lib/esvg/version.rb
CHANGED