Module: Haml::Helpers::XssMods

### Home Classes Methods

### In Files

- lib/haml/helpers/xss_mods.rb

### Methods

- ::included
- #capture_haml_with_haml_xss
- #escape_once_with_haml_xss
- #find_and_preserve_with_haml_xss
- #haml_concat_with_haml_xss
- #haml_indent_with_haml_xss
- #haml_tag_with_haml_xss
- #html_escape_with_haml_xss
- #list_of_with_haml_xss
- #precede_with_haml_xss
- #preserve_with_haml_xss
- #succeed_with_haml_xss
- #surround_with_haml_xss

### Class/Module Index

Quicksearch

- Haml
- Haml::Buffer
- Haml::Compiler
- Haml::Engine
- Haml::Error
- Haml::ErubisTemplateHandler
- Haml::Exec
- Haml::Exec::Generic
- Haml::Exec::Haml
- Haml::Filters
- Haml::Filters::Base
- Haml::Filters::Cdata
- Haml::Filters::Css
- Haml::Filters::Erb
- Haml::Filters::Escaped
- Haml::Filters::Javascript
- Haml::Filters::Plain
- Haml::Filters::PrecompiledTiltFilter
- Haml::Filters::Preserve
- Haml::Filters::Ruby
- Haml::Filters::SassRailsTemplate
- Haml::Filters::ScssRailsTemplate
- Haml::Filters::TiltFilter
- Haml::Helpers
- Haml::Helpers::ActionViewExtensions
- Haml::Helpers::ErrorReturn
- Haml::Helpers::XssMods
- Haml::Options
- Haml::Parser
- Haml::Parser::Line
- Haml::Parser::ParseNode
- Haml::Plugin
- Haml::Railtie
- Haml::SafeErubisTemplate
- Haml::SyntaxError
- Haml::Template
- Haml::Util
- Haml::Util::StaticConditionalContext
- ActionView
- ActionView::Base
- ActionView::Helpers
- ActionView::Helpers::CaptureHelper
- ActionView::Helpers::FormHelper
- ActionView::Helpers::FormTagHelper
- ActionView::Helpers::HamlSupport
- ActionView::Helpers::InstanceTag
- ActionView::Helpers::TagHelper
- ActionView::Helpers::Tags
- ActionView::Helpers::Tags::TextArea
- ActionView::Helpers::TextHelper
- Object

No matching classes.

# Haml::Helpers::XssMods

This module overrides Haml helpers to work properly in the context of ActionView. Currently it’s only used for modifying the helpers to work with Rails’ XSS protection methods.

### Public Class Methods

included(base) click to toggle source

    # File lib/haml/helpers/xss_mods.rb, line 8
    def self.included(base)
      ]html_escape find_and_preserve preserve list_of surround
         precede succeed capture_haml haml_concat haml_indent
         haml_tag escape_once].each do |name|
        base.send(:alias_method, "#{name}_without_haml_xss", name)
        base.send(:alias_method, name, "#{name}_with_haml_xss")
      end
    end

### Public Instance Methods

capture_haml_with_haml_xss(*args, &block) click to toggle source

Output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 60
    def capture_haml_with_haml_xss(*args, &block)
      Haml::Util.html_safe(capture_haml_without_haml_xss(*args, &block))
    end

escape_once_with_haml_xss(*args) click to toggle source

Output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 83
    def escape_once_with_haml_xss(*args)
      Haml::Util.html_safe(escape_once_without_haml_xss(*args))
    end

find_and_preserve_with_haml_xss(*args, &block) click to toggle source

Output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 26
    def find_and_preserve_with_haml_xss(*args, &block)
      Haml::Util.html_safe(find_and_preserve_without_haml_xss(*args, &block))
    end

haml_concat_with_haml_xss(text = "") click to toggle source

Input is escaped

    # File lib/haml/helpers/xss_mods.rb, line 65
    def haml_concat_with_haml_xss(text = "")
      raw = instance_variable_defined?('@_haml_concat_raw') ? @_haml_concat_raw : false
      haml_concat_without_haml_xss(raw ? text : haml_xss_html_escape(text))
    end

haml_indent_with_haml_xss() click to toggle source

Output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 71
    def haml_indent_with_haml_xss
      Haml::Util.html_safe(haml_indent_without_haml_xss)
    end

haml_tag_with_haml_xss(name, *rest, &block) click to toggle source

Input is escaped, haml_concat’ed output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 76
    def haml_tag_with_haml_xss(name, *rest, &block)
      name = haml_xss_html_escape(name.to_s)
      rest.unshift(haml_xss_html_escape(rest.shift.to_s)) unless [Symbol, Hash, NilClass].any? {|t| rest.first.is_a? t}
      with_raw_haml_concat {haml_tag_without_haml_xss(name, *rest, &block)}
    end

html_escape_with_haml_xss(text) click to toggle source

Don’t escape text that’s already safe, output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 19
    def html_escape_with_haml_xss(text)
      str = text.to_s
      return text if str.html_safe?
      Haml::Util.html_safe(html_escape_without_haml_xss(str))
    end

list_of_with_haml_xss(*args, &block) click to toggle source

Output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 36
    def list_of_with_haml_xss(*args, &block)
      Haml::Util.html_safe(list_of_without_haml_xss(*args, &block))
    end

precede_with_haml_xss(str, &block) click to toggle source

Input is escaped, output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 50
    def precede_with_haml_xss(str, &block)
      Haml::Util.html_safe(precede_without_haml_xss(haml_xss_html_escape(str), &block))
    end

preserve_with_haml_xss(*args, &block) click to toggle source

Output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 31
    def preserve_with_haml_xss(*args, &block)
      Haml::Util.html_safe(preserve_without_haml_xss(*args, &block))
    end

succeed_with_haml_xss(str, &block) click to toggle source

Input is escaped, output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 55
    def succeed_with_haml_xss(str, &block)
      Haml::Util.html_safe(succeed_without_haml_xss(haml_xss_html_escape(str), &block))
    end

surround_with_haml_xss(front, back = front, &block) click to toggle source

Input is escaped, output is always HTML safe

    # File lib/haml/helpers/xss_mods.rb, line 41
    def surround_with_haml_xss(front, back = front, &block)
      Haml::Util.html_safe(
        surround_without_haml_xss(
          haml_xss_html_escape(front),
          haml_xss_html_escape(back),
          &block))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.