Sha256: 6e9db598a4a8f5452c1bc428ae30e9ddb4eeb544fd3f6b93063c598f252fe276

Contents?: true

Size: 656 Bytes

Versions: 2

Compression:

Stored size: 656 Bytes

Contents

#
# $Id: htmlutils.rb 2227 2006-05-13 00:09:08Z aamine $
#
# Copyright (c) 2002-2006 Minero Aoki
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
#

module ReVIEW

  module HTMLUtils
    ESC = {
      '&' => '&',
      '<' => '&lt;',
      '>' => '&gt;',
      '"' => '&quot;'
    }

    def escape_html(str)
      t = ESC
      str.gsub(/[&"<>]/) {|c| t[c] }
    end

    def unescape_html(str)
      # FIXME better code
      str.gsub('&quot;', '"').gsub('&gt;', '>').gsub('&lt;', '<').gsub('&amp;', '&')
    end
  end

end   # module ReVIEW

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
review-1.0.0 lib/review/htmlutils.rb
review-0.9.0 lib/review/htmlutils.rb