Module: Nanoc3::Helpers::HTMLEscape

Nanoc3::Helpers::HTMLEscape contains functionality for HTML-escaping strings.

Public Visibility

Public Instance Method Summary

#html_escape(string) #h

Returns the HTML-escaped representation of the given string.

Public Instance Method Details

html_escape

public html_escape(string)

Also known as: h

Returns the HTML-escaped representation of the given string. Only &, <, > and " are escaped.

[View source]


11
12
13
14
15
16
# File 'lib/nanoc3/helpers/html_escape.rb', line 11

def html_escape(string)
  string.gsub('&', '&amp;').
         gsub('<', '&lt;').
         gsub('>', '&gt;').
         gsub('"', '&quot;')
end
Generated on Sunday, August 09 2009 at 01:43:13 PM by YARD 0.2.3.2 (ruby-1.8.7).