escape_utils 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CHANGELOG.md +4 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +58 -0
- data/Rakefile +35 -0
- data/VERSION +1 -0
- data/benchmark/escape.rb +58 -0
- data/benchmark/unescape.rb +36 -0
- data/escape_utils.gemspec +62 -0
- data/ext/escape_utils.c +124 -0
- data/ext/extconf.rb +9 -0
- data/lib/escape_utils.rb +8 -0
- data/lib/escape_utils/cgi.rb +7 -0
- data/lib/escape_utils/erb.rb +13 -0
- data/lib/escape_utils/haml.rb +9 -0
- data/lib/escape_utils/rack.rb +12 -0
- data/spec/html/escape_spec.rb +26 -0
- data/spec/html/unescape_spec.rb +26 -0
- data/spec/rcov.opts +3 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +5 -0
- metadata +85 -0
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Brian Lopez - http://github.com/brianmario
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
= escape_utils
|
2
|
+
|
3
|
+
Being as though we're all html escaping everything these days, why not make it faster?
|
4
|
+
|
5
|
+
At the moment escape_utils supports escaping and unescaping of HTML, but I wanna add URL encoding soon
|
6
|
+
|
7
|
+
It has monkey-patches for Rack::Utils, CGI, ERB::Util and Haml
|
8
|
+
|
9
|
+
== Installing
|
10
|
+
|
11
|
+
gem install escape_utils
|
12
|
+
|
13
|
+
== Usage
|
14
|
+
|
15
|
+
=== Escaping HTML
|
16
|
+
|
17
|
+
html = `curl -s http://maps.google.com`
|
18
|
+
escaped_html = EscapeUtils.escape_html(html)
|
19
|
+
|
20
|
+
=== Unescaping HTML
|
21
|
+
|
22
|
+
html = `curl -s http://maps.google.com`
|
23
|
+
escaped_html = EscapeUtils.escape_html(html)
|
24
|
+
html = EscapeUtils.unescape_html(escaped_html)
|
25
|
+
|
26
|
+
=== Monkey Patches
|
27
|
+
|
28
|
+
require 'escape_utils/rack' # to patch Rack::Utils
|
29
|
+
require 'escape_utils/erb' # to patch ERB::Util
|
30
|
+
require 'escape_utils/cgi' # to patch CGI
|
31
|
+
require 'escape_utils/haml' # to patch Haml::Helpers
|
32
|
+
|
33
|
+
== Benchmarks
|
34
|
+
|
35
|
+
In my testing, escaping is around 10-20x faster than the pure ruby implementations in wide use today.
|
36
|
+
While unescaping is around 24x faster than CGI.unescapeHTML - also pure ruby.
|
37
|
+
|
38
|
+
This output is from my laptop using the benchmark scripts in the benchmarks folder.
|
39
|
+
|
40
|
+
=== Escaping
|
41
|
+
|
42
|
+
Rack::Utils.escape_html
|
43
|
+
0.560000 0.040000 0.600000 ( 0.589475)
|
44
|
+
ERB::Util.html_escape
|
45
|
+
0.450000 0.040000 0.490000 ( 0.492893)
|
46
|
+
CGI.escapeHTML
|
47
|
+
0.460000 0.030000 0.490000 ( 0.490171)
|
48
|
+
Haml::Helpers.html_escape
|
49
|
+
0.430000 0.010000 0.440000 ( 0.444694)
|
50
|
+
EscapeUtils.escape_html
|
51
|
+
0.050000 0.010000 0.060000 ( 0.054799)
|
52
|
+
|
53
|
+
=== Unescaping
|
54
|
+
|
55
|
+
CGI.unescapeHTML
|
56
|
+
1.140000 0.010000 1.150000 ( 1.148470)
|
57
|
+
EscapeUtils.unescape_html
|
58
|
+
0.040000 0.000000 0.040000 ( 0.046166)
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
begin
|
3
|
+
require 'jeweler'
|
4
|
+
Jeweler::Tasks.new do |gem|
|
5
|
+
gem.name = "escape_utils"
|
6
|
+
gem.summary = "Faster string escaping routines for your web apps"
|
7
|
+
gem.email = "seniorlopez@gmail.com"
|
8
|
+
gem.homepage = "http://github.com/brianmario/escape_utils"
|
9
|
+
gem.authors = ["Brian Lopez"]
|
10
|
+
gem.require_paths = ["lib", "ext"]
|
11
|
+
gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n")
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.extensions = ["ext/extconf.rb"]
|
14
|
+
gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
|
15
|
+
# gem.rubyforge_project = "mysql2"
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler -s http://gems.github.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake'
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
|
24
|
+
desc "Run all examples with RCov"
|
25
|
+
Spec::Rake::SpecTask.new('spec:rcov') do |t|
|
26
|
+
t.spec_files = FileList['spec/']
|
27
|
+
t.rcov = true
|
28
|
+
t.rcov_opts = lambda do
|
29
|
+
IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
30
|
+
end
|
31
|
+
end
|
32
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
33
|
+
t.spec_files = FileList['spec/']
|
34
|
+
t.spec_opts << '--options' << 'spec/spec.opts'
|
35
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/benchmark/escape.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
|
3
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'benchmark'
|
7
|
+
|
8
|
+
require 'rack'
|
9
|
+
require 'erb'
|
10
|
+
require 'cgi'
|
11
|
+
require 'haml'
|
12
|
+
require 'escape_utils'
|
13
|
+
|
14
|
+
module HamlBench
|
15
|
+
extend Haml::Helpers
|
16
|
+
end
|
17
|
+
|
18
|
+
times = 100
|
19
|
+
url = "http://maps.google.com"
|
20
|
+
html = `curl -s #{url}`
|
21
|
+
puts "Escaping #{html.bytesize} bytes of html from #{url}"
|
22
|
+
|
23
|
+
Benchmark.bmbm do |x|
|
24
|
+
x.report do
|
25
|
+
puts "Rack::Utils.escape_html"
|
26
|
+
times.times do
|
27
|
+
Rack::Utils.escape_html(html)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
x.report do
|
32
|
+
puts "ERB::Util.html_escape"
|
33
|
+
times.times do
|
34
|
+
ERB::Util.html_escape(html)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
x.report do
|
39
|
+
puts "CGI.escapeHTML"
|
40
|
+
times.times do
|
41
|
+
CGI.escapeHTML(html)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
x.report do
|
46
|
+
puts "Haml::Helpers.html_escape"
|
47
|
+
times.times do
|
48
|
+
HamlBench.html_escape(html)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
x.report do
|
53
|
+
puts "EscapeUtils.escape_html"
|
54
|
+
times.times do
|
55
|
+
EscapeUtils.escape_html(html)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
|
3
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'benchmark'
|
7
|
+
|
8
|
+
require 'cgi'
|
9
|
+
require 'haml'
|
10
|
+
require 'escape_utils'
|
11
|
+
|
12
|
+
module HamlBench
|
13
|
+
extend Haml::Helpers
|
14
|
+
end
|
15
|
+
|
16
|
+
times = 100
|
17
|
+
url = "http://maps.google.com"
|
18
|
+
html = `curl -s #{url}`
|
19
|
+
escaped_html = EscapeUtils.escape_html(html)
|
20
|
+
puts "Unescaping #{escaped_html.bytesize} bytes of escaped html from #{url}"
|
21
|
+
|
22
|
+
Benchmark.bmbm do |x|
|
23
|
+
x.report do
|
24
|
+
puts "CGI.unescapeHTML"
|
25
|
+
times.times do
|
26
|
+
CGI.unescapeHTML(escaped_html)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
x.report do
|
31
|
+
puts "EscapeUtils.unescape_html"
|
32
|
+
times.times do
|
33
|
+
EscapeUtils.unescape_html(escaped_html)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{escape_utils}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Brian Lopez"]
|
12
|
+
s.date = %q{2010-06-08}
|
13
|
+
s.email = %q{seniorlopez@gmail.com}
|
14
|
+
s.extensions = ["ext/extconf.rb"]
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"CHANGELOG.md",
|
21
|
+
"MIT-LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"benchmark/escape.rb",
|
26
|
+
"benchmark/unescape.rb",
|
27
|
+
"escape_utils.gemspec",
|
28
|
+
"ext/escape_utils.c",
|
29
|
+
"ext/extconf.rb",
|
30
|
+
"lib/escape_utils.rb",
|
31
|
+
"lib/escape_utils/cgi.rb",
|
32
|
+
"lib/escape_utils/erb.rb",
|
33
|
+
"lib/escape_utils/haml.rb",
|
34
|
+
"lib/escape_utils/rack.rb",
|
35
|
+
"spec/html/escape_spec.rb",
|
36
|
+
"spec/html/unescape_spec.rb",
|
37
|
+
"spec/rcov.opts",
|
38
|
+
"spec/spec.opts",
|
39
|
+
"spec/spec_helper.rb"
|
40
|
+
]
|
41
|
+
s.homepage = %q{http://github.com/brianmario/escape_utils}
|
42
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
43
|
+
s.require_paths = ["lib", "ext"]
|
44
|
+
s.rubygems_version = %q{1.3.6}
|
45
|
+
s.summary = %q{Faster string escaping routines for your web apps}
|
46
|
+
s.test_files = [
|
47
|
+
"spec/html/escape_spec.rb",
|
48
|
+
"spec/html/unescape_spec.rb",
|
49
|
+
"spec/spec_helper.rb"
|
50
|
+
]
|
51
|
+
|
52
|
+
if s.respond_to? :specification_version then
|
53
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
54
|
+
s.specification_version = 3
|
55
|
+
|
56
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
57
|
+
else
|
58
|
+
end
|
59
|
+
else
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
data/ext/escape_utils.c
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
|
3
|
+
#define APPEND_BUFFER(escape, len, scoot_by) \
|
4
|
+
memcpy(&out[total], &in[offset], i-offset); \
|
5
|
+
total += i-offset; \
|
6
|
+
offset = i+scoot_by; \
|
7
|
+
memcpy(&out[total], escape, len); \
|
8
|
+
total += len; \
|
9
|
+
break; \
|
10
|
+
|
11
|
+
static size_t escape_html(unsigned char *out, const unsigned char *in, size_t in_len) {
|
12
|
+
size_t i = 0, offset = 0, total = 0;
|
13
|
+
|
14
|
+
for(;i<in_len;i++) {
|
15
|
+
switch(in[i]) {
|
16
|
+
case '&': APPEND_BUFFER("&", 5, 1);
|
17
|
+
case '<': APPEND_BUFFER("<", 4, 1);
|
18
|
+
case '>': APPEND_BUFFER(">", 4, 1);
|
19
|
+
case '\'': APPEND_BUFFER("'", 5, 1);
|
20
|
+
case '\"': APPEND_BUFFER(""", 6, 1);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
// append the rest of the buffer
|
25
|
+
memcpy(&out[total], &in[offset], i-offset);
|
26
|
+
|
27
|
+
return total + (i-offset);
|
28
|
+
}
|
29
|
+
|
30
|
+
static size_t unescape_html(unsigned char *out, const unsigned char *in, size_t in_len) {
|
31
|
+
size_t i = 0, offset = 0, total = 0;
|
32
|
+
|
33
|
+
for(;i<in_len;i++) {
|
34
|
+
switch(in[i]) {
|
35
|
+
case '&':
|
36
|
+
if (i+5 <= in_len) {
|
37
|
+
if (memcmp(&in[i], "&", 5) == 0) {
|
38
|
+
APPEND_BUFFER("&", 1, 5);
|
39
|
+
} else if (memcmp(&in[i], "<", 4) == 0) {
|
40
|
+
APPEND_BUFFER("<", 1, 4);
|
41
|
+
} else if (memcmp(&in[i], ">", 4) == 0) {
|
42
|
+
APPEND_BUFFER(">", 1, 4);
|
43
|
+
} else if (memcmp(&in[i], "'", 5) == 0) {
|
44
|
+
APPEND_BUFFER("\'", 1, 5);
|
45
|
+
} else if (memcmp(&in[i], """, 6) == 0) {
|
46
|
+
APPEND_BUFFER("\"", 1, 6);
|
47
|
+
}
|
48
|
+
} else if (i+4 <= in_len) {
|
49
|
+
if (memcmp(&in[i], "&", 5) == 0) {
|
50
|
+
APPEND_BUFFER("&", 1, 5);
|
51
|
+
} else if (memcmp(&in[i], "<", 4) == 0) {
|
52
|
+
APPEND_BUFFER("<", 1, 4);
|
53
|
+
} else if (memcmp(&in[i], ">", 4) == 0) {
|
54
|
+
APPEND_BUFFER(">", 1, 4);
|
55
|
+
} else if (memcmp(&in[i], "'", 5) == 0) {
|
56
|
+
APPEND_BUFFER("\'", 1, 5);
|
57
|
+
}
|
58
|
+
} else if (i+3 <= in_len) {
|
59
|
+
if (memcmp(&in[i], "<", 4) == 0) {
|
60
|
+
APPEND_BUFFER("<", 1, 4);
|
61
|
+
} else if (memcmp(&in[i], ">", 4) == 0) {
|
62
|
+
APPEND_BUFFER(">", 1, 4);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
break;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
// append the rest of the buffer
|
70
|
+
memcpy(&out[total], &in[offset], i-offset);
|
71
|
+
|
72
|
+
return total + (i-offset);
|
73
|
+
}
|
74
|
+
|
75
|
+
static VALUE rb_escape_html(VALUE self, VALUE str) {
|
76
|
+
VALUE rb_output_buf;
|
77
|
+
unsigned char *inBuf = (unsigned char*)RSTRING_PTR(str);
|
78
|
+
size_t len = RSTRING_LEN(str), new_len = 0;
|
79
|
+
|
80
|
+
// this is the max size the string could be
|
81
|
+
// TODO: we should try to be more intelligent about this
|
82
|
+
unsigned char *outBuf = (unsigned char *)malloc(sizeof(unsigned char *)*(len*5));
|
83
|
+
|
84
|
+
// perform our escape, returning the new string's length
|
85
|
+
new_len = escape_html(outBuf, inBuf, len);
|
86
|
+
|
87
|
+
// create our new ruby string
|
88
|
+
rb_output_buf = rb_str_new((char *)outBuf, new_len);
|
89
|
+
|
90
|
+
// free the temporary C string
|
91
|
+
free(outBuf);
|
92
|
+
|
93
|
+
return rb_output_buf;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE rb_unescape_html(VALUE self, VALUE str) {
|
97
|
+
VALUE rb_output_buf;
|
98
|
+
unsigned char *inBuf = (unsigned char*)RSTRING_PTR(str);
|
99
|
+
size_t len = RSTRING_LEN(str), new_len = 0;
|
100
|
+
|
101
|
+
// this is the max size the string could be
|
102
|
+
// TODO: we should try to be more intelligent about this
|
103
|
+
unsigned char *outBuf = (unsigned char *)malloc(sizeof(unsigned char *)*len);
|
104
|
+
|
105
|
+
// perform our escape, returning the new string's length
|
106
|
+
new_len = unescape_html(outBuf, inBuf, len);
|
107
|
+
|
108
|
+
// create our new ruby string
|
109
|
+
rb_output_buf = rb_str_new((char *)outBuf, new_len);
|
110
|
+
|
111
|
+
// free the temporary C string
|
112
|
+
free(outBuf);
|
113
|
+
|
114
|
+
return rb_output_buf;
|
115
|
+
}
|
116
|
+
|
117
|
+
/* Ruby Extension initializer */
|
118
|
+
void Init_escape_utils_ext() {
|
119
|
+
VALUE mEscape = rb_define_module("EscapeUtils");
|
120
|
+
rb_define_method(mEscape, "escape_html", rb_escape_html, 1);
|
121
|
+
rb_define_module_function(mEscape, "escape_html", rb_escape_html, 1);
|
122
|
+
rb_define_method(mEscape, "unescape_html", rb_unescape_html, 1);
|
123
|
+
rb_define_module_function(mEscape, "unescape_html", rb_unescape_html, 1);
|
124
|
+
}
|
data/ext/extconf.rb
ADDED
data/lib/escape_utils.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
3
|
+
|
4
|
+
describe EscapeUtils do
|
5
|
+
it "should respond to escape_html" do
|
6
|
+
EscapeUtils.should respond_to(:escape_html)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "escape_html" do
|
10
|
+
it "should escape a basic html tag" do
|
11
|
+
EscapeUtils.escape_html("<some_tag/>").should eql("<some_tag/>")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should escape double-quotes" do
|
15
|
+
EscapeUtils.escape_html("<some_tag some_attr=\"some value\"/>").should eql("<some_tag some_attr="some value"/>")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should escape single-quotes" do
|
19
|
+
EscapeUtils.escape_html("<some_tag some_attr='some value'/>").should eql("<some_tag some_attr='some value'/>")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should escape the & character" do
|
23
|
+
EscapeUtils.escape_html("<b>Bourbon & Branch</b>").should eql("<b>Bourbon & Branch</b>")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
|
3
|
+
|
4
|
+
describe EscapeUtils do
|
5
|
+
it "should respond to unescape_html" do
|
6
|
+
EscapeUtils.should respond_to(:unescape_html)
|
7
|
+
end
|
8
|
+
|
9
|
+
context "unescape_html" do
|
10
|
+
it "should unescape a basic html tag" do
|
11
|
+
EscapeUtils.unescape_html("<some_tag/>").should eql("<some_tag/>")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should unescape double-quotes" do
|
15
|
+
EscapeUtils.unescape_html("<some_tag some_attr="some value"/>").should eql("<some_tag some_attr=\"some value\"/>")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should unescape single-quotes" do
|
19
|
+
EscapeUtils.unescape_html("<some_tag some_attr='some value'/>").should eql("<some_tag some_attr='some value'/>")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should unescape the & character" do
|
23
|
+
EscapeUtils.unescape_html("<b>Bourbon & Branch</b>").should eql("<b>Bourbon & Branch</b>")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/spec/rcov.opts
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: escape_utils
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Brian Lopez
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-06-08 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: seniorlopez@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions:
|
26
|
+
- ext/extconf.rb
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.rdoc
|
29
|
+
files:
|
30
|
+
- .gitignore
|
31
|
+
- CHANGELOG.md
|
32
|
+
- MIT-LICENSE
|
33
|
+
- README.rdoc
|
34
|
+
- Rakefile
|
35
|
+
- VERSION
|
36
|
+
- benchmark/escape.rb
|
37
|
+
- benchmark/unescape.rb
|
38
|
+
- escape_utils.gemspec
|
39
|
+
- ext/escape_utils.c
|
40
|
+
- ext/extconf.rb
|
41
|
+
- lib/escape_utils.rb
|
42
|
+
- lib/escape_utils/cgi.rb
|
43
|
+
- lib/escape_utils/erb.rb
|
44
|
+
- lib/escape_utils/haml.rb
|
45
|
+
- lib/escape_utils/rack.rb
|
46
|
+
- spec/html/escape_spec.rb
|
47
|
+
- spec/html/unescape_spec.rb
|
48
|
+
- spec/rcov.opts
|
49
|
+
- spec/spec.opts
|
50
|
+
- spec/spec_helper.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://github.com/brianmario/escape_utils
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --charset=UTF-8
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
- ext
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
requirements: []
|
76
|
+
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 1.3.6
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: Faster string escaping routines for your web apps
|
82
|
+
test_files:
|
83
|
+
- spec/html/escape_spec.rb
|
84
|
+
- spec/html/unescape_spec.rb
|
85
|
+
- spec/spec_helper.rb
|