Permalink
Browse files

pretty (longer) token class names; closes #347

  • Loading branch information...
1 parent 5dd7ca6 commit 36531238fa4ef33f1792c6ea6de5e00dcadf018a @korny korny committed Aug 19, 2011
View
@@ -70,10 +70,12 @@ Renamed from @Tokens::ClassOfKind@ (was also @Tokens::AbbreviationForKind@ for a
The term "token class" is no longer used in CodeRay. Instead, tokens have _kinds_.
See "#122":http://redmine.rubychan.de/issues/122.
+* *CHANGED* all token CSS classes to readable names.
* *ADDED* token kinds @:filename@, @:namespace@, and @:eyecatcher@.
* *RENAMED* @:pre_constant@ and @:pre_type@ to @:predefined_constant@ and @predefined_type@.
-* *REMOVED* token kinds @:attribute_name_fat@, @:attribute_value_fat@, @:operator_fat@,
- @:tag_fat@, @:xml_text@, @:nesting_delimiter@, @:open@, and @:close@.
+* *RENAMED* @:oct@ and @:bin@ to @:octal@ and @binary@.
+* *REMOVED* token kinds @:attribute_name_fat@, @:attribute_value_fat@, @:operator_fat@, @interpreted@,
+ @:tag_fat@, @tag_special@, @:xml_text@, @:nesting_delimiter@, @:open@, and @:close@.
* *CHANGED*: Don't raise error for unknown token kinds unless in @$CODERAY_DEBUG@ mode.
* *CHANGED* the value for a token kind that is not highlighted from
@:NO_HIGHLIGHT@ to @false@.
@@ -289,7 +291,7 @@ h3. @WordList@
Stripped down to 19 LOC.
-* *RENAMED* @CaseIgnoringWordList@ to @WordList::CaseIgnoring@
+* *RENAMED* @CaseIgnoringWordList@ to @WordList::CaseIgnoring@.
* *REMOVED* caching option because it creates memory leaks.
* *REMOVED* block option.
@@ -117,7 +117,7 @@ Index: vendor/plugins/coderay-0.7.6.227/lib/coderay/scanners/lua.rb
+ kind = :hex
+
+ elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
-+ kind = :oct
++ kind = :octal
+
+ elsif scan(/(?:\d+)(?![.eEfF])/)
+ kind = :integer
@@ -77,7 +77,7 @@ def scan_tokens tokens, options
kind = :hex
elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :oct
+ kind = :octal
elsif scan(/(?:\d+)(?![.eEfFdDmML])/)
kind = :integer
@@ -71,7 +71,7 @@ def scan_tokens tokens, options
kind = :hex
elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :oct
+ kind = :octal
elsif scan(/(?:\d+)(?![.eEfF])/)
kind = :integer
@@ -83,7 +83,7 @@ def scan_tokens tokens, options
kind = :hex
elsif scan(/(?:0[0-7]+)(?![89.eEfF])/)
- kind = :oct
+ kind = :octal
elsif scan(/(?:\d+)(?![.eEfF])/)
kind = :integer
@@ -21,7 +21,6 @@ module Encoders
# :line_numbers => :inline,
# :css => :style
# )
- # #-> <span class="no">1</span> <span style="color:#036; font-weight:bold;">Some</span> code
#
# == Options
#
@@ -84,7 +84,7 @@ def self.number! output, mode = :table, options = {}
line_number_text = bolding.call line_number
indent = ' ' * (max_width - line_number.to_s.size) # TODO: Optimize (10^x)
line_number += 1
- "<span class=\"no\">#{indent}#{line_number_text}</span>#{open}#{line}#{close}\n"
+ "<span class=\"line-numbers\">#{indent}#{line_number_text}</span>#{open}#{line}#{close}\n"
end
when :table
@@ -124,7 +124,7 @@ def apply target, replacement
TABLE = Template.new <<-TABLE
<table class="CodeRay"><tr>
- <td class="line_numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><%LINE_NUMBERS%></pre></td>
+ <td class="line-numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><%LINE_NUMBERS%></pre></td>
<td class="code"><pre><%CONTENT%></pre></td>
</tr></table>
TABLE
@@ -136,7 +136,7 @@ def apply target, replacement
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
-.CodeRay .line_numbers a, .CodeRay .no a {
+.CodeRay .line-numbers a {
text-decoration: inherit;
color: inherit;
}
@@ -22,7 +22,7 @@ class Terminal < Encoder
:annotation => '35',
:attribute_name => '33',
:attribute_value => '31',
- :bin => '1;35',
+ :binary => '1;35',
:char => {
:self => '36', :delimiter => '34'
},
@@ -47,11 +47,10 @@ class Terminal < Encoder
:hex => '1;36',
:include => '33',
:integer => '1;34',
- :interpreted => '1;35',
:key => '35',
:label => '1;15',
:local_variable => '33',
- :oct => '1;35',
+ :octal => '1;35',
:operator_name => '1;29',
:predefined_constant => '1;36',
:predefined_type => '1;30',
@@ -79,7 +78,6 @@ class Terminal < Encoder
},
:symbol => '1;32',
:tag => '34',
- :tag_special => ['34', '4'],
:type => '1;34',
:value => '36',
:variable => '34',
@@ -121,7 +121,7 @@ def scan_tokens encoder, options
elsif match = scan(/(?:0[0-7]+)(?![89.eEfF])/)
label_expected = false
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/)
label_expected = false
@@ -133,7 +133,7 @@ def scan_tokens encoder, options
elsif match = scan(/(?:0[0-7]+)(?![89.eEfF])/)
label_expected = false
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/)
label_expected = false
@@ -130,7 +130,7 @@ def scan_tokens encoder, options
if match = scan(/0[xX][0-9A-Fa-f]+/)
encoder.text_token match, :hex
elsif match = scan(/(?>0[0-7]+)(?![89.eEfF])/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/\d+[fFdD]|\d*\.\d+(?:[eE][+-]?\d+)?[fFdD]?|\d+[eE][+-]?\d+[fFdD]?/)
encoder.text_token match, :float
elsif match = scan(/\d+[lLgG]?/)
@@ -107,7 +107,7 @@ def scan_tokens encoder, options
if match = scan(/0[xX][0-9A-Fa-f]+/)
encoder.text_token match, :hex
elsif match = scan(/(?>0[0-7]+)(?![89.eEfF])/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/\d+[fFdD]|\d*\.\d+(?:[eE][+-]?\d+)?[fFdD]?|\d+[eE][+-]?\d+[fFdD]?/)
encoder.text_token match, :float
elsif match = scan(/\d+[lL]?/)
@@ -81,7 +81,7 @@ def scan_tokens encoder, options
if match = scan(/0[xX][0-9A-Fa-f]+/)
encoder.text_token match, :hex
elsif match = scan(/(?>0[0-7]+)(?![89.eEfF])/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/\d+[fF]|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
encoder.text_token match, :float
elsif match = scan(/\d+/)
@@ -194,7 +194,7 @@ def scan_tokens encoder, options
encoder.text_token match, :hex
elsif match = scan(/0[bB][01]+[lL]?/)
- encoder.text_token match, :bin
+ encoder.text_token match, :binary
elsif match = scan(/(?:\d*\.\d+|\d+\.\d*)(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+/)
if scan(/[jJ]/)
@@ -205,7 +205,7 @@ def scan_tokens encoder, options
end
elsif match = scan(/0[oO][0-7]+|0[0-7]+(?![89.eE])[lL]?/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/\d+([lL])?/)
if self[1] == nil && scan(/[jJ]/)
@@ -178,7 +178,7 @@ def scan_tokens encoder, options
encoder.text_token match, :error
method_call_expected = false
else
- encoder.text_token match, self[1] ? :float : :integer
+ encoder.text_token match, self[1] ? :float : :integer # TODO: send :hex/:octal/:binary
end
value_expected = false
@@ -97,7 +97,7 @@ def scan_tokens encoder, options
encoder.text_token match, :hex
elsif match = scan(/0[0-7]+(?![89.eEfF])/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
elsif match = scan(/[-+]?(?>\d+)(?![.eEfF])/)
encoder.text_token match, :integer
@@ -108,10 +108,10 @@ def scan_tokens encoder, options
encoder.text_token match, :class_variable
next
when match = scan(/\d\d:\d\d:\d\d/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
next
when match = scan(/\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d+)? [-+]\d\d:\d\d/)
- encoder.text_token match, :oct
+ encoder.text_token match, :octal
next
when match = scan(/:\w+/)
encoder.text_token match, :symbol
Oops, something went wrong.

0 comments on commit 3653123

Please sign in to comment.