class Rouge::Lexers::Haml
A lexer for the Haml templating system for Ruby. @see haml.info
Public Class Methods
analyze_text(text)
click to toggle source
# File lib/rouge/lexers/haml.rb, line 18 def self.analyze_text(text) return 0.1 if text.start_with? '!!!' end
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 26 def initialize(opts={}) (opts.delete(:filters) || {}).each do |name, lexer| unless lexer.respond_to? :lex lexer = Lexer.find(lexer) or raise "unknown lexer: #{lexer}" lexer = lexer.new(options) end self.filters[name.to_s] = lexer end super(opts) end
Public Instance Methods
filters()
click to toggle source
# File lib/rouge/lexers/haml.rb, line 47 def filters @filters ||= { 'javascript' => Javascript.new(options), 'css' => CSS.new(options), 'ruby' => ruby, 'erb' => ERB.new(options), 'markdown' => Markdown.new(options), # TODO # 'sass' => Sass.new(options), # 'textile' => Textile.new(options), # 'maruku' => Maruku.new(options), } end
html()
click to toggle source
# File lib/rouge/lexers/haml.rb, line 43 def html @html ||= HTML.new(options) end
ruby()
click to toggle source
# File lib/rouge/lexers/haml.rb, line 39 def ruby @ruby ||= Ruby.new(options) end