Class: Rabbit::Parser::Ext::Rouge::RabbitFormatter

Inherits:
Rouge::Formatter
  • Object
show all
Includes:
Element
Defined in:
lib/rabbit/parser/ext/rouge.rb

Instance Method Summary collapse

Instance Method Details

#stream(tokens) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/rabbit/parser/ext/rouge.rb', line 46

def stream(tokens)
  tokens.each do |token, value|
    escaped_text = Escape.escape_meta_character(value)
    text_element = SyntaxHighlightingText.new(Text.new(escaped_text))
    tag_name = compute_tag_name(token)
    if Utils.syntax_highlighting_debug?
      p [tag_name, token.qualname, value]
    end
    yield(CustomTag.new("syntax-#{tag_name}", text_element))
  end
end