diff options
author | murphy <murphy@rubychan.de> | 2010-01-06 22:55:25 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2010-01-06 22:55:25 +0000 |
commit | 3715e8aeaa4409253f041ba3f491a06cdefb6e9a (patch) | |
tree | 397c22ad8d90041cd1a70f4e756d64244bf85bdd /lib/coderay | |
parent | 8ff7311761d81dbc3925fd33cd5d4f66395a10a6 (diff) | |
download | coderay-3715e8aeaa4409253f041ba3f491a06cdefb6e9a.tar.gz |
Renamed Terminal encoder, cleanups.
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/encoders/_map.rb | 1 | ||||
-rw-r--r-- | lib/coderay/encoders/terminal.rb (renamed from lib/coderay/encoders/term.rb) | 14 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/coderay/encoders/_map.rb b/lib/coderay/encoders/_map.rb index a66fcb8..bdffd7b 100644 --- a/lib/coderay/encoders/_map.rb +++ b/lib/coderay/encoders/_map.rb @@ -3,6 +3,7 @@ module Encoders map \ :loc => :lines_of_code, + :term => :terminal, :plain => :text, :stats => :statistic, :tex => :latex diff --git a/lib/coderay/encoders/term.rb b/lib/coderay/encoders/terminal.rb index 287529f..09f81f5 100644 --- a/lib/coderay/encoders/term.rb +++ b/lib/coderay/encoders/terminal.rb @@ -1,4 +1,3 @@ -# encoders/term.rb # By Rob Aldred (http://robaldred.co.uk) # Based on idea by Nathan Weizenbaum (http://nex-3.com) # MIT License (http://www.opensource.org/licenses/mit-license.php) @@ -8,8 +7,9 @@ module CodeRay module Encoders - class Term < Encoder - register_for :term + class Terminal < Encoder + + register_for :terminal TOKEN_COLORS = { :attribute_name => '33', @@ -61,13 +61,13 @@ module CodeRay :type => '1;34', :variable => '34' } - TOKEN_COLORS[:procedure] = TOKEN_COLORS[:method] = TOKEN_COLORS[:function] + TOKEN_COLORS[:method] = TOKEN_COLORS[:function] TOKEN_COLORS[:open] = TOKEN_COLORS[:close] = TOKEN_COLORS[:nesting_delimiter] = TOKEN_COLORS[:escape] = TOKEN_COLORS[:delimiter] protected def setup(options) - @out = '' + super @opened = [nil] @subcolors = nil end @@ -76,11 +76,11 @@ module CodeRay super end - def token text, type = :plain + def token text, type case text when nil - # raise 'Token with nil as text was given: %p' % [[text, type]] + # raise 'Token with nil as text was given: %p' % [[text, type]] when String |