Added uri_escape for cases where cgi_escape isn't appropriate
This commit is contained in:
parent
3fa9af17fa
commit
4c08643c50
|
@ -1,3 +1,5 @@
|
||||||
|
require 'uri'
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
|
||||||
module Filters
|
module Filters
|
||||||
|
@ -25,6 +27,10 @@ module Jekyll
|
||||||
CGI::escape(input)
|
CGI::escape(input)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def uri_escape(input)
|
||||||
|
URI.escape(input)
|
||||||
|
end
|
||||||
|
|
||||||
def number_of_words(input)
|
def number_of_words(input)
|
||||||
input.split.length
|
input.split.length
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,5 +45,9 @@ class TestFilters < Test::Unit::TestCase
|
||||||
should "escape special characters" do
|
should "escape special characters" do
|
||||||
assert_equal "hey%21", @filter.cgi_escape("hey!")
|
assert_equal "hey%21", @filter.cgi_escape("hey!")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "escape space as %20" do
|
||||||
|
assert_equal "my%20things", @filter.uri_escape("my things")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue