Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added uri_escape for cases where cgi_escape isn't appropriate

  • Loading branch information...
commit 4c08643c50a59a404faaa639b33ac6c635b678ff 1 parent 3fa9af1
@claco claco authored
Showing with 10 additions and 0 deletions.
  1. +6 −0 lib/jekyll/filters.rb
  2. +4 −0 test/test_filters.rb
View
6 lib/jekyll/filters.rb
@@ -1,3 +1,5 @@
+require 'uri'
+
module Jekyll
module Filters
@@ -25,6 +27,10 @@ def cgi_escape(input)
CGI::escape(input)
end
+ def uri_escape(input)
+ URI.escape(input)
+ end
+
def number_of_words(input)
input.split.length
end
View
4 test/test_filters.rb
@@ -45,5 +45,9 @@ class JekyllFilter
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
Please sign in to comment.
Something went wrong with that request. Please try again.