From 42a65a57e61cabacfb2505c22735527f2124a41e Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 17 Feb 2017 02:16:37 +0000 Subject: [PATCH] Makes uri_escape template docs more specific. I didn't know the difference between cgi_escape and uri_escape until it bit me when I had a colon in a title I used uri_escape on. Addressable::URI.encode (from addressable 2.4.0 and later) thought it was a URI and raised an error. I should have been using cgi_escape, which is for strings that will be added to URIs and not uri_escape, which is for encoding strings that are already in a URI. This commit borrows from the addressable docs to make it more specific so that readers choose uri_escape when they already have a URI and cgi_escape when they are just escaping a plain string. --- docs/_docs/templates.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_docs/templates.md b/docs/_docs/templates.md index 0d4975d6..19ad6519 100644 --- a/docs/_docs/templates.md +++ b/docs/_docs/templates.md @@ -194,15 +194,15 @@ common tasks easier.

URI Escape

- URI escape a string. + Percent encodes any special characters in a URI.

- {% raw %}{{ "foo, bar \baz?" | uri_escape }}{% endraw %} + {% raw %}{{ "http://foo.com/?query=foo, bar \baz?" | uri_escape }}{% endraw %}

- foo,%20bar%20%5Cbaz? + http://foo.com/?query=foo,%20bar%20%5Cbaz?