Add url_encode standard filter

This commit is contained in:
Derrick Reimer
2014-08-15 08:45:40 -07:00
parent c2663258be
commit 0b847e553c
2 changed files with 9 additions and 0 deletions
+4
View File
@@ -42,6 +42,10 @@ module Liquid
input.to_s.gsub(HTML_ESCAPE_ONCE_REGEXP, HTML_ESCAPE)
end
def url_encode(input)
CGI.escape(input) rescue input
end
def slice(input, offset, length=nil)
offset = Integer(offset)
length = length ? Integer(length) : 1