escape_utils 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/benchmark/html_escape.rb +1 -1
- data/benchmark/html_unescape.rb +1 -1
- data/ext/escape_utils/buffer.h +6 -0
- data/ext/escape_utils/escape_utils.c +0 -1
- data/lib/escape_utils/version.rb +1 -1
- data/script/testsuite +10 -0
- data/test/html/escape_test.rb +0 -24
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d21e40641fb15698dc8d2bf394ae9ff766c99b65
|
4
|
+
data.tar.gz: 2e72c13029f33a6cf11fd6980915552e62fa4d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e095eec1d4b9580837a1d5af995f1c8a400c3dcca7ea1a8b3a4a3079809d4e72166b844b17791ab4c90c828be9d7b52331690f30ba88790f79ff18707ead49d6
|
7
|
+
data.tar.gz: e89851568b2650c982297e6af0ae66d506c165be8ff5a3ea1f158f6665d1e15a567f5219741f5e4ab2a78ae5f503b093e171a600088c446dc487024224e9202f
|
data/.travis.yml
CHANGED
data/benchmark/html_escape.rb
CHANGED
@@ -15,7 +15,7 @@ module HamlBench
|
|
15
15
|
extend Haml::Helpers
|
16
16
|
end
|
17
17
|
|
18
|
-
url = "
|
18
|
+
url = "https://en.wikipedia.org/wiki/Succession_to_the_British_throne"
|
19
19
|
html = `curl -s #{url}`
|
20
20
|
html = html.force_encoding('utf-8') if html.respond_to?(:force_encoding)
|
21
21
|
puts "Escaping #{html.bytesize} bytes of html from #{url}"
|
data/benchmark/html_unescape.rb
CHANGED
@@ -12,7 +12,7 @@ module HamlBench
|
|
12
12
|
extend Haml::Helpers
|
13
13
|
end
|
14
14
|
|
15
|
-
url = "
|
15
|
+
url = "https://en.wikipedia.org/wiki/Succession_to_the_British_throne"
|
16
16
|
html = `curl -s #{url}`
|
17
17
|
html = html.force_encoding('binary') if html.respond_to?(:force_encoding)
|
18
18
|
escaped_html = EscapeUtils.escape_html(html)
|
data/ext/escape_utils/buffer.h
CHANGED
@@ -110,4 +110,10 @@ extern void gh_buf_clear(gh_buf *buf);
|
|
110
110
|
|
111
111
|
#define gh_buf_PUTS(buf, str) gh_buf_put(buf, str, sizeof(str) - 1)
|
112
112
|
|
113
|
+
/* support for environments where MIN is not provided */
|
114
|
+
|
115
|
+
#ifndef MIN
|
116
|
+
#define MIN(a,b) (((a)<(b))?(a):(b))
|
117
|
+
#endif
|
118
|
+
|
113
119
|
#endif
|
data/lib/escape_utils/version.rb
CHANGED
data/script/testsuite
ADDED
data/test/html/escape_test.rb
CHANGED
@@ -4,30 +4,6 @@ class MyCustomHtmlSafeString < String
|
|
4
4
|
end
|
5
5
|
|
6
6
|
class HtmlEscapeTest < Minitest::Test
|
7
|
-
def test_escape_source_encoding_is_maintained
|
8
|
-
source = 'foobar'
|
9
|
-
str = EscapeUtils.escape_html_as_html_safe(source)
|
10
|
-
assert_equal source.encoding, str.encoding
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_escape_binary_encoding_is_maintained
|
14
|
-
source = 'foobar'.b
|
15
|
-
str = EscapeUtils.escape_html_as_html_safe(source)
|
16
|
-
assert_equal source.encoding, str.encoding
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_escape_uft8_encoding_is_maintained
|
20
|
-
source = 'foobar'.encode 'UTF-8'
|
21
|
-
str = EscapeUtils.escape_html_as_html_safe(source)
|
22
|
-
assert_equal source.encoding, str.encoding
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_escape_us_ascii_encoding_is_maintained
|
26
|
-
source = 'foobar'.encode 'US-ASCII'
|
27
|
-
str = EscapeUtils.escape_html_as_html_safe(source)
|
28
|
-
assert_equal source.encoding, str.encoding
|
29
|
-
end
|
30
|
-
|
31
7
|
def test_escape_basic_html_with_secure
|
32
8
|
assert_equal "<some_tag/>", EscapeUtils.escape_html("<some_tag/>")
|
33
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: escape_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Lopez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- lib/escape_utils/version.rb
|
172
172
|
- lib/escape_utils/xml/builder.rb
|
173
173
|
- script/bootstrap
|
174
|
+
- script/testsuite
|
174
175
|
- test/helper.rb
|
175
176
|
- test/html/escape_test.rb
|
176
177
|
- test/html/unescape_test.rb
|