Module: ReVIEW::HTMLUtils
- Included in:
- HTMLBuilder, HTMLTOCPrinter, IDGXMLBuilder
- Defined in:
- lib/review/htmlutils.rb
Constant Summary collapse
- ESC =
{ '&' => '&', '<' => '<', '>' => '>', '"' => '"' }
Instance Method Summary collapse
Instance Method Details
#escape_html(str) ⇒ Object
21 22 23 24 |
# File 'lib/review/htmlutils.rb', line 21 def escape_html(str) t = ESC str.gsub(/[&"<>]/) {|c| t[c] } end |
#strip_html(str) ⇒ Object
31 32 33 |
# File 'lib/review/htmlutils.rb', line 31 def strip_html(str) str.gsub(/<\/?[^>]*>/, "") end |
#unescape_html(str) ⇒ Object
26 27 28 29 |
# File 'lib/review/htmlutils.rb', line 26 def unescape_html(str) # FIXME better code str.gsub('"', '"').gsub('>', '>').gsub('<', '<').gsub('&', '&') end |