Module: Liquid::Autoescape::CoreExemptions
- Defined in:
- lib/liquid/autoescape/core_exemptions.rb
Overview
Core exemptions for all Liquid variables
These exemptions are used to build the default exemption list referenced when determining whether variables should be escaped.
Instance Method Summary collapse
-
#uses_escaping_filter?(variable) ⇒ Boolean
Determine whether a Liquid variable uses an escaping filter.
-
#uses_trusted_filter?(variable) ⇒ Boolean
Determine whether a Liquid variable uses a trusted filters.
Instance Method Details
#uses_escaping_filter?(variable) ⇒ Boolean
Determine whether a Liquid variable uses an escaping filter
This accounts for both filters that are known to escape the variable and those that should prevent the variable from being escaped.
25 26 27 |
# File 'lib/liquid/autoescape/core_exemptions.rb', line 25 def uses_escaping_filter?(variable) !(variable.filters & ESCAPING_FILTERS).empty? end |
#uses_trusted_filter?(variable) ⇒ Boolean
Determine whether a Liquid variable uses a trusted filters
Trusted filters can be configured by the user to include any custom filters that are known to generate already escaped markup.
36 37 38 |
# File 'lib/liquid/autoescape/core_exemptions.rb', line 36 def uses_trusted_filter?(variable) !(variable.filters & Autoescape.configuration.trusted_filters).empty? end |