Sha256: 2c27eff5868e07bf98a81db8076c1bd21724336e8cb16391750a004a18d896bb

Contents?: true

Size: 377 Bytes

Versions: 18

Compression:

Stored size: 377 Bytes

Contents

require 'template'

class ERB
  module Util
    `var escapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'};`
    `var escape_regexp = /[&<>"']/g;`

    def html_escape(str)
      `("" + str).replace(escape_regexp, function (m) { return escapes[m] })`
    end

    alias h html_escape
    module_function :h
    module_function :html_escape
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
opal-1.3.2 stdlib/erb.rb
opal-1.3.1 stdlib/erb.rb
opal-1.3.0 stdlib/erb.rb
opal-1.3.0.rc1 stdlib/erb.rb
opal-1.3.0.alpha1 stdlib/erb.rb
opal-1.2.0 stdlib/erb.rb
opal-1.2.0.beta1 stdlib/erb.rb
opal-1.1.1 stdlib/erb.rb
opal-1.1.1.rc1 stdlib/erb.rb
opal-1.1.0 stdlib/erb.rb
opal-1.1.0.rc1 stdlib/erb.rb
opal-1.0.5 stdlib/erb.rb
opal-1.0.4 stdlib/erb.rb
opal-1.0.3 stdlib/erb.rb
opal-1.0.2 stdlib/erb.rb
opal-1.0.1 stdlib/erb.rb
opal-1.0.0 stdlib/erb.rb
opal-1.0.0.beta1 stdlib/erb.rb