Skip to content

Commit

Permalink
Merge remote branch 'claco/uri-escape'
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Nov 17, 2010
2 parents 4afee1b + 4c08643 commit f7ab019
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/jekyll/filters.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'uri'

module Jekyll

module Filters
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/test_filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f7ab019

Please sign in to comment.