public
Fork of github/albino
Description: Ruby wrapper for the Pygments syntax highlighter.
Homepage:
Clone URL: git://github.com/ddollar/albino.git
albino /
name age message
file .gitignore Sun Apr 19 16:58:48 -0700 2009 made gem skeleton more understanding of albino [ddollar]
file README.rdoc Sun Apr 19 17:42:16 -0700 2009 update rdoc [ddollar]
file Rakefile Mon Apr 20 07:52:21 -0700 2009 remove FileUtils [ddollar]
file albino.gemspec Sun Apr 19 19:15:29 -0700 2009 bump gem version [ddollar]
directory config/ Sun Apr 19 19:15:29 -0700 2009 bump gem version [ddollar]
directory lib/ Sun Apr 19 19:15:13 -0700 2009 pedantry [ddollar]
README.rdoc

Albino

Installation

    $ gem sources -a http://gems.github.com
    $ gem install ddollar-albino

Usage

To print out an HTMLized, Ruby-highlighted version of ’/some/file.rb’

    @syntaxer = Albino.new('/some/file.rb', :ruby)
    puts @syntaxer.colorize

To use another formatter, pass it as the third argument:

    @syntaxer = Albino.new('/some/file.rb', :ruby, :bbcode)
    puts @syntaxer.colorize

You can also use the #colorize class method:

    puts Albino.colorize('/some/file.rb', :ruby)

Another also: you get a #to_s, for somewhat nicer use in Rails views.

    ... helper file ...
    def highlight(text)
      Albino.new(text, :ruby)
    end

    ... view file ...
    <%= highlight text %>

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`.

Documentation

RDoc can be found at ddollar.github.com/albino

Credits

This project is an extraction from GitHub.

For this and other extractions, see github.com/github

The Albino code was all written by Chris Wanstrath chris@ozmm.org

Wrapped in a gem by David Dollar daviddollar.org