diff options
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/encoders/html.rb | 1 | ||||
-rw-r--r-- | lib/coderay/encoders/html/numbering.rb | 2 | ||||
-rw-r--r-- | lib/coderay/encoders/html/output.rb | 4 | ||||
-rw-r--r-- | lib/coderay/encoders/terminal.rb | 6 | ||||
-rw-r--r-- | lib/coderay/scanners/c.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/cpp.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/groovy.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/java.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/java_script.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/python.rb | 4 | ||||
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/sql.rb | 2 | ||||
-rw-r--r-- | lib/coderay/scanners/yaml.rb | 4 | ||||
-rw-r--r-- | lib/coderay/styles/alpha.rb | 183 | ||||
-rw-r--r-- | lib/coderay/styles/cycnus.rb | 144 | ||||
-rw-r--r-- | lib/coderay/styles/murphy.rb | 123 | ||||
-rwxr-xr-x | lib/coderay/token_kinds.rb | 132 |
17 files changed, 166 insertions, 451 deletions
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 # ) - # #-> <span class="no">1</span> <span style="color:#036; font-weight:bold;">Some</span> 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 - "<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 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 <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 @@ module Encoders <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; } diff --git a/lib/coderay/encoders/terminal.rb b/lib/coderay/encoders/terminal.rb index 860ea9c..15c8a52 100644 --- a/lib/coderay/encoders/terminal.rb +++ b/lib/coderay/encoders/terminal.rb @@ -22,7 +22,7 @@ module CodeRay :annotation => '35', :attribute_name => '33', :attribute_value => '31', - :bin => '1;35', + :binary => '1;35', :char => { :self => '36', :delimiter => '34' }, @@ -47,11 +47,10 @@ module CodeRay :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 @@ module CodeRay }, :symbol => '1;32', :tag => '34', - :tag_special => ['34', '4'], :type => '1;34', :value => '36', :variable => '34', diff --git a/lib/coderay/scanners/c.rb b/lib/coderay/scanners/c.rb index 3be7fc2..8d24b99 100644 --- a/lib/coderay/scanners/c.rb +++ b/lib/coderay/scanners/c.rb @@ -121,7 +121,7 @@ module Scanners 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 diff --git a/lib/coderay/scanners/cpp.rb b/lib/coderay/scanners/cpp.rb index 57eadd4..9da62f4 100644 --- a/lib/coderay/scanners/cpp.rb +++ b/lib/coderay/scanners/cpp.rb @@ -133,7 +133,7 @@ module Scanners 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 diff --git a/lib/coderay/scanners/groovy.rb b/lib/coderay/scanners/groovy.rb index 3501aaf..cf55daf 100644 --- a/lib/coderay/scanners/groovy.rb +++ b/lib/coderay/scanners/groovy.rb @@ -130,7 +130,7 @@ module Scanners 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]?/) diff --git a/lib/coderay/scanners/java.rb b/lib/coderay/scanners/java.rb index 0ad8a41..d3502e3 100644 --- a/lib/coderay/scanners/java.rb +++ b/lib/coderay/scanners/java.rb @@ -107,7 +107,7 @@ module Scanners 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]?/) diff --git a/lib/coderay/scanners/java_script.rb b/lib/coderay/scanners/java_script.rb index 9063c5e..43ecb18 100644 --- a/lib/coderay/scanners/java_script.rb +++ b/lib/coderay/scanners/java_script.rb @@ -81,7 +81,7 @@ module Scanners 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+/) diff --git a/lib/coderay/scanners/python.rb b/lib/coderay/scanners/python.rb index 8556ba9..5e38a2c 100644 --- a/lib/coderay/scanners/python.rb +++ b/lib/coderay/scanners/python.rb @@ -194,7 +194,7 @@ module Scanners 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 @@ module Scanners 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]/) diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 25da208..9515bdc 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -178,7 +178,7 @@ module Scanners 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 diff --git a/lib/coderay/scanners/sql.rb b/lib/coderay/scanners/sql.rb index bb460cc..bcbffd5 100644 --- a/lib/coderay/scanners/sql.rb +++ b/lib/coderay/scanners/sql.rb @@ -97,7 +97,7 @@ module CodeRay module Scanners 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 diff --git a/lib/coderay/scanners/yaml.rb b/lib/coderay/scanners/yaml.rb index a0b1ae2..386265d 100644 --- a/lib/coderay/scanners/yaml.rb +++ b/lib/coderay/scanners/yaml.rb @@ -108,10 +108,10 @@ module Scanners 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 diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb index f072085..5309f66 100644 --- a/lib/coderay/styles/alpha.rb +++ b/lib/coderay/styles/alpha.rb @@ -26,7 +26,7 @@ span.CodeRay { white-space: pre; border: 0px; padding: 2px; } table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; } table.CodeRay td { padding: 2px 4px; vertical-align: top; } -.CodeRay .line_numbers, .CodeRay .no { +.CodeRay .line-numbers { background-color: #{numbers_background}; color: gray; text-align: right; @@ -34,15 +34,15 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } -moz-user-select: none; user-select: none; } -.CodeRay .line_numbers a, .CodeRay .no a { +.CodeRay .line-numbers a { background-color: #{numbers_background} !important; color: gray !important; text-decoration: none !important; } -.CodeRay .line_numbers a:target, .CodeRay .no a:target { color: blue !important; } -.CodeRay .line_numbers .highlighted, .CodeRay .no .highlighted { color: red !important; } -.CodeRay .line_numbers .highlighted a, .CodeRay .no .highlighted a { color: red !important; } -.CodeRay .no { padding: 0px 4px; } +.CodeRay .line-numbers a:target { color: blue !important; } +.CodeRay .line-numbers .highlighted { color: red !important; } +.CodeRay .line-numbers .highlighted a { color: red !important; } +.CodeRay span.line-numbers { padding: 0px 4px; } .CodeRay .line { display: block; float: left; width: 100%; } .CodeRay .code { width: 100%; } .CodeRay .code pre { overflow: auto; } @@ -51,102 +51,89 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } TOKEN_COLORS = <<-'TOKENS' .debug { color: white !important; background: blue !important; } -.an { color:#007 } -.at { color:#f08 } -.av { color:#700 } -.bi { color:#509 } -.c { color:#888 } -.c .dl { color:#444 } -.c .ch { color:#444 } - -.ch { color:#D20 } -.ch .k { color:#D20 } -.ch .dl { color:#710 } - -.cl { color:#B06; font-weight:bold } -.cm { color:#A08 } -.co { color:#036; font-weight:bold } -.cr { color:#0A0 } -.cv { color:#369 } -.de { color:#B0B } -.df { color:#099; font-weight:bold } -.di { color:#088; font-weight:bold } -.dl { color:black } -.do { color:#970 } -.dt { color:#34b } -.ds { color:#D42; font-weight:bold } -.e { color:#666 } -.en { color:#800; font-weight:bold } -.er { color:#F00; background-color:#FAA } -.ex { color:#C00; font-weight:bold } -.fl { color:#60E } -.fu { color:#06B; font-weight:bold } -.gv { color:#d70 } -.hx { color:#02b } -.i { color:#00D } -.ic { color:#B44; font-weight:bold } - -.il { background-color: hsla(0,0%,0%,0.1); color: black } -.idl { font-weight: bold; color: #666 } - -.im { color:#f00 } -.in { color:#B2B; font-weight:bold } -.iv { color:#33B } -.la { color:#970; font-weight:bold } -.lv { color:#963 } -.ns { color:#707; font-weight:bold } -.oc { color:#40E } -.op { } -.pc { color:#069 } -.pd { color:#369; font-weight:bold } -.pp { color:#579 } -.ps { color:#00C; font-weight:bold } -.pt { color:#0a5; font-weight:bold } -.r { color:#080; font-weight:bold } -.kw { color:#080; font-weight:bold } - -.ke { color: #606 } -.ke .dl { color: #404 } -.ke .ch { color: #60f } -.vl { color: #088; } - -.rx { background-color:hsla(300,100%,50%,0.09); } -.rx .k { color:#808 } -.rx .dl { color:#404 } -.rx .mod { color:#C2C } - -.s { background-color:hsla(0,100%,50%,0.08); } -.s .k { color: #D20 } -.s .ch { color: #b0b } -.s .dl { color: #710 } -.s .mod { color: #E40 } - -.sh { background-color:hsla(120,100%,50%,0.09); } -.sh .k { color:#2B2 } -.sh .dl { color:#161 } - -.sy { color:#A60 } -.sy .k { color:#A60 } -.sy .dl { color:#630 } - -.ta { color:#070 } -.ts { color:#D70; font-weight:bold } -.ty { color:#339; font-weight:bold } -.v { color:#037 } -.xt { color:#444 } - -.ins { background: hsla(120,100%,50%,0.1) } -.del { background: hsla(0,100%,50%,0.1) } -.chg { color: #bbf; background: #007; } +.annotation { color:#007 } +.attribute-name { color:#f08 } +.attribute-value { color:#700 } +.binary { color:#509 } +.char .content { color:#D20 } +.char .delimiter { color:#710 } +.char { color:#D20 } +.class { color:#B06; font-weight:bold } +.class-variable { color:#369 } +.color { color:#0A0 } +.comment { color:#888 } +.comment .char { color:#444 } +.comment .delimiter { color:#444 } +.complex { color:#A08 } +.constant { color:#036; font-weight:bold } +.decorator { color:#B0B } +.definition { color:#099; font-weight:bold } +.delimiter { color:black } +.directive { color:#088; font-weight:bold } +.doc { color:#970 } +.doc-string { color:#D42; font-weight:bold } +.doctype { color:#34b } +.entity { color:#800; font-weight:bold } +.error { color:#F00; background-color:#FAA } +.escape { color:#666 } +.exception { color:#C00; font-weight:bold } +.float { color:#60E } +.function { color:#06B; font-weight:bold } +.global-variable { color:#d70 } +.hex { color:#02b } +.imaginary { color:#f00 } +.include { color:#B44; font-weight:bold } +.inline { background-color: hsla(0,0%,0%,0.1); color: black } +.inline-delimiter { font-weight: bold; color: #666 } +.instance-variable { color:#33B } +.integer { color:#00D } +.key .char { color: #60f } +.key .delimiter { color: #404 } +.key { color: #606 } +.keyword { color:#080; font-weight:bold } +.label { color:#970; font-weight:bold } +.local-variable { color:#963 } +.namespace { color:#707; font-weight:bold } +.octal { color:#40E } +.operator { } +.predefined { color:#369; font-weight:bold } +.predefined-class { color:#069 } +.predefined-type { color:#0a5; font-weight:bold } +.preprocessor { color:#579 } +.pseudo-class { color:#00C; font-weight:bold } +.regexp .content { color:#808 } +.regexp .delimiter { color:#404 } +.regexp .modifier { color:#C2C } +.regexp { background-color:hsla(300,100%,50%,0.09); } +.reserved { color:#080; font-weight:bold } +.shell .content { color:#2B2 } +.shell .delimiter { color:#161 } +.shell { background-color:hsla(120,100%,50%,0.09); } +.string .char { color: #b0b } +.string .content { color: #D20 } +.string .delimiter { color: #710 } +.string .modifier { color: #E40 } +.string { background-color:hsla(0,100%,50%,0.08); } +.symbol .content { color:#A60 } +.symbol .delimiter { color:#630 } +.symbol { color:#A60 } +.tag { color:#070 } +.type { color:#339; font-weight:bold } +.value { color: #088; } +.variable { color:#037 } + +.insert { background: hsla(120,100%,50%,0.1) } +.delete { background: hsla(0,100%,50%,0.1) } +.change { color: #bbf; background: #007; } .head { color: #f8f; background: #505 } .head .filename { color: white; } -.del .eye { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; } -.ins .eye { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } +.delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; } +.insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } -.ins .ins { color: #0c0; background:transparent; font-weight:bold } -.del .del { color: #c00; background:transparent; font-weight:bold } -.chg .chg { color: #88f } +.insert .insert { color: #0c0; background:transparent; font-weight:bold } +.delete .delete { color: #c00; background:transparent; font-weight:bold } +.change .change { color: #88f } .head .head { color: #f4f } TOKENS diff --git a/lib/coderay/styles/cycnus.rb b/lib/coderay/styles/cycnus.rb deleted file mode 100644 index 1c5b604..0000000 --- a/lib/coderay/styles/cycnus.rb +++ /dev/null @@ -1,144 +0,0 @@ -module CodeRay -module Styles - - # A colorful theme that is also the default for CodeRay output. - class Cycnus < Style - - register_for :cycnus - - code_background = '#f8f8f8' - numbers_background = '#def' - border_color = 'silver' - normal_color = '#000' - - CSS_MAIN_STYLES = <<-MAIN # :nodoc: -.CodeRay { - background-color: #{code_background}; - border: 1px solid #{border_color}; - font-family: 'Courier New', 'Terminal', monospace; - color: #{normal_color}; -} -.CodeRay pre { margin: 0px; } - -span.CodeRay { white-space: pre; border: 0px; padding: 2px; } - -table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; } -table.CodeRay td { padding: 2px 4px; vertical-align: top; } - -.CodeRay .line_numbers, .CodeRay .no { - background-color: #{numbers_background}; - color: gray; - text-align: right; -} -.CodeRay .line_numbers .highlighted, .CodeRay .no .highlighted { color: red; } -.CodeRay .no { padding: 0px 4px; } -.CodeRay .line { display: block; float: left; width: 100%; } -.CodeRay .code { width: 100%; } -.CodeRay .code pre { overflow: auto; } - MAIN - - TOKEN_COLORS = <<-'TOKENS' -.debug { color: white !important; background: blue !important; } - -.an { color:#007 } -.at { color:#f08 } -.av { color:#700 } -.bi { color:#509; font-weight:bold } -.c { color:#888; } - -.ch { color:#04D } -.ch .k { color:#04D } -.ch .dl { color:#039 } - -.cl { color:#B06; font-weight:bold } -.cm { color:#A08; font-weight:bold } -.co { color:#036; font-weight:bold } -.cr { color:#0A0 } -.cv { color:#369 } -.de { color:#B0B; } -.df { color:#099; font-weight:bold } -.di { color:#088; font-weight:bold } -.dl { color:black } -.do { color:#970 } -.dt { color:#34b } -.ds { color:#D42; font-weight:bold } -.e { color:#666; font-weight:bold } -.en { color:#800; font-weight:bold } -.er { color:#F00; background-color:#FAA } -.ex { color:#C00; font-weight:bold } -.fl { color:#60E; font-weight:bold } -.fu { color:#06B; font-weight:bold } -.gv { color:#d70; font-weight:bold } -.hx { color:#058; font-weight:bold } -.i { color:#00D; font-weight:bold } -.ic { color:#B44; font-weight:bold } - -.il { background: #ddd; color: black } -.il .il { background: #ccc } -.il .il .il { background: #bbb } -.il .idl { background: #ddd; font-weight: bold; color: #666 } -.idl { background-color: #bbb; font-weight: bold; color: #666; } - -.im { color:#f00; } -.in { color:#B2B; font-weight:bold } -.iv { color:#33B } -.la { color:#970; font-weight:bold } -.lv { color:#963 } -.ns { color:#707; font-weight:bold } -.oc { color:#40E; font-weight:bold } -.op { } -.pc { color:#058; font-weight:bold } -.pd { color:#369; font-weight:bold } -.pp { color:#579; } -.ps { color:#00C; font-weight:bold } -.pt { color:#074; font-weight:bold } -.r, .kw { color:#080; font-weight:bold } - -.ke { color: #808; } -.ke .dl { color: #606; } -.ke .ch { color: #80f; } -.vl { color: #088; } - -.rx { background-color:#fff0ff; color:#808 } -.rx .k { } -.rx .dl { color:#404 } -.rx .mod { color:#C2C } -.rx .fu { color:#404; font-weight: bold } - -.s { background-color:#fff0f0; color: #D20; } -.s .s { background-color:#ffe0e0 } -.s .s .s { background-color:#ffd0d0 } -.s .k { } -.s .ch { color: #b0b; } -.s .dl { color: #710; } - -.sh { background-color:#f0fff0; color:#2B2 } -.sh .k { } -.sh .dl { color:#161 } - -.sy { color:#A60 } -.sy .k { color:#A60 } -.sy .dl { color:#630 } - -.ta { color:#070 } -.ts { color:#D70; font-weight:bold } -.ty { color:#339; font-weight:bold } -.v { color:#036 } -.xt { color:#444 } - -.ins { background: #afa; } -.del { background: #faa; } -.chg { color: #aaf; background: #007; } -.head { color: #f8f; background: #505 } -.head .filename { color: white; } - -.ins .ins { color: #080; font-weight:bold } -.del .del { color: #800; font-weight:bold } -.chg .chg { color: #66f; } -.head .head { color: #f4f; } - TOKENS - - end - -end -end diff --git a/lib/coderay/styles/murphy.rb b/lib/coderay/styles/murphy.rb deleted file mode 100644 index 0610dd9..0000000 --- a/lib/coderay/styles/murphy.rb +++ /dev/null @@ -1,123 +0,0 @@ -module CodeRay -module Styles - - # A alternative color theme. - class Murphy < Style - - register_for :murphy - - code_background = '#001129' - numbers_background = code_background - border_color = 'silver' - normal_color = '#C0C0C0' - - CSS_MAIN_STYLES = <<-MAIN # :nodoc: -.CodeRay { - background-color: #{code_background}; - border: 1px solid #{border_color}; - font-family: 'Courier New', 'Terminal', monospace; - color: #{normal_color}; -} -.CodeRay pre { margin: 0px; } - -span.CodeRay { white-space: pre; border: 0px; padding: 2px; } - -table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; } -table.CodeRay td { padding: 2px 4px; vertical-align: top; } - -.CodeRay .line_numbers, .CodeRay .no { - background-color: #{numbers_background}; - color: gray; - text-align: right; -} -.CodeRay .line_numbers .highlighted, .CodeRay .no .highlighted { color: red; } -.CodeRay .no { padding: 0px 4px; } -.CodeRay .code { width: 100%; } -.CodeRay .code pre { overflow: auto; } - MAIN - - TOKEN_COLORS = <<-'TOKENS' -.an { color:#007; } -.av { color:#700; } -.bi { color:#509; font-weight:bold; } -.c { color:#555; background-color: black; } - -.ch { color:#88F; } -.ch .k { color:#04D; } -.ch .dl { color:#039; } - -.cl { color:#e9e; font-weight:bold; } -.co { color:#5ED; font-weight:bold; } -.cr { color:#0A0; } -.cv { color:#ccf; } -.df { color:#099; font-weight:bold; } -.di { color:#088; font-weight:bold; } -.dl { color:black; } -.do { color:#970; } -.ds { color:#D42; font-weight:bold; } -.e { color:#666; font-weight:bold; } -.er { color:#F00; background-color:#FAA; } -.ex { color:#F00; font-weight:bold; } -.fl { color:#60E; font-weight:bold; } -.fu { color:#5ed; font-weight:bold; } -.gv { color:#f84; } -.hx { color:#058; font-weight:bold; } -.i { color:#66f; font-weight:bold; } -.ic { color:#B44; font-weight:bold; } -.il { } -.in { color:#B2B; font-weight:bold; } -.iv { color:#aaf; } -.la { color:#970; font-weight:bold; } -.lv { color:#963; } -.oc { color:#40E; font-weight:bold; } -.op { } -.pc { color:#08f; font-weight:bold; } -.pd { color:#369; font-weight:bold; } -.pp { color:#579; } -.pt { color:#66f; font-weight:bold; } -.r { color:#5de; font-weight:bold; } -.r, .kw { color:#5de; font-weight:bold } - -.ke { color: #808; } - -.rx { background-color:#221133; } -.rx .k { color:#f8f; } -.rx .dl { color:#f0f; } -.rx .mod { color:#f0b; } -.rx .fu { color:#404; font-weight: bold; } - -.s { background-color:#331122; } -.s .s { background-color:#ffe0e0; } -.s .s .s { background-color:#ffd0d0; } -.s .k { color:#F88; } -.s .dl { color:#f55; } - -.sh { background-color:#f0fff0; } -.sh .k { color:#2B2; } -.sh .dl { color:#161; } - -.sy { color:#Fc8; } -.sy .k { color:#Fc8; } -.sy .dl { color:#F84; } - -.ta { color:#070; } -.ts { color:#D70; font-weight:bold; } -.ty { color:#339; font-weight:bold; } -.v { color:#036; } -.xt { color:#444; } - -.ins { background: #afa; } -.del { background: #faa; } -.chg { color: #aaf; background: #007; } -.head { color: #f8f; background: #505 } - -.ins .ins { color: #080; font-weight:bold } -.del .del { color: #800; font-weight:bold } -.chg .chg { color: #66f; } -.head .head { color: #f4f; } - TOKENS - - end - -end -end diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb index d23262b..69a96e5 100755 --- a/lib/coderay/token_kinds.rb +++ b/lib/coderay/token_kinds.rb @@ -10,77 +10,75 @@ module CodeRay TokenKinds.compare_by_identity if TokenKinds.respond_to? :compare_by_identity TokenKinds.update( # :nodoc: - :annotation => 'at', - :attribute_name => 'an', - :attribute_value => 'av', - :bin => 'bi', - :char => 'ch', - :class => 'cl', - :class_variable => 'cv', - :color => 'cr', - :comment => 'c', - :complex => 'cm', - :constant => 'co', - :content => 'k', - :decorator => 'de', - :definition => 'df', - :delimiter => 'dl', - :directive => 'di', - :doc => 'do', - :doctype => 'dt', - :doc_string => 'ds', - :entity => 'en', - :error => 'er', - :escape => 'e', - :exception => 'ex', - :filename => 'filename', - :float => 'fl', - :function => 'fu', - :global_variable => 'gv', - :hex => 'hx', - :imaginary => 'cm', - :important => 'im', - :include => 'ic', - :inline => 'il', - :inline_delimiter => 'idl', - :instance_variable => 'iv', - :integer => 'i', - :interpreted => 'in', - :key => 'ke', - :keyword => 'kw', - :label => 'la', - :local_variable => 'lv', - :modifier => 'mod', - :namespace => 'ns', - :oct => 'oc', - :predefined => 'pd', - :preprocessor => 'pp', - :predefined_constant => 'pc', - :predefined_type => 'pt', - :pseudo_class => 'ps', - :regexp => 'rx', - :reserved => 'r', - :shell => 'sh', - :string => 's', - :symbol => 'sy', - :tag => 'ta', - :tag_special => 'ts', - :type => 'ty', - :value => 'vl', - :variable => 'v', + :annotation => 'annotation', + :attribute_name => 'attribute-name', + :attribute_value => 'attribute-value', + :binary => 'bin', + :char => 'char', + :class => 'class', + :class_variable => 'class-variable', + :color => 'color', + :comment => 'comment', + :complex => 'complex', + :constant => 'constant', + :content => 'content', + :decorator => 'decorator', + :definition => 'definition', + :delimiter => 'delimiter', + :directive => 'directive', + :doc => 'doc', + :doctype => 'doctype', + :doc_string => 'doc-string', + :entity => 'entity', + :error => 'error', + :escape => 'escape', + :exception => 'exception', + :filename => 'filename', + :float => 'float', + :function => 'function', + :global_variable => 'global-variable', + :hex => 'hex', + :imaginary => 'imaginary', + :important => 'important', + :include => 'include', + :inline => 'inline', + :inline_delimiter => 'inline-delimiter', + :instance_variable => 'instance-variable', + :integer => 'integer', + :key => 'key', + :keyword => 'keyword', + :label => 'label', + :local_variable => 'local-variable', + :modifier => 'modifier', + :namespace => 'namespace', + :octal => 'octal', + :predefined => 'predefined', + :predefined_constant => 'predefined-constant', + :predefined_type => 'predefined-type', + :preprocessor => 'preprocessor', + :pseudo_class => 'pseudo-class', + :regexp => 'regexp', + :reserved => 'reserved', + :shell => 'shell', + :string => 'string', + :symbol => 'symbol', + :tag => 'tag', + :type => 'type', + :value => 'value', + :variable => 'variable', - :insert => 'ins', - :delete => 'del', - :change => 'chg', - :head => 'head', + :change => 'change', + :delete => 'delete', + :head => 'head', + :insert => 'insert', - :eyecatcher => 'eye', + :eyecatcher => 'eyecatcher', - :ident => false, # 'id' - :operator => false, # 'op' + :ident => false, + :operator => false, - :space => false, # 'sp' - :plain => false + :space => false, + :plain => false ) TokenKinds[:method] = TokenKinds[:function] |