Class | Albino::Multi |
In: |
lib/albino/multi.rb
|
Parent: | Object |
Wrapper for a custom multipygmentize script. Passes multiple code fragments in STDIN to Python. This assumes both Python and pygments are installed.
Use like so:
@syntaxer = Albino::Multi.new([ [:ruby, File.open("/some/file.rb")] ]) puts @syntaxer.colorize
It takes an Array of two-element arrays [lexer, code].
You can also use Albino::Multi as a drop-in replacement. It currently has a few limitations however:
The default lexer is ‘text’. You need to specify a lexer yourself; because we are using STDIN there is no auto-detect.
To see all lexers and formatters available, run `pygmentize -L`.
SEPARATOR | = | "\000".freeze |
bin | [RW] | |
timeout_threshold | [RW] |
This method accepts two forms of input:
DEFAULT
target - The Array of two-element [lexer, code] Arrays:
lexer - The String lexer for the upcoming block of code. code - The String block of code to highlight.
LEGACY
target - The String block of code to highlight. lexer - The String lexer for the block of code.
Albino#initialize also takes format and encoding which are ignored.