class Rouge::Lexers::Haml

A lexer for the Haml templating system for Ruby. @see haml.info

Attributes

filters[R]

Public Class Methods

new(opts={}) click to toggle source

@option opts :filters

A hash of filter name to lexer of how various filters should be
highlighted.  By default, :javascript, :css, :ruby, and :erb
are supported.
Calls superclass method
# File lib/rouge/lexers/haml.rb, line 25
def initialize(opts={})
  super

  default_filters = {
    'javascript' => Javascript.new(options),
    'css' => CSS.new(options),
    'ruby' => ruby,
    'erb' => ERB.new(options),
    'markdown' => Markdown.new(options),
    'sass' => Sass.new(options),
    # TODO
    # 'textile' => Textile.new(options),
    # 'maruku' => Maruku.new(options),
  }

  @filters = hash_option(:filters, default_filters) do |v|
    as_lexer(v) || PlainText.new(@options)
  end
end

Public Instance Methods

html() click to toggle source
# File lib/rouge/lexers/haml.rb, line 49
def html
  @html ||= HTML.new(@options)
end
ruby() click to toggle source
# File lib/rouge/lexers/haml.rb, line 45
def ruby
  @ruby ||= Ruby.new(@options)
end
ruby!(state) click to toggle source
# File lib/rouge/lexers/haml.rb, line 53
def ruby!(state)
  ruby.reset!
  push state
end