mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Upgrade Coderay to 0.9.0.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3014 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
module CodeRay
|
||||
module Encoders
|
||||
|
||||
# The Tokens encoder converts the tokens to a simple
|
||||
# readable format. It doesn't use colors and is mainly
|
||||
# intended for console output.
|
||||
#
|
||||
# The tokens are converted with Tokens.write_token.
|
||||
#
|
||||
# The format is:
|
||||
#
|
||||
# <token-kind> \t <escaped token-text> \n
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# require 'coderay'
|
||||
# puts CodeRay.scan("puts 3 + 4", :ruby).tokens
|
||||
#
|
||||
# prints:
|
||||
#
|
||||
# ident puts
|
||||
# space
|
||||
# integer 3
|
||||
# space
|
||||
# operator +
|
||||
# space
|
||||
# integer 4
|
||||
#
|
||||
class Tokens < Encoder
|
||||
|
||||
include Streamable
|
||||
register_for :tokens
|
||||
|
||||
FILE_EXTENSION = 'tok'
|
||||
|
||||
protected
|
||||
def token text, kind
|
||||
@out << CodeRay::Tokens.write_token(text, kind)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user