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 Filters
|
||||
|
@ -25,6 +27,10 @@ module Jekyll
|
|||
CGI::escape(input)
|
||||
end
|
||||
|
||||
def uri_escape(input)
|
||||
URI.escape(input)
|
||||
end
|
||||
|
||||
def number_of_words(input)
|
||||
input.split.length
|
||||
end
|
||||
|
|
|
@ -45,5 +45,9 @@ class TestFilters < Test::Unit::TestCase
|
|||
should "escape special characters" do
|
||||
assert_equal "hey%21", @filter.cgi_escape("hey!")
|
||||
end
|
||||
|
||||
should "escape space as %20" do
|
||||
assert_equal "my%20things", @filter.uri_escape("my things")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue