Sha256: 0da1908303b79b8738217b807e0638666e1776f0d50a16f5afcd397979f71347

Contents?: true

Size: 545 Bytes

Versions: 1

Compression:

Stored size: 545 Bytes

Contents

module Nanoc2::Helpers

  # Nanoc2::Helpers::HTMLEscape contains functionality for HTML-escaping
  # strings.
  #
  # This helper is activated automatically.
  module HTMLEscape

    # Returns the HTML-escaped representation of the given string. Only &, <,
    # > and " are escaped.
    def html_escape(string)
      string.gsub('&', '&amp;').
             gsub('<', '&lt;').
             gsub('>', '&gt;').
             gsub('"', '&quot;')
    end

    alias h html_escape

  end

end

# Include by default
include Nanoc2::Helpers::HTMLEscape

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc2-2.2.3 lib/nanoc2/helpers/html_escape.rb