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

Documentation for date_to_rfc822 and uri_escape #1142

Merged
merged 2 commits into from
May 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/jekyll/filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@ def xml_escape(input)
def cgi_escape(input)
CGI::escape(input)
end


# URI escape a string.
#
# input - The String to escape.
#
# Examples
#
# uri_escape('foo, bar \\baz?')
# # => "foo,%20bar%20%5Cbaz?"
#
# Returns the escaped String.
def uri_escape(input)
URI.escape(input)
end
Expand Down
30 changes: 30 additions & 0 deletions site/docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ common tasks easier.
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Date to RFC-822 Format</strong></p>
<p>Convert a Date into the RFC-822 format used for RSS feeds.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{% raw %}{{ site.time | date_to_rfc822 }}{% endraw %}</code>
</p>
<p>
<code class='output'>Mon, 17 Nov 2008 13:07:54 -0800</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Date to String</strong></p>
Expand Down Expand Up @@ -93,6 +107,22 @@ common tasks easier.
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>URI Escape</strong></p>
<p>
URI escape a string.
</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{% raw %}{{ “'foo, bar \\baz?'” | uri_escape }}{% endraw %}</code>
</p>
<p>
<code class='output'>foo,%20bar%20%5Cbaz?</code>
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Number of Words</strong></p>
Expand Down