Module | Nanoc::Helpers::HTMLEscape |
In: |
lib/nanoc/helpers/html_escape.rb
|
Contains functionality for HTML-escaping strings.
Returns the HTML-escaped representation of the given string or the given block. Only `&`, `<`, `>` and `"` are escaped. When given a block, the contents of the block will be escaped and appended to the output buffer, `_erbout`.
@example Escaping a string
h('<br>') # => '<br>'
@example Escaping with a block
<% h do %> <h1>Hello <em>world</em>!</h1> <% end %> # The buffer will now contain “<h1>Hello <em>world</em>!</h1>”
@param [String] string The string to escape
@return [String] The escaped string