Class: Hylite::Rouge

Inherits:
Hyliter show all
Defined in:
lib/hylite/hyliters.rb

Instance Attribute Summary

Attributes inherited from Hyliter

#code, #lang

Instance Method Summary collapse

Methods inherited from Hyliter

#initialize

Constructor Details

This class inherits a constructor from Hylite::Hyliter

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
# File 'lib/hylite/hyliters.rb', line 18

def call
  # From Fish, you can see all styles with:
  # for style in (rougify help style | tail -1 | tr -d ' ' | tr , \n); echo \n===== $style =====; rougify highlight -t $style -l ruby bin/hylite   ; end
  theme     = ::Rouge::Theme.find 'monokai'
  formatter = ::Rouge::Formatters::Terminal256.new theme
  lexer     = ::Rouge::Lexer.find @lang
  tokens    = lexer.lex @code
  formatter.format(tokens)
end

#typeObject



15
16
17
# File 'lib/hylite/hyliters.rb', line 15

def type
  :rouge
end