class Rouge::Formatters::Terminal256::Unescape

Public Class Methods

new(*) click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 165
def initialize(*) end

Public Instance Methods

escape_sequence(token) click to toggle source

private

# File lib/rouge/formatters/terminal256.rb, line 172
def escape_sequence(token)
  return Unescape.new if escape?(token)
  @escape_sequences ||= {}
  @escape_sequences[token.qualname] ||=
    make_escape_sequence(get_style(token))
end
get_style(token) click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 183
def get_style(token)
  return text_style if token.ancestors.include? Token::Tokens::Text

  theme.get_own_style(token) || text_style
end
make_escape_sequence(style) click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 179
def make_escape_sequence(style)
  EscapeSequence.new(style)
end
reset_string(*) click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 167
def reset_string(*) '' end
stream_value(val) { |val end| ... } click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 168
  def stream_value(val) yield val end
end
style_string(*) click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 166
def style_string(*) '' end
text_style() click to toggle source
# File lib/rouge/formatters/terminal256.rb, line 189
def text_style
  style = theme.get_style(Token['Text'])
  # don't highlight text backgrounds
  style.delete :bg
  style
end