class Rabbit::Parser::Ext::CodeRay::RabbitEncoder

Public Instance Methods

begin_group(kind) click to toggle source
# File lib/rabbit/parser/ext/coderay.rb, line 36
def begin_group(kind)
  p [:begin_group, kind] if Utils.syntax_highlighting_debug?
  @containers << TextContainer.new
  tag = CustomTag.new("syntax-#{kind}")
  current_container << tag
end
begin_line(kind) click to toggle source
# File lib/rabbit/parser/ext/coderay.rb, line 43
def begin_line(kind)
  p [:begin_line, kind] if Utils.syntax_highlighting_debug?
end
end_group(kind) click to toggle source
# File lib/rabbit/parser/ext/coderay.rb, line 51
def end_group(kind)
  p [:end_group, kind] if Utils.syntax_highlighting_debug?
  block = @containers.pop
  current_container << block
end
end_line(kind) click to toggle source
# File lib/rabbit/parser/ext/coderay.rb, line 47
def end_line(kind)
  p [:end_line, kind] if Utils.syntax_highlighting_debug?
end
finish(options) click to toggle source
Calls superclass method
# File lib/rabbit/parser/ext/coderay.rb, line 57
def finish(options)
  super
end
setup(options) click to toggle source
Calls superclass method
# File lib/rabbit/parser/ext/coderay.rb, line 21
def setup(options)
  super
  @out = SyntaxHighlightingBlock.new
  @containers = [@out]
end
text_token(text, type=:plain) click to toggle source
# File lib/rabbit/parser/ext/coderay.rb, line 27
def text_token(text, type=:plain)
  p [:text, type, text] if Utils.syntax_highlighting_debug?
  escaped_text = Escape.escape_meta_character(text)
  text_element = SyntaxHighlightingText.new(Text.new(escaped_text))
  tag_name = type.to_s.gsub(/_/, '-')
  tag = CustomTag.new("syntax-#{tag_name}", text_element)
  current_container << tag
end

Private Instance Methods

current_container() click to toggle source
# File lib/rabbit/parser/ext/coderay.rb, line 62
def current_container
  @containers.last
end