Sha256: 3ed88fffc62a658e42c56be7df5296275576f21eef0535492856e2b84b522448

Contents?: true

Size: 824 Bytes

Versions: 7

Compression:

Stored size: 824 Bytes

Contents

module HoboFields

  module SanitizeHtml

    PERMITTED_TAGS       = %w(a abbr acronym address b bdo big blockquote br caption center cite code colgroup dd del dfn dir
                              div dl dt em fieldset font h1 h2 h3 h4 h5 h6 i img ins kbd label legend li map menu ol optgroup
                              option p pre q s samp select small span strike strong sub sup tbody td textarea tfoot
                              th thead tr tt u ul var)

    PERMITTED_ATTRIBUTES = %w(href title class style align name src label target)

    class Helper
      include ActionView::Helpers::SanitizeHelper
      extend ActionView::Helpers::SanitizeHelper::ClassMethods
    end

    def self.sanitize(s)
      Helper.new.sanitize(s, :tags => PERMITTED_TAGS, :attributes => PERMITTED_ATTRIBUTES)
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hobo_fields-1.3.0.pre16 lib/hobo_fields/sanitize_html.rb
hobo_fields-1.3.0.pre15 lib/hobo_fields/sanitize_html.rb
hobo_fields-1.3.0.pre14 lib/hobo_fields/sanitize_html.rb
hobo_fields-1.3.0.pre13 lib/hobo_fields/sanitize_html.rb
hobo_fields-1.3.0.pre12 lib/hobo_fields/sanitize_html.rb
hobo_fields-1.3.0.pre11 lib/hobo_fields/sanitize_html.rb
hobo_fields-1.3.0.pre10 lib/hobo_fields/sanitize_html.rb