esvg 4.1.1 → 4.1.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: 27d93663b8b9b36654390502132bf232efe68c66
4
- data.tar.gz: 43344a22127df181e71d73602dbe0764e51d13e5
3
+ metadata.gz: c9fdbb78002cc2514c00fb6dbff29b2dd59c0e08
4
+ data.tar.gz: fd7dd209964226bf4a7c9ec90431f68eca9ae94e
5
5
  SHA512:
6
- metadata.gz: cc486ddf04d4b6692407740dc3d1c808181587ce8d92c0e3a78b33c35c4631d1913b961d649b2179e4e9378d4c230e2d8c53cf8e513568246511686387e3c7b2
7
- data.tar.gz: 1d1e3f0476e4c2dee4eb68d2814712407b0e84eb8faf1e5bd49b9b5729bfa95181c106ce5ddd98e6053bb54245907702d8bfe07992dcb2c337d573f7eb65eb20
6
+ metadata.gz: 6a5c58dd0ec3a9c2b2f287ce96cf0fecb967bd70a381a3570b4c56d9fd4ecf806ece2efa67024214fd1edf9fb231335ddf91903dc651f68a3c84939f5c54befd
7
+ data.tar.gz: 630f7341d55747c4e68e40b9ddbea1ed30815c6c33f91f0ba31c6b2ff529895c7e6f2eb756c454eee7ae035424b32d638b2a16de54ac7fa1982d47a0bce7d87d
data/lib/esvg/svg.rb CHANGED
@@ -108,6 +108,7 @@ module Esvg
108
108
 
109
109
  # Name may have changed due to flatten config
110
110
  svgs[key][:name] = file_name(path)
111
+ svgs[key][:attr][:name] = id(svgs[key][:name])
111
112
 
112
113
  dirs[dkey] ||= {}
113
114
  (dirs[dkey][:files] ||= []) << key
@@ -450,7 +451,7 @@ module Esvg
450
451
  if ( !names ) {
451
452
  names = {}
452
453
  for( var symbol of document.querySelectorAll( 'svg[id^=esvg] symbol' ) ) {
453
- names[symbol.id] = symbol
454
+ names[symbol.getAttribute('name')] = symbol
454
455
  }
455
456
  }
456
457
  return names
@@ -548,12 +549,12 @@ module Esvg
548
549
  reg = %w(xmlns xmlns:xlink xml:space version).map { |m| "#{m}=\".+?\"" }.join('|')
549
550
  svg.gsub(Regexp.new(reg), '') # Remove unwanted attributes
550
551
  .gsub(/<?.+\?>/,'').gsub(/<!.+?>/,'') # Get rid of doctypes and comments
552
+ .gsub(/style="([^"]*?)fill:(.+?);/m, 'fill="\2" style="\1') # Make fill a property instead of a style
553
+ .gsub(/style="([^"]*?)fill-opacity:(.+?);/m, 'fill-opacity="\2" style="\1') # Move fill-opacity a property instead of a style
551
554
  .gsub(/\n/, '') # Remove endlines
552
555
  .gsub(/\s{2,}/, ' ') # Remove whitespace
553
556
  .gsub(/>\s+</, '><') # Remove whitespace between tags
554
557
  .gsub(/\s?fill="(#0{3,6}|black|rgba?\(0,0,0\))"/,'') # Strip black fill
555
- .gsub(/style="([^"]*?)fill:(.+?);/m, 'fill="\2" style="\1') # Make fill a property instead of a style
556
- .gsub(/style="([^"]*?)fill-opacity:(.+?);/m, 'fill-opacity="\2" style="\1') # Move fill-opacity a property instead of a style
557
558
  end
558
559
 
559
560
  def post_optimize(svg)
@@ -0,0 +1,10 @@
1
+ require 'yaml'
2
+ require 'json'
3
+ require 'zlib'
4
+
5
+ module Esvg
6
+ class Script
7
+ def build
8
+ end
9
+ end
10
+ end
data/lib/esvg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "4.1.1"
2
+ VERSION = "4.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esvg
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
@@ -90,6 +90,7 @@ files:
90
90
  - lib/esvg/helpers.rb
91
91
  - lib/esvg/railties.rb
92
92
  - lib/esvg/svg.rb
93
+ - lib/esvg/symbols.rb
93
94
  - lib/esvg/version.rb
94
95
  homepage: https://github.com/imathis/esvg
95
96
  licenses: