esvg 4.3.1 → 4.3.2

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
  SHA1:
3
- metadata.gz: 4677251f95c7f1ab30e85a77dbbaecd683703680
4
- data.tar.gz: f6dcf98027aab09923f34ad3d5065a3a29ed7128
3
+ metadata.gz: 051d0f7f2d698b4e1514aac9c3aa45701db91c4e
4
+ data.tar.gz: 9e6c581c464a7f931992f3598cab24b98ac6e2eb
5
5
  SHA512:
6
- metadata.gz: 43e0f618e64866961bc89de0f376e5caa1ec8d68f3f990a286552cdc67b959431c1ddd401599a45c2496c56d831b34a77955753a4700bcbf00df0db6efe959cb
7
- data.tar.gz: 7ab9ce67fd94776ed55a7004a607bf76ddbfc69ecf6c6580e6cdcfe380217e4a4d1cee48edac794f7d45f290584f663c49d914c5fe86632a5afe585a5bc1bb09
6
+ metadata.gz: 7ab57771920663c7b14891349355ef96d19aaf874491d566eea8842865954e4b0bb8914caabbb2548ddade85b4d7ba5184cd43ee3e3f1621a1402cc41e951084
7
+ data.tar.gz: a2b94f14a41c831b61ab49be31ac9c89cefe7ca59954f92a7ae97cd497e390bf64d83e454d7d5af057ae00a3b8c309434f8aa4219d3e21fad87fcc375cbeac32
data/lib/esvg/symbol.rb CHANGED
@@ -67,36 +67,37 @@ module Esvg
67
67
  end
68
68
 
69
69
  def use(options={})
70
- if options[:color]
71
- options[:style] ||= ''
72
- options[:style] += "color:#{options[:color]};#{options[:style]}"
70
+ options.delete(:fallback)
71
+ content = options.delete(:content) || ''
72
+
73
+ if desc = options.delete(:desc)
74
+ content = "<desc>#{desc}</desc>#{content}"
75
+ end
76
+ if title = options.delete(:title)
77
+ content = "<title>#{title}</title>#{content}"
73
78
  end
74
79
 
80
+ use_attr = {
81
+ height: options[:height],
82
+ width: options[:width],
83
+ scale: options[:scale],
84
+ }.merge(options.delete(:use) || {})
85
+
75
86
  svg_attr = {
76
- class: [@config[:class], @config[:prefix]+"-"+@name, options[:class]].compact.join(' '),
87
+ class: [@config[:class], @config[:prefix]+"-"+@name, options.delete(:class)].compact.join(' '),
77
88
  viewBox: @size[:viewBox],
78
- style: options[:style],
79
- fill: options[:fill],
80
89
  role: 'img'
81
- }
90
+ }.merge(options)
82
91
 
83
92
  # If user doesn't pass a size or set scale: true
84
- if options[:width].nil? && options[:height].nil? && !options[:scale]
93
+ if svg_attr[:width].nil? && svg_attr[:height].nil? && !svg_attr[:scale]
85
94
  svg_attr[:width] = width
86
95
  svg_attr[:height] = height
87
- else
88
- # Add sizes (nil options will be stripped)
89
- svg_attr[:width] = options[:width]
90
- svg_attr[:height] = options[:height]
91
96
  end
92
97
 
93
- use_attr = {
94
- height: options[:height],
95
- width: options[:width],
96
- scale: options[:scale],
97
- }
98
+ svg_attr.delete(:scale)
98
99
 
99
- %Q{<svg #{attributes(svg_attr)}>#{use_tag(use_attr)}#{title(options)}#{desc(options)}#{options[:content]||''}</svg>}
100
+ %Q{<svg #{attributes(svg_attr)}>#{use_tag(use_attr)}#{content}</svg>}
100
101
  end
101
102
 
102
103
  def use_tag(options={})
@@ -113,22 +114,6 @@ module Esvg
113
114
  %Q{<use #{attributes(options)}/>}
114
115
  end
115
116
 
116
- def title(options)
117
- if options[:title]
118
- "<title>#{options[:title]}</title>"
119
- else
120
- ''
121
- end
122
- end
123
-
124
- def desc(options)
125
- if options[:desc]
126
- "<desc>#{options[:desc]}</desc>"
127
- else
128
- ''
129
- end
130
- end
131
-
132
117
  def svgo?
133
118
  @config[:optimize] && !!Esvg.node_module('svgo')
134
119
  end
data/lib/esvg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "4.3.1"
2
+ VERSION = "4.3.2"
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.3.1
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-02 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler