middleman-automatic-clowncar 4.0.2 → 4.0.3

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
  SHA256:
3
- metadata.gz: 2f5fe147b74631551fc5dddbbd29da5ff5123c98808ca308897ca02dcc52492c
4
- data.tar.gz: ece300ff371ad3db04edad4492eaee184774a196f119dc4a40243b96c025a0cd
3
+ metadata.gz: 6cb5f4a1d2d056c1cbb78aeaa7e7664cda1ccf635d2e59f3f212cd3a86120292
4
+ data.tar.gz: 64efd1a0055266e1b1088168549cff7235012bba8cccfbcc98ff55c476ef36b5
5
5
  SHA512:
6
- metadata.gz: 04b42bec24020afdf2dd0d762edaa8e87a98236013e5374e7624c837c845745f9c9fd8f187bdf415a307230f17f29bd555cc09f629d8e99591b1c53f1d4147e8
7
- data.tar.gz: 28ab53fc3646e7c32a93e5e96cde0874dc7f95e4b76d9881355ed8511d495fe7eb0cdfc6fd4743b8695bf2bbe1bb157d457b7fb3e70d60e65a1145297b6e731a
6
+ metadata.gz: 39a2c5954571df7fe5bd6cdefb17310ce5e89f10ee7433b47baa134b186820c77deb21d292719fde649536a9549de78182a2dfedcd2b74108325dc8222f280ca
7
+ data.tar.gz: 8f0d69e6ec729802644bbbfbb4a31ad48c6fc23e13221a6afef149171fe4b0c225969b6f69a4e18a32117c251bff088d47ec347458ed80889b319760912e4287
@@ -195,6 +195,22 @@ module Middleman
195
195
  Extension.options_hash[:sizes]
196
196
  end
197
197
 
198
+ def automatic_clowncar_escape(str)
199
+ alpha = "a-zA-Z"
200
+ alnum = "#{alpha}\\d"
201
+ unreserved = "\\-_.!~*'()#{alnum}"
202
+ reserved = ";/?:@&=+$,\\[\\]"
203
+ unsafe = Regexp.new("[^#{unreserved}#{reserved}]")
204
+ str.gsub(unsafe) do
205
+ us = $&
206
+ tmp = ''
207
+ us.each_byte do |uc|
208
+ tmp << sprintf('%%%02X', uc)
209
+ end
210
+ tmp
211
+ end.force_encoding(Encoding::US_ASCII)
212
+ end
213
+
198
214
  def automatic_clowncar_tag(name, options={})
199
215
  internal = ""
200
216
 
@@ -220,7 +236,9 @@ module Middleman
220
236
  %Q{<object type="image/svg+xml" style="#{object_style}" data-aspect-ratio="#{width.to_f/height.to_f}" data="#{url}">#{internal}</object>}
221
237
  else
222
238
  data = extensions[:automatic_clowncar].generate_svg(name, true, options)
223
- %Q{<object type="image/svg+xml" style="#{object_style}" data-aspect-ratio="#{width.to_f/height.to_f}" data="data:image/svg+xml,#{::URI.escape(data)}">#{internal}</object>}
239
+ puts "data ==============="
240
+ puts data
241
+ %Q{<object type="image/svg+xml" style="#{object_style}" data-aspect-ratio="#{width.to_f/height.to_f}" data="data:image/svg+xml,#{automatic_clowncar_escape(data)}">#{internal}</object>}
224
242
  end
225
243
  end
226
244
 
@@ -1,3 +1,3 @@
1
1
  module MiddlemanAutomaticClowncar
2
- VERSION = "4.0.2"
2
+ VERSION = "4.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-automatic-clowncar
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Green