# File lib/nanoc/helpers/html_escape.rb, line 31
    def html_escape(string=nil, &block)
      if block_given?
        # Capture and escape block
        data = capture(&block)
        escaped_data = html_escape(data)

        # Append filtered data to buffer
        buffer = eval('_erbout', block.binding)
        buffer << escaped_data
      elsif string
        string.gsub('&', '&amp;').
               gsub('<', '&lt;').
               gsub('>', '&gt;').
               gsub('"', '&quot;')
      else
        raise RuntimeError, "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