Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cgi_escape filter #27

Closed
vilcans opened this issue May 1, 2009 · 3 comments
Closed

cgi_escape filter #27

vilcans opened this issue May 1, 2009 · 3 comments

Comments

@vilcans
Copy link
Contributor

vilcans commented May 1, 2009

I created a filter that escapes characters so they can safely be used in URLs.

I.e. "hey! you!" will be escaped as "hey%21+you%21".

See this branch: http://github.com/vilcans/jekyll/tree/cgi_escape

This is useful if you want to link to a tag summary page where tags potentially have spaces in them. So if tag is "interesting stuff", <a href="/tags/{{tag|cgi_escape}"> would link to /tags/interesting+stuff. I guess it can be used to link to a search engine as well.

(Oh, and standard Jekyll doesn't support tags, but it should, so replace tag with category or topic in the description above.)

@qrush
Copy link
Contributor

qrush commented May 3, 2009

I think xml_escape should be deprecated in favor of using cgi_escape, and cgi_escape should be renamed to simply escape. I don't see any reason why we shouldn't use this for all escaping needs. Any thoughts?

@vilcans
Copy link
Contributor Author

vilcans commented May 3, 2009

I think we need both. xml_escape for escaping strings that are to be inserted into HTML or XML and that may contain <, > or &. cgi_escape for strings that goes into URLs and may contain space, #, % and other special characters.

@qrush
Copy link
Contributor

qrush commented May 3, 2009

Ah, I see the difference now. I merged your patch in and changed xml_escape to use CGI.escapeHTML. Thanks!

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants