Method: Jekyll::Filters#xml_escape
- Defined in:
- lib/jekyll/filters.rb
#xml_escape(input) ⇒ Object
XML escape a string for use. Replaces any special characters with appropriate HTML entity replacements.
input - The String to escape.
Examples
xml_escape('foo "bar" <baz>')
# => "foo "bar" <baz>"
Returns the escaped String.
77 78 79 |
# File 'lib/jekyll/filters.rb', line 77 def xml_escape(input) input.to_s.encode(:xml => :attr).gsub(%r!\A"|"\Z!, "") end |