datauris 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -1
- data/README.md +5 -3
- data/Rakefile +1 -1
- data/lib/datauris/version.rb +2 -2
- data/lib/datauris.rb +10 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab2d170cf6bfa2e0cfac039e523acb19fe18fad89fd297185a1047f1819ffdc5
|
4
|
+
data.tar.gz: '0419a2803baa32773809ead98488fdf8dc5e5a7b4ec34413799008ee922692e7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bfc64e92ac81ff9cfe789069886482d19232e23899cd02e083abb52d0cc92ec30f94f9618506ff092b3143fbe0623881efaf9d938330603ef8d23efaaf1a898
|
7
|
+
data.tar.gz: 2c3ff3a3a2e31c588786aed7250e7eb107fac1fb5c506b3cc5d3b4f8a47a94db68bcbc2cbabf04423480020c9c0febe9aa4bf161cdbdf2b3b34386c781dfbe12
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
datauris - helpers to parse (decode) and build (encode) data uris incl. (strict) base64-encoded/decoded images and more
|
4
4
|
|
5
|
-
* home :: [github.com/
|
6
|
-
* bugs :: [github.com/
|
5
|
+
* home :: [github.com/0xCompute/ethscribe](https://github.com/0xCompute/ethscribe)
|
6
|
+
* bugs :: [github.com/0xCompute/ethscribe/issues](https://github.com/0xCompute/ethscribe/issues)
|
7
7
|
* gem :: [rubygems.org/gems/datauris](https://rubygems.org/gems/datauris)
|
8
8
|
* rdoc :: [rubydoc.info/gems/datauris](http://rubydoc.info/gems/datauris)
|
9
9
|
|
@@ -167,7 +167,9 @@ at the ruby code commons (rubycocos) org.
|
|
167
167
|
|
168
168
|
## Questions? Comments?
|
169
169
|
|
170
|
-
Join us in the [
|
170
|
+
Join us in the [0xCompute discord (chat server)](https://discord.gg/3JRnDUap6y)
|
171
|
+
(or in the more general Ethscription discord).
|
172
|
+
Yes you can.
|
171
173
|
Your questions and commentary welcome.
|
172
174
|
|
173
175
|
Or post them over at the [Help & Support](https://github.com/geraldb/help) page. Thanks.
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'datauris' do
|
|
8
8
|
self.summary = "datauris gem - DataUri helpers to parse (decode) and build (encode) data uris incl. (strict) base64-encoded/decoded images and more"
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls = { home: 'https://github.com/
|
11
|
+
self.urls = { home: 'https://github.com/0xCompute/ethscribe' }
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'gerald.bauer@gmail.com'
|
data/lib/datauris/version.rb
CHANGED
data/lib/datauris.rb
CHANGED
@@ -57,9 +57,13 @@ module DataUri
|
|
57
57
|
(?<extension>base64|utf8)
|
58
58
|
)?
|
59
59
|
,
|
60
|
-
(?<data
|
60
|
+
(?<data>
|
61
|
+
(?:.|[\n\r])*
|
62
|
+
)
|
61
63
|
\z
|
62
64
|
}x
|
65
|
+
|
66
|
+
## note (?<data>.*) - . (dot) will NOT include newlines!!!
|
63
67
|
|
64
68
|
|
65
69
|
def self._parse( str ) REGEX.match( str ); end
|
@@ -172,8 +176,8 @@ module DataUri
|
|
172
176
|
## utf8 - or force utf8 encoding (utf8: true)
|
173
177
|
## uri - or force STOPPING uri encoding (uri: false)
|
174
178
|
def self.build( data, type=nil, base64: nil, utf8: nil, uri: nil )
|
175
|
-
|
176
|
-
|
179
|
+
str = "data:"
|
180
|
+
str += type if type ## note: allow optional / no type
|
177
181
|
|
178
182
|
## puts " type: #{type.inspect}, base64: #{base64.inspect}"
|
179
183
|
|
@@ -195,9 +199,9 @@ module DataUri
|
|
195
199
|
end
|
196
200
|
|
197
201
|
if base64
|
198
|
-
|
202
|
+
str += ";base64," + Base64.strict_encode64( data )
|
199
203
|
elsif utf8
|
200
|
-
|
204
|
+
str += ";utf8," + data
|
201
205
|
else
|
202
206
|
## use encode_uri_component by default - why? why not?
|
203
207
|
## space becomes %20
|
@@ -205,7 +209,7 @@ module DataUri
|
|
205
209
|
## , becomes %2C and so on
|
206
210
|
##
|
207
211
|
## note: use uri: false to turn of uri encode!!!
|
208
|
-
|
212
|
+
str += "," + (uri == false ? data : encode_uri( data ))
|
209
213
|
end
|
210
214
|
end
|
211
215
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datauris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '4.
|
39
|
+
version: '4.1'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '4.
|
46
|
+
version: '4.1'
|
47
47
|
description: datauris gem - DataUri helpers to parse (decode) and build (encode)
|
48
48
|
data uris incl. (strict) base64-encoded/decoded images and more
|
49
49
|
email: gerald.bauer@gmail.com
|
@@ -61,7 +61,7 @@ files:
|
|
61
61
|
- lib/datauri.rb
|
62
62
|
- lib/datauris.rb
|
63
63
|
- lib/datauris/version.rb
|
64
|
-
homepage: https://github.com/
|
64
|
+
homepage: https://github.com/0xCompute/ethscribe
|
65
65
|
licenses:
|
66
66
|
- Public Domain
|
67
67
|
metadata: {}
|