Created
April 14, 2011 11:08
-
-
Save jamesan/919275 to your computer and use it in GitHub Desktop.
Percent encoding for URI conforming to RFC 3986.
Ref: http://tools.ietf.org/html/rfc3986#page-12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'liquid' | |
require 'uri' | |
# Percent encoding for URI conforming to RFC 3986. | |
# Ref: http://tools.ietf.org/html/rfc3986#page-12 | |
module URLEncoding | |
def url_encode(url) | |
return URI.escape(url, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) | |
end | |
end | |
Liquid::Template.register_filter(URLEncoding) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see https://github.com/mojombo/jekyll/wiki/Liquid-Extensions
so you would probably want sth like this: