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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cb5f4a1d2d056c1cbb78aeaa7e7664cda1ccf635d2e59f3f212cd3a86120292
|
4
|
+
data.tar.gz: 64efd1a0055266e1b1088168549cff7235012bba8cccfbcc98ff55c476ef36b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
|