lib/nanoc/helpers/html_escape.rb in nanoc-3.7.4 vs lib/nanoc/helpers/html_escape.rb in nanoc-3.7.5

- old
+ new

@@ -1,12 +1,10 @@ # encoding: utf-8 module Nanoc::Helpers - # Contains functionality for HTML-escaping strings. module HTMLEscape - require 'nanoc/helpers/capturing' include Nanoc::Helpers::Capturing # Returns the HTML-escaped representation of the given string or the given # block. Only `&`, `<`, `>` and `"` are escaped. When given a block, the @@ -37,19 +35,17 @@ # Append filtered data to buffer buffer = eval('_erbout', block.binding) buffer << escaped_data elsif string string.gsub('&', '&amp;') - .gsub('<', '&lt;') - .gsub('>', '&gt;') - .gsub('"', '&quot;') + .gsub('<', '&lt;') + .gsub('>', '&gt;') + .gsub('"', '&quot;') else raise 'The #html_escape or #h function needs either a ' \ 'string or a block to HTML-escape, but neither a string nor a block was given' end end alias_method :h, :html_escape - end - end