Module Erubis::PerlGenerator
In: erubis/engine/eperl.rb

Methods

Included Modules

Generator

Public Instance methods

[Source]

# File erubis/engine/eperl.rb, line 49
    def add_expr_debug(src, code)
      code.strip!
      s = code.gsub(/\'/, "\\'")
      src << @func << "('*** debug: #{code}=', #{code}, \"\\n\");"
    end

[Source]

# File erubis/engine/eperl.rb, line 45
    def add_expr_escaped(src, code)
      add_expr_literal(src, escaped_expr(code))
    end

[Source]

# File erubis/engine/eperl.rb, line 40
    def add_expr_literal(src, code)
      code.strip!
      src << @func << "(" << code << "); "
    end

[Source]

# File erubis/engine/eperl.rb, line 59
    def add_postamble(src)
      src << "\n" unless src[-1] == ?\n
    end

[Source]

# File erubis/engine/eperl.rb, line 28
    def add_preamble(src)
      src << "use HTML::Entities; ";
    end

[Source]

# File erubis/engine/eperl.rb, line 55
    def add_stmt(src, code)
      src << code
    end

[Source]

# File erubis/engine/eperl.rb, line 36
    def add_text(src, text)
      src << @func << "('" << escape_text(text) << "'); " unless text.empty?
    end

[Source]

# File erubis/engine/eperl.rb, line 32
    def escape_text(text)
      return text.gsub!(/['\\]/, '\\\\\&') || text
    end

[Source]

# File erubis/engine/eperl.rb, line 22
    def init_generator(properties={})
      super
      @escapefunc ||= 'encode_entities'
      @func = properties[:func] || 'print'
    end

[Validate]