module Erubis::SimplifyEnhancer
def self.desc # :nodoc:
def self.desc # :nodoc: "get convert faster but leave spaces around '<% %>'" end
def convert(input)
def convert(input) src = "" add_preamble(src) #regexp = pattern_regexp(@pattern) pos = 0 input.scan(SIMPLE_REGEXP) do |indicator, code| match = Regexp.last_match index = match.begin(0) text = input[pos, index - pos] pos = match.end(0) add_text(src, text) if !indicator # <% %> add_stmt(src, code) elsif indicator[0] == ?\# # <%# %> n = code.count("\n") add_stmt(src, "\n" * n) else # <%= %> add_expr(src, code, indicator) end end #rest = $' || input # ruby1.8 rest = pos == 0 ? input : input[pos..-1] # ruby1.9 add_text(src, rest) add_postamble(src) return src end