Sha256: 6120309e1de71ffc85ac867dc0d693fb67bda6ca98d389fcb4fb249a47ecd697

Contents?: true

Size: 1.11 KB

Versions: 26

Compression:

Stored size: 1.11 KB

Contents

raise "Haml not loaded" unless Haml::Engine.instance_method(:push_script)

module Haml
  class Engine
    def push_script(text, flattened)
      unless options[:suppress_eval]
        push_silent("haml_temp = #{text}", true)
        push_silent("haml_temp = haml_temp.to_s_xss_protected", true)
        out = "haml_temp = _hamlout.push_script(haml_temp, #{@output_tabs}, #{flattened})\n"
        if @block_opened
          push_and_tabulate([:loud, out])
        else
          @precompiled << out
        end
      end
    end

    def build_attributes(attributes = {})
      # We ignore @options[:attr_wrapper] because ERB::Util.h does not espace ' to &apos;
      # making ' as attribute quote not workable
      result = attributes.map do |a,v|
        v = v.to_s_xss_protected
        unless v.blank?
          " #{a}=\"#{v}\""
        end
      end
      result.sort.join
    end
  end

  class Buffer
    def build_attributes(attributes = {})
      result = attributes.map do |a,v|
        v = v.to_s_xss_protected
        unless v.blank?
          " #{a}=\"#{v}\""
        end
      end
      result.sort.join
    end
  end
end

Version data entries

26 entries across 26 versions & 5 rubygems

Version Path
codez-tarantula-0.5.5 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
codez-tarantula-0.5.4 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
artmotion-xss_shield-0.0.1 lib/xss_shield/haml_hacks.rb
artmotion-xss_shield-0.0.2 lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.1 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.2 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.3 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.5 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.6 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.7.1 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.7 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.8.0 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
relevance-tarantula-0.0.8.1 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
romanbsd-tarantula-0.1.8 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
romanbsd-tarantula-0.2.0 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
codez-tarantula-0.5.3 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
codez-tarantula-0.5.1 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
codez-tarantula-0.5.0 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
tarantula-0.5.1 vendor/xss-shield/lib/xss_shield/haml_hacks.rb
tarantula-0.5.0 vendor/xss-shield/lib/xss_shield/haml_hacks.rb