convert_input (Erubis::InterpolationEnhancer)

    # File lib/erubis/enhancer.rb, line 641
        def convert_input(src, input)
          pat = @pattern
          regexp = pat.nil? || pat == '<% %>' ? Basic::Converter::DEFAULT_REGEXP : pattern_regexp(pat)
          pos = 0
          is_bol = true     # is beginning of line
          str = ''
          input.scan(regexp) do |indicator, code, tailch, rspace|
            match = Regexp.last_match()
            len  = match.begin(0) - pos
            text = input[pos, len]
            pos  = match.end(0)
            ch   = indicator ? indicator[0] : nil
            lspace = ch == ?= ? nil : detect_spaces_at_bol(text, is_bol)
            is_bol = rspace ? true : false
            _add_text_to_str(str, text)
            ## * when '<%= %>', do nothing
            ## * when '<% %>' or '<%# %>', delete spaces iff only spaces are around '<% %>'
            if ch == ?=              # <%= %>
              rspace = nil if tailch && !tailch.empty?
              str << lspace if lspace
              add_expr(str, code, indicator)
              str << rspace if rspace
            elsif ch == ?\#          # <%# %>
              n = code.count("\n") + (rspace ? 1 : 0)
              if @trim && lspace && rspace
                add_text(src, str)
                str = ''
                add_stmt(src, "\n" * n)
              else
                str << lspace if lspace
                add_text(src, str)
                str = ''
                add_stmt(src, "\n" * n)
                str << rspace if rspace
              end
            else                     # <% %>
              if @trim && lspace && rspace
                add_text(src, str)
                str = ''
                add_stmt(src, "#{lspace}#{code}#{rspace}")
              else
                str << lspace if lspace
                add_text(src, str)
                str = ''
                add_stmt(src, code)
                str << rspace if rspace
              end
            end
          end
          #rest = $' || input                       # ruby1.8
          rest = pos == 0 ? input : input[pos..-1]  # ruby1.9
          _add_text_to_str(str, rest)
          add_text(src, str)
        end