summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-01-06 22:55:25 +0000
committermurphy <murphy@rubychan.de>2010-01-06 22:55:25 +0000
commit3715e8aeaa4409253f041ba3f491a06cdefb6e9a (patch)
tree397c22ad8d90041cd1a70f4e756d64244bf85bdd
parent8ff7311761d81dbc3925fd33cd5d4f66395a10a6 (diff)
downloadcoderay-3715e8aeaa4409253f041ba3f491a06cdefb6e9a.tar.gz
Renamed Terminal encoder, cleanups.
-rw-r--r--Changes.textile18
-rw-r--r--lib/coderay/encoders/_map.rb1
-rw-r--r--lib/coderay/encoders/terminal.rb (renamed from lib/coderay/encoders/term.rb)14
3 files changed, 26 insertions, 7 deletions
diff --git a/Changes.textile b/Changes.textile
index 69eacdc..e97fb27 100644
--- a/Changes.textile
+++ b/Changes.textile
@@ -2,6 +2,24 @@ h1=. CodeRay Version Changes
p=. _This files lists all changes in the CodeRay library since the 0.8.4 release._
+h2. Changes in 1.0
+
+h3. @Encoders::HTML@
+
+* @#token@'s second parameter is no longer optional.
+
+h3. @Encoders::Terminal@
+
+* *RENAMED* from @Encoders::Term@, added @:term@ alias
+* Cleanup: Use @#setup@'s @super@, don't use @:procedure@ token class.
+* @#token@'s second parameter is no longer optional.
+
+h3. @Scanners::Plaintext@
+
+* *IMPROVED* Just returns the string without scanning.
+
+ This is much faster than scanning until @/\z/@ in Ruby 1.8.
+
h2. Changes in 0.9.1
h3. Token classes
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