mdurl-rb 1.0.0.1 → 1.0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mdurl-rb/cgi.rb +25 -0
- data/lib/mdurl-rb/version.rb +1 -1
- data/lib/mdurl-rb.rb +1 -2
- metadata +4 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2603c6c8889dcb583ac0d890e104794fa3aab7cc
|
4
|
+
data.tar.gz: b5b294a2aff198bb6236b470cd118caa7198fc91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a64d811eb4364669f607e121f59456f8be5a9646858b678be838f8f40c8ba4111c1de15d89372e92cdaa87fde053a13aa17883ba5aeeb9707a90437ba5e71a48
|
7
|
+
data.tar.gz: 0a894850e135ce81b6f68dbeffb988fe9fc25851f7585731361a2c45e7c352014602f97320ee0d87896252ac3be0c95d6670aa8edcf9be73484ad77a60c68e64
|
data/lib/mdurl-rb/cgi.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Borrowed this from motion-support 0.2.6, as it's all we need. Don't want the
|
2
|
+
# dependency
|
3
|
+
#------------------------------------------------------------------------------
|
4
|
+
# This is a very small part of the CGI class, borrowed from the Rubinius sources
|
5
|
+
class CGI
|
6
|
+
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
|
7
|
+
# URL-encode a string.
|
8
|
+
# url_encoded_string = CGI::escape("'Stop!' said Fred")
|
9
|
+
# # => "%27Stop%21%27+said+Fred"
|
10
|
+
def CGI::escape(string)
|
11
|
+
string.gsub(/([^ a-zA-Z0-9_.-]+)/) do
|
12
|
+
'%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
|
13
|
+
end.tr(' ', '+')
|
14
|
+
end
|
15
|
+
|
16
|
+
# URL-decode a string with encoding(optional).
|
17
|
+
# string = CGI::unescape("%27Stop%21%27+said+Fred")
|
18
|
+
# # => "'Stop!' said Fred"
|
19
|
+
def CGI::unescape(string,encoding=@@accept_charset)
|
20
|
+
str=string.tr('+', ' ').force_encoding(Encoding::ASCII_8BIT).gsub(/((?:%[0-9a-fA-F]{2})+)/) do
|
21
|
+
[$1.delete('%')].pack('H*')
|
22
|
+
end.force_encoding(encoding)
|
23
|
+
str.valid_encoding? ? str : str.force_encoding(string.encoding)
|
24
|
+
end
|
25
|
+
end
|
data/lib/mdurl-rb/version.rb
CHANGED
data/lib/mdurl-rb.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdurl-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Walker
|
@@ -10,22 +10,8 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-03-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: motion-support
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
requirements:
|
19
|
-
- - "~>"
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.2.6
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
requirements:
|
26
|
-
- - "~>"
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
version: 0.2.6
|
13
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
29
15
|
description: Ruby version of MDUrl for motion-markdown-it for use with Ruby and RubyMotion
|
30
16
|
email: github@digitalmoksha.com
|
31
17
|
executables: []
|
@@ -34,6 +20,7 @@ extra_rdoc_files: []
|
|
34
20
|
files:
|
35
21
|
- README.md
|
36
22
|
- lib/mdurl-rb.rb
|
23
|
+
- lib/mdurl-rb/cgi.rb
|
37
24
|
- lib/mdurl-rb/decode.rb
|
38
25
|
- lib/mdurl-rb/encode.rb
|
39
26
|
- lib/mdurl-rb/format.rb
|