Module: Immunio::SlimHooks
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/immunio/plugins/action_view/slim.rb
Overview
Hook for Slim template engine.
Instance Method Summary collapse
Instance Method Details
#on_slim_output_with_immunio(escape, code, content) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/immunio/plugins/action_view/slim.rb', line 10 def on_slim_output_with_immunio(escape, code, content) # Allow Slim to insert "do" if judged appropriate result = on_slim_output_without_immunio(escape, code, content) code = result[3] # Wrap expressions in the templates to track their rendered value. # Do not wrap expressions with blocks, eg.: `= form_tag do` Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do unless code =~ Slim::DoInserter::BLOCK_REGEX # Escape if we're told to by Slim code = Immunio::Template.generate_render_var_code(code, escape) end end result[3] = code result end |