Class: Temple::ERB::Trimming
- Defined in:
- lib/temple/erb/trimming.rb
Overview
ERB trimming like in erubis Deletes spaces around ‘<% %>’ and leave spaces around ‘<%= %>’.
Constant Summary
Constants included from Utils
Utils::ESCAPE_HTML, Utils::ESCAPE_HTML_PATTERN
Instance Attribute Summary
Attributes included from Mixins::Options
Instance Method Summary collapse
Methods included from Mixins::Options
Methods included from Mixins::ControlFlowDispatcher
#on_block, #on_case, #on_cond, #on_if
Methods included from Mixins::EscapeDispatcher
Methods included from Mixins::CoreDispatcher
Methods included from Mixins::CompiledDispatcher
Methods included from Utils
#empty_exp?, #escape_html, #escape_html_safe, #indent_dynamic, #unique_name
Instance Method Details
#on_multi(*exps) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/temple/erb/trimming.rb', line 10 def on_multi(*exps) exps = exps.each_with_index.map do |e,i| if e.first == :static && i > 0 && exps[i-1].first == :code [:static, e.last.lstrip] elsif e.first == :static && i < exps.size-1 && exps[i+1].first == :code [:static, e.last.rstrip] else e end end if [:trim] [:multi, *exps] end |