From 36531238fa4ef33f1792c6ea6de5e00dcadf018a Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Fri, 19 Aug 2011 05:39:45 +0200 Subject: pretty (longer) token class names; closes #347 --- Changes-1.0.textile | 8 +- etc/todo/scanners/coderay_lua_lexar.patch | 2 +- etc/todo/scanners/csharp.rb | 2 +- etc/todo/scanners/paste-693 (IO).rb | 2 +- etc/todo/scanners/sql.Josh Goebel.rb | 2 +- lib/coderay/encoders/html.rb | 1 - lib/coderay/encoders/html/numbering.rb | 2 +- lib/coderay/encoders/html/output.rb | 4 +- lib/coderay/encoders/terminal.rb | 6 +- lib/coderay/scanners/c.rb | 2 +- lib/coderay/scanners/cpp.rb | 2 +- lib/coderay/scanners/groovy.rb | 2 +- lib/coderay/scanners/java.rb | 2 +- lib/coderay/scanners/java_script.rb | 2 +- lib/coderay/scanners/python.rb | 4 +- lib/coderay/scanners/ruby.rb | 2 +- lib/coderay/scanners/sql.rb | 2 +- lib/coderay/scanners/yaml.rb | 4 +- lib/coderay/styles/alpha.rb | 183 ++++++++++++++---------------- lib/coderay/styles/cycnus.rb | 144 ----------------------- lib/coderay/styles/murphy.rb | 123 -------------------- lib/coderay/token_kinds.rb | 132 +++++++++++---------- test/executable/suite.rb | 4 +- test/functional/basic.rb | 8 +- test/functional/examples.rb | 8 +- 25 files changed, 185 insertions(+), 468 deletions(-) delete mode 100644 lib/coderay/styles/cycnus.rb delete mode 100644 lib/coderay/styles/murphy.rb diff --git a/Changes-1.0.textile b/Changes-1.0.textile index da79215..f2f1bb1 100644 --- a/Changes-1.0.textile +++ b/Changes-1.0.textile @@ -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. diff --git a/etc/todo/scanners/coderay_lua_lexar.patch b/etc/todo/scanners/coderay_lua_lexar.patch index f7e3c8d..0c59559 100644 --- a/etc/todo/scanners/coderay_lua_lexar.patch +++ b/etc/todo/scanners/coderay_lua_lexar.patch @@ -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 diff --git a/etc/todo/scanners/csharp.rb b/etc/todo/scanners/csharp.rb index 7686ce5..ad1806c 100644 --- a/etc/todo/scanners/csharp.rb +++ b/etc/todo/scanners/csharp.rb @@ -77,7 +77,7 @@ module CodeRay kind = :hex elsif scan(/(?:0[0-7]+)(?![89.eEfF])/) - kind = :oct + kind = :octal elsif scan(/(?:\d+)(?![.eEfFdDmML])/) kind = :integer diff --git a/etc/todo/scanners/paste-693 (IO).rb b/etc/todo/scanners/paste-693 (IO).rb index 664d893..ee13933 100644 --- a/etc/todo/scanners/paste-693 (IO).rb +++ b/etc/todo/scanners/paste-693 (IO).rb @@ -71,7 +71,7 @@ module CodeRay module Scanners kind = :hex elsif scan(/(?:0[0-7]+)(?![89.eEfF])/) - kind = :oct + kind = :octal elsif scan(/(?:\d+)(?![.eEfF])/) kind = :integer diff --git a/etc/todo/scanners/sql.Josh Goebel.rb b/etc/todo/scanners/sql.Josh Goebel.rb index 57b5e8c..efa6990 100644 --- a/etc/todo/scanners/sql.Josh Goebel.rb +++ b/etc/todo/scanners/sql.Josh Goebel.rb @@ -83,7 +83,7 @@ module CodeRay module Scanners kind = :hex elsif scan(/(?:0[0-7]+)(?![89.eEfF])/) - kind = :oct + kind = :octal elsif scan(/(?:\d+)(?![.eEfF])/) kind = :integer diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index abbafad..60dfad1 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -21,7 +21,6 @@ module Encoders # :line_numbers => :inline, # :css => :style # ) - # #-> 1 Some code # # == Options # diff --git a/lib/coderay/encoders/html/numbering.rb b/lib/coderay/encoders/html/numbering.rb index 4e030fd..15ce11b 100644 --- a/lib/coderay/encoders/html/numbering.rb +++ b/lib/coderay/encoders/html/numbering.rb @@ -84,7 +84,7 @@ module Encoders line_number_text = bolding.call line_number indent = ' ' * (max_width - line_number.to_s.size) # TODO: Optimize (10^x) line_number += 1 - "#{indent}#{line_number_text}#{open}#{line}#{close}\n" + "#{indent}#{line_number_text}#{open}#{line}#{close}\n" end when :table diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index 4f65878..298921e 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -124,7 +124,7 @@ module Encoders TABLE = Template.new <<-TABLE - +
<%LINE_NUMBERS%>
<%LINE_NUMBERS%>
<%CONTENT%>
TABLE @@ -136,7 +136,7 @@ module Encoders