diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/coderay/encoder.rb | 6 | ||||
-rw-r--r-- | lib/coderay/encoders/html.rb | 5 | ||||
-rw-r--r-- | lib/coderay/encoders/html/classes.rb | 1 | ||||
-rw-r--r-- | lib/coderay/encoders/html/output.rb | 2 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 22 | ||||
-rw-r--r-- | lib/coderay/scanner.rb | 59 | ||||
-rw-r--r-- | lib/coderay/scanners/_map.rb | 4 | ||||
-rw-r--r-- | lib/coderay/scanners/html.rb | 57 | ||||
-rw-r--r-- | lib/coderay/scanners/nitro_html.rb | 123 | ||||
-rw-r--r-- | lib/coderay/scanners/rhtml.rb | 63 | ||||
-rw-r--r-- | lib/coderay/scanners/ruby.rb | 35 | ||||
-rw-r--r-- | lib/coderay/scanners/ruby/patterns.rb | 2 | ||||
-rw-r--r-- | lib/coderay/styles/cycnus.rb | 162 |
13 files changed, 400 insertions, 141 deletions
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb index 8b6c22a..8f8375a 100644 --- a/lib/coderay/encoder.rb +++ b/lib/coderay/encoder.rb @@ -130,10 +130,12 @@ module CodeRay # By default, it calls text_token or block_token, depending on
# whether +text+ is a String.
def token text, kind
- if text.is_a? String
+ if text.is_a? ::String
text_token text, kind
- else
+ elsif text.is_a? ::Symbol
block_token text, kind
+ else
+ raise 'Unknown token text type: %p' % text
end
end
diff --git a/lib/coderay/encoders/html.rb b/lib/coderay/encoders/html.rb index 11fa84c..0b43c0c 100644 --- a/lib/coderay/encoders/html.rb +++ b/lib/coderay/encoders/html.rb @@ -205,6 +205,7 @@ module Encoders def finish options
not_needed = @opened.shift
@out << '</span>' * @opened.size
+ warn '%d tokens still open' % @opened.size unless @opened.empty?
@out.extend Output
@out.css = @css
@@ -230,11 +231,11 @@ module Encoders case text
when :open
@opened[0] = type
- @out << @css_style[@opened]
+ @out << (@css_style[@opened] || '<span>')
@opened << type
when :close
unless @opened.empty?
- raise 'Not Token to be closed.' unless @opened.size > 1
+ raise 'Malformed token stream: Trying to close a token that was never opened.' unless @opened.size > 1
@out << '</span>'
@opened.pop
end
diff --git a/lib/coderay/encoders/html/classes.rb b/lib/coderay/encoders/html/classes.rb index 4a01920..3d40a42 100644 --- a/lib/coderay/encoders/html/classes.rb +++ b/lib/coderay/encoders/html/classes.rb @@ -20,6 +20,7 @@ module CodeRay module Encoders :directive => 'di',
:doc => 'do',
:doc_string => 'ds',
+ :entity => 'en',
:error => 'er',
:escape => 'e',
:exception => 'ex',
diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb index 80ab4f1..e9a3a41 100644 --- a/lib/coderay/encoders/html/output.rb +++ b/lib/coderay/encoders/html/output.rb @@ -174,7 +174,7 @@ module CodeRay "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="de">
<head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>CodeRay HTML Encoder Example</title>
<style type="text/css">
<%CSS%>
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 246b9b4..c55e565 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -56,7 +56,6 @@ module PluginHost def require_helper plugin_id, helper_name
path = path_to File.join(plugin_id, helper_name)
- #$stderr.puts 'Loading helper: ' + path
require path
end
@@ -125,6 +124,20 @@ module PluginHost end
end
+ # Define the default plugin to use when no plugin is found
+ # for a given id.
+ #
+ # See also map.
+ #
+ # class MyColorHost < PluginHost
+ # map :navy => :dark_blue
+ # default :gray
+ # end
+ def default id
+ id = validate_id id
+ plugin_hash[nil] = id
+ end
+
# Every plugin must register itself for one or more
# +ids+ by calling register_for, which calls this method.
#
@@ -152,10 +165,13 @@ protected id = validate_id(plugin_id)
path = path_to id
begin
- #$stderr.puts 'Loading plugin: ' + path if $DEBUG
require path
rescue LoadError => boom
- raise PluginNotFound, 'Could not load plugin %p: %s' % [id, boom]
+ if h.has_key? nil # default plugin
+ h[id] = h[nil]
+ else
+ raise PluginNotFound, 'Could not load plugin %p: %s' % [id, boom]
+ end
else
# Plugin should have registered by now
unless h.has_key? id
diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb index 16998f2..eae4c0e 100644 --- a/lib/coderay/scanner.rb +++ b/lib/coderay/scanner.rb @@ -96,21 +96,21 @@ module CodeRay raise "I am only the basic Scanner class. I can't scan "\
"anything. :( Use my subclasses." if self.class == Scanner
- # I love this hack. It seems to silence
- # all dos/unix/mac newline problems.
- code = code.gsub(/\r\n?/, "\n") if code.index ?\r
- super code
+ super code.to_s.to_unix
+ @tokens = options[:tokens]
if @options[:stream]
warn "warning in CodeRay::Scanner.new: :stream is set, "\
"but no block was given" unless block_given?
raise NotStreamableError, self unless kind_of? Streamable
- @tokens = TokenStream.new(&block)
+ @tokens ||= TokenStream.new(&block)
else
warn "warning in CodeRay::Scanner.new: Block given, "\
"but :stream is #{@options[:stream]}" if block_given?
- @tokens = Tokens.new
+ @tokens ||= Tokens.new
end
+
+ setup
end
# More mnemonic accessor name for the input string.
@@ -122,25 +122,28 @@ module CodeRay end
def string= code
- code = code.gsub(/\r\n?/, "\n") if code.index ?\r
+ code = code.to_s.to_unix
super code
reset_instance
end
# Scans the code and returns all tokens in a Tokens object.
- def tokenize options = {}
- options = @options.merge({}) #options
- if @options[:stream] # :stream must have been set already
- reset ## what is this for?
- scan_tokens @tokens, options
- @tokens
- else
- @cached_tokens ||= scan_tokens @tokens, options
- end
+ def tokenize new_string=nil, options = {}
+ options = @options.merge(options)
+ self.string = new_string if new_string
+ @cached_tokens =
+ if @options[:stream] # :stream must have been set already
+ reset unless new_string
+ scan_tokens @tokens, options
+ @tokens
+ else
+ scan_tokens @tokens, options
+ end
end
- # You can also see tokenize as a read-only attribute
- alias tokens tokenize
+ def tokens
+ @cached_tokens ||= tokenize
+ end
# Traverses the tokens.
def each &block
@@ -160,6 +163,14 @@ module CodeRay protected
+ # Can be implemented by subclasses to do some initialization
+ # that has to be done once per instance.
+ #
+ # Use reset for initialization that has to be done once per
+ # scan.
+ def setup
+ end
+
# This is the central method, and commonly the only one a
# subclass implements.
#
@@ -171,7 +182,7 @@ module CodeRay end
def reset_instance
- @tokens.clear
+ @tokens.clear unless @options[:keep_tokens]
@cached_tokens = nil
end
@@ -211,4 +222,14 @@ surrounding code: end
end
+class String
+ # I love this hack. It seems to silence all dos/unix/mac newline problems.
+ def to_unix
+ if index ?\r
+ gsub(/\r\n?/, "\n")
+ else
+ self
+ end
+ end
+end
# vim:sw=2:ts=2:noet:tw=78
diff --git a/lib/coderay/scanners/_map.rb b/lib/coderay/scanners/_map.rb index fc53d91..f6e4452 100644 --- a/lib/coderay/scanners/_map.rb +++ b/lib/coderay/scanners/_map.rb @@ -6,7 +6,9 @@ module CodeRay :pascal => :delphi,
:irb => :ruby,
:xml => :html,
- :xhtml => :html
+ :xhtml => :nitro_html
+
+ default :plain
end
end
diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb index 62da13b..a1efa9e 100644 --- a/lib/coderay/scanners/html.rb +++ b/lib/coderay/scanners/html.rb @@ -1,8 +1,8 @@ -#require 'coderay/common_patterns'
-
module CodeRay module Scanners
# HTML Scanner
+ #
+ # $Id$
class HTML < Scanner
include Streamable
@@ -27,10 +27,21 @@ module CodeRay module Scanners ;
/ox
+ PLAIN_STRING_CONTENT = {
+ "'" => /[^&'>\n]+/,
+ '"' => /[^&">\n]+/,
+ }
+
private
+ def setup
+ @state = :initial
+ @plain_string_content = nil
+ end
+
def scan_tokens tokens, options
-
- state = :initial
+
+ state = @state
+ plain_string_content = @plain_string_content
until eos?
@@ -55,17 +66,13 @@ module CodeRay module Scanners kind = :comment
elsif scan(/<\/[-\w_.:]*>/m)
kind = :tag
- elsif match = scan(/<[-\w_.:]*/m)
+ elsif match = scan(/<[-\w_.:]*>?/m)
kind = :tag
- if match?(/>/)
- match << getch
- else
- state = :attribute
- end
+ state = :attribute unless match[-1] == ?>
elsif scan(/[^<>&]+/)
kind = :plain
elsif scan(/#{ENTITY}/ox)
- kind = :char
+ kind = :entity
elsif scan(/>/)
kind = :error
else
@@ -79,6 +86,8 @@ module CodeRay module Scanners elsif scan(/#{ATTR_NAME}/o)
kind = :attribute_name
state = :attribute_equal
+ else
+ getch
end
when :attribute_equal
@@ -98,29 +107,32 @@ module CodeRay module Scanners if scan(/#{ATTR_VALUE_UNQUOTED}/o)
kind = :attribute_value
state = :attribute
- elsif scan(/"/)
+ elsif match = scan(/["']/)
tokens << [:open, :string]
state = :attribute_value_string
+ plain_string_content = PLAIN_STRING_CONTENT[match]
kind = :delimiter
elsif scan(/#{TAG_END}/o)
kind = :tag
state = :initial
+ else
+ getch
end
when :attribute_value_string
- if scan(/[^"&\n]+/)
+ if scan(plain_string_content)
kind = :content
- elsif scan(/"/)
- tokens << ['"', :delimiter]
+ elsif scan(/['"]/)
+ tokens << [matched, :delimiter]
tokens << [:close, :string]
state = :attribute
next
elsif scan(/#{ENTITY}/ox)
- kind = :char
- elsif match(/\n/)
+ kind = :entity
+ elsif match(/[\n>]/)
tokens << [:close, :string]
- state = :attribute
- next
+ kind = error
+ state = :initial
end
else
@@ -136,10 +148,15 @@ module CodeRay module Scanners [[match, kind], line], tokens
end
raise_inspect 'Empty token', tokens unless match
-
+
tokens << [match, kind]
end
+ if options[:keep_state]
+ @state = state
+ @plain_string_content = plain_string_content
+ end
+
tokens
end
diff --git a/lib/coderay/scanners/nitro_html.rb b/lib/coderay/scanners/nitro_html.rb new file mode 100644 index 0000000..86d4992 --- /dev/null +++ b/lib/coderay/scanners/nitro_html.rb @@ -0,0 +1,123 @@ +module CodeRay module Scanners
+
+ load :html
+ load :ruby
+
+ # RHTML Scanner
+ #
+ # $Id$
+ class NitroHTML < Scanner
+
+ include Streamable
+ register_for :nitro_html
+
+ NITRO_RUBY_BLOCK = /
+ <\?r
+ (?>
+ [^\?]*
+ (?> \?(?!>) [^\?]* )*
+ )
+ (?: \?> )?
+ |
+ <ruby>
+ (?>
+ [^<]*
+ (?> <(?!\/ruby>) [^<]* )*
+ )
+ (?: <\/ruby> )?
+ |
+ <%
+ (?>
+ [^%]*
+ (?> %(?!>) [^%]* )*
+ )
+ (?: %> )?
+ /mx
+
+ NITRO_VALUE_BLOCK = /
+ \#
+ (?:
+ \{
+ [^{}]*
+ (?>
+ \{ [^}]* \}
+ (?> [^{}]* )
+ )*
+ \}?
+ | \| [^|]* \|?
+ | \( [^)]* \)?
+ | \[ [^\]]* \]?
+ | \\ [^\\]* \\?
+ )
+ /x
+
+ NITRO_ENTITY = /
+ % (?: \#\d+ | \w+ ) ;
+ /
+
+ START_OF_RUBY = /
+ (?=[<\#%])
+ < (?: \?r | % | ruby> )
+ | \# [{(|]
+ | % (?: \#\d+ | \w+ ) ;
+ /x
+
+ CLOSING_PAREN = Hash.new do |h, p|
+ h[p] = p
+ end.update( {
+ '(' => ')',
+ '[' => ']',
+ '{' => '}',
+ } )
+
+ private
+
+ def setup
+ @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true
+ @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true
+ end
+
+ def scan_tokens tokens, options
+
+ until eos?
+
+ if (match = scan_until(/(?=#{START_OF_RUBY})/o) || scan_until(/\z/)) and not match.empty?
+ @html_scanner.tokenize match
+
+ elsif match = scan(/#{NITRO_VALUE_BLOCK}/o)
+ start_tag = match[0,2]
+ delimiter = CLOSING_PAREN[start_tag[1,1]]
+ end_tag = match[-1,1] == delimiter ? delimiter : ''
+ tokens << [:open, :inline]
+ tokens << [start_tag, :delimiter]
+ code = match[start_tag.size .. -1 - end_tag.size]
+ @ruby_scanner.tokenize code
+ tokens << [end_tag, :delimiter] unless end_tag.empty?
+ tokens << [:close, :inline]
+
+ elsif match = scan(/#{NITRO_RUBY_BLOCK}/o)
+ start_tag = '<?r'
+ end_tag = match[-2,2] == '?>' ? '?>' : ''
+ tokens << [:open, :inline]
+ tokens << [start_tag, :delimiter]
+ code = match[start_tag.size .. -(end_tag.size)-1]
+ @ruby_scanner.tokenize code
+ tokens << [end_tag, :delimiter] unless end_tag.empty?
+ tokens << [:close, :inline]
+
+ elsif entity = scan(/#{NITRO_ENTITY}/o)
+ tokens << [entity, :entity]
+
+ else
+ raise_inspect 'else-case reached!', tokens
+ end
+
+ end
+
+ tokens
+
+ end
+
+ end
+
+end end
diff --git a/lib/coderay/scanners/rhtml.rb b/lib/coderay/scanners/rhtml.rb new file mode 100644 index 0000000..77a4366 --- /dev/null +++ b/lib/coderay/scanners/rhtml.rb @@ -0,0 +1,63 @@ +module CodeRay module Scanners
+
+ load :html
+ load :ruby
+
+ # RHTML Scanner
+ #
+ # $Id$
+ class RHTML < Scanner
+
+ include Streamable
+ register_for :rhtml
+
+ ERB_RUBY_BLOCK = /
+ <%(?!%)[=-]?
+ (?>
+ [^%]*
+ (?> %(?!>) [^%]* )*
+ )
+ (?: %> )?
+ /x
+
+ START_OF_ERB = /
+ <%(?!%)
+ /x
+
+ private
+
+ def setup
+ @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true
+ @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true
+ end
+
+ def scan_tokens tokens, options
+
+ until eos?
+
+ if (match = scan_until(/(?=#{START_OF_ERB})/o) || scan_until(/\z/)) and not match.empty?
+ @html_scanner.tokenize match
+
+ elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
+ start_tag = match[/\A<%[-=]?/]
+ end_tag = match[/%?>?\z/]
+ tokens << [:open, :inline]
+ tokens << [start_tag, :delimiter]
+ code = match[start_tag.size .. -1 - end_tag.size]
+ @ruby_scanner.tokenize code
+ tokens << [end_tag, :delimiter] unless end_tag.empty?
+ tokens << [:close, :inline]
+
+ else
+ raise_inspect 'else-case reached!', tokens
+ end
+
+ end
+
+ tokens
+
+ end
+
+ end
+
+end end
diff --git a/lib/coderay/scanners/ruby.rb b/lib/coderay/scanners/ruby.rb index 810e1fd..9a33bef 100644 --- a/lib/coderay/scanners/ruby.rb +++ b/lib/coderay/scanners/ruby.rb @@ -36,12 +36,14 @@ module CodeRay module Scanners depth = nil
states = []
+ c = self.class
+
until eos?
type = :error
match = nil
kind = nil
- if state.instance_of? StringState
+ if state.instance_of? c::StringState
# {{{
match = scan_until(state.pattern) || scan_until(/\z/)
tokens << [match, :content] unless match.empty?
@@ -74,7 +76,7 @@ module CodeRay module Scanners tokens = saved_tokens
regexp = tokens
for text, type in regexp
- if text.is_a? String
+ if text.is_a? ::String
case type
when :content
text.scan(/([^#]+)|(#.*)/) do |plain, comment|
@@ -141,7 +143,7 @@ module CodeRay module Scanners state.paren_depth += 1
tokens << [match, :nesting_delimiter]
- when REGEXP_SYMBOLS
+ when /#{REGEXP_SYMBOLS}/ox
tokens << [match, :function]
else
@@ -190,15 +192,15 @@ module CodeRay module Scanners if last_token_dot
type = if match[/^[A-Z]/] and not match?(/\(/) then :constant else :ident end
else
- type = IDENT_KIND[match]
+ type = c::IDENT_KIND[match]
if type == :ident and match[/^[A-Z]/] and not match[/[!?]$/] and not match?(/\(/)
type = :constant
elsif type == :reserved
- state = DEF_NEW_STATE[match]
+ state = c::DEF_NEW_STATE[match]
end
end
## experimental!
- fancy_allowed = regexp_allowed = :set if REGEXP_ALLOWED[match] or check(/\s+(?:%\S|\/\S)/)
+ fancy_allowed = regexp_allowed = :set if c::REGEXP_ALLOWED[match] or check(/\s+(?:%\S|\/\S)/)
# OPERATORS #
elsif (not last_token_dot and match = scan(/ ==?=? | \.\.?\.? | [\(\)\[\]\{\}] | :: | , /x)) or
@@ -226,7 +228,7 @@ module CodeRay module Scanners elsif match = scan(/ ['"] /mx)
tokens << [:open, :string]
type = :delimiter
- state = StringState.new :string, match == '"', match # important for streaming
+ state = c::StringState.new :string, match == '"', match # important for streaming
elsif match = scan(/#{INSTANCE_VARIABLE}/o)
type = :instance_variable
@@ -235,7 +237,7 @@ module CodeRay module Scanners tokens << [:open, :regexp]
type = :delimiter
interpreted = true
- state = StringState.new :regexp, interpreted, match
+ state = c::StringState.new :regexp, interpreted, match
if parse_regexp
tokens = []
saved_tokens = tokens
@@ -251,7 +253,7 @@ module CodeRay module Scanners tokens << [':', :symbol]
match = delim.chr
type = :delimiter
- state = StringState.new :symbol, delim == ?", match
+ state = c::StringState.new :symbol, delim == ?", match
else
type = :symbol
end
@@ -264,11 +266,11 @@ module CodeRay module Scanners indented = self[1] == '-'
quote = self[3]
delim = self[quote ? 4 : 2]
- type = QUOTE_TO_TYPE[quote]
+ type = c::QUOTE_TO_TYPE[quote]
tokens << [:open, type]
tokens << [match, :delimiter]
match = :close
- heredoc = StringState.new type, quote != '\'', delim, (indented ? :indented : :linestart )
+ heredoc = c::StringState.new type, quote != '\'', delim, (indented ? :indented : :linestart )
heredocs ||= [] # create heredocs if empty
heredocs << heredoc
@@ -277,7 +279,7 @@ module CodeRay module Scanners raise_inspect 'Unknown fancy string: %%%p' % k, tokens
end
tokens << [:open, type]
- state = StringState.new type, interpreted, self[2]
+ state = c::StringState.new type, interpreted, self[2]
type = :delimiter
elsif fancy_allowed and match = scan(/#{CHARACTER}/o)
@@ -293,7 +295,7 @@ module CodeRay module Scanners else
tokens << [:open, :shell]
type = :delimiter
- state = StringState.new :shell, true, match
+ state = c::StringState.new :shell, true, match
end
elsif match = scan(/#{GLOBAL_VARIABLE}/o)
@@ -326,7 +328,7 @@ module CodeRay module Scanners tokens << [':', :symbol]
match = delim.chr
type = :delimiter
- state = StringState.new :symbol, delim == ?", match
+ state = c::StringState.new :symbol, delim == ?", match
state.next_state = :undef_comma_expected
else
type = :symbol
@@ -377,6 +379,11 @@ module CodeRay module Scanners end
end
+ states << state if state.is_a? c::StringState
+ until states.empty?
+ tokens << [:close, states.pop.type]
+ end
+
tokens
end
end
diff --git a/lib/coderay/scanners/ruby/patterns.rb b/lib/coderay/scanners/ruby/patterns.rb index c007d8c..7bf9103 100644 --- a/lib/coderay/scanners/ruby/patterns.rb +++ b/lib/coderay/scanners/ruby/patterns.rb @@ -46,7 +46,7 @@ module CodeRay module Scanners | <=?>? | >=? # comparison, rocket operator
| ===? # simple equality and case equality
/ox
- METHOD_NAME_EX = / #{IDENT} [?!=]? | #{METHOD_NAME_OPERATOR} /ox
+ METHOD_NAME_EX = / #{IDENT} (?:[?!]|=(?!>))? | #{METHOD_NAME_OPERATOR} /ox
INSTANCE_VARIABLE = / @ #{IDENT} /ox
CLASS_VARIABLE = / @@ #{IDENT} /ox
OBJECT_VARIABLE = / @@? #{IDENT} /ox
diff --git a/lib/coderay/styles/cycnus.rb b/lib/coderay/styles/cycnus.rb index ec19fae..b635706 100644 --- a/lib/coderay/styles/cycnus.rb +++ b/lib/coderay/styles/cycnus.rb @@ -17,100 +17,106 @@ module CodeRay font-family: 'Courier New', 'Terminal', monospace;
color: #{normal_color};
}
-.CodeRay pre { margin: 0px; }
+.CodeRay pre { margin: 0px }
div.CodeRay { }
-span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
+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; }
+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 tt { font-weight: bold; }
-.CodeRay .no { padding: 0px 4px; }
-.CodeRay .code { width: 100%; }
+.CodeRay .line_numbers tt { font-weight: bold }
+.CodeRay .no { padding: 0px 4px }
+.CodeRay .code { width: 100% }
-ol.CodeRay { font-size: 10pt; }
-ol.CodeRay li { white-space: pre; }
+ol.CodeRay { font-size: 10pt }
+ol.CodeRay li { white-space: pre }
-.CodeRay .code pre { overflow: auto; }
+.CodeRay .code pre { overflow: auto }
MAIN
TOKEN_COLORS = <<-'TOKENS'
-.af { color:#00C; }
-.an { color:#007; }
-.av { color:#700; }
-.aw { color:#C00; }
-.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; }
-.co { color:#036; font-weight:bold; }
-.cr { color:#0A0; }
-.cv { color:#369; }
-.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:#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 { }
-.in { color:#B2B; font-weight:bold; }
-.iv { color:#33B; }
-.la { color:#970; font-weight:bold; }
-.lv { color:#963; }
-.oc { color:#40E; font-weight:bold; }
-.on { color:#000; font-weight:bold; }
+.af { color:#00C }
+.an { color:#007 }
+.av { color:#700 }
+.aw { color:#C00 }
+.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 }
+.co { color:#036; font-weight:bold }
+.cr { color:#0A0 }
+.cv { color:#369 }
+.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 }
+.en { color:#800; font-weight:bold }
+.er { color:#F00; background-color:#FAA }
+.ex { color:#F00; 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: #eee }
+.il .il { background: #ddd }
+.il .il .il { background: #ccc }
+.il .dl { font-weight: bold ! important; color: #888 ! important }
+
+.in { color:#B2B; font-weight:bold }
+.iv { color:#33B }
+.la { color:#970; font-weight:bold }
+.lv { color:#963 }
+.oc { color:#40E; font-weight:bold }
+.on { color:#000; font-weight:bold }
.op { }
-.pc { color:#038; font-weight:bold; }
-.pd { color:#369; font-weight:bold; }
-.pp { color:#579; }
-.pt { color:#339; font-weight:bold; }
-.r { color:#080; font-weight:bold; }
-
-.rx { background-color:#fff0ff; }
-.rx .k { color:#808; }
-.rx .dl { color:#404; }
-.rx .mod { color:#C2C; }
-.rx .fu { color:#404; font-weight: bold; }
-
-.s { background-color:#fff0f0; }
-.s .s { background-color:#ffe0e0; }
-.s .s .s { background-color:#ffd0d0; }
-.s .k { color:#D20; }
-.s .dl { color:#710; }
-
-.sh { background-color:#f0fff0; }
-.sh .k { color:#2B2; }
-.sh .dl { color:#161; }
-
-.sy { color:#A60; }
-.sy .k { color:#A60; }
-.sy .dl { color:#630; }
-
-.ta { color:#070; }
-.tf { color:#070; font-weight:bold; }
-.ts { color:#D70; font-weight:bold; }
-.ty { color:#339; font-weight:bold; }
-.v { color:#036; }
-.xt { color:#444; }
+.pc { color:#038; font-weight:bold }
+.pd { color:#369; font-weight:bold }
+.pp { color:#579 }
+.pt { color:#339; font-weight:bold }
+.r { color:#080; font-weight:bold }
+
+.rx { background-color:#fff0ff }
+.rx .k { color:#808 }
+.rx .dl { color:#404 }
+.rx .mod { color:#C2C }
+.rx .fu { color:#404; font-weight: bold }
+
+.s { background-color:#fff0f0 }
+.s .s { background-color:#ffe0e0 }
+.s .s .s { background-color:#ffd0d0 }
+.s .k { color:#D20 }
+.s .dl { color:#710 }
+
+.sh { background-color:#f0fff0 }
+.sh .k { color:#2B2 }
+.sh .dl { color:#161 }
+
+.sy { color:#A60 }
+.sy .k { color:#A60 }
+.sy .dl { color:#630 }
+
+.ta { color:#070 }
+.tf { color:#070; font-weight:bold }
+.ts { color:#D70; font-weight:bold }
+.ty { color:#339; font-weight:bold }
+.v { color:#036 }
+.xt { color:#444 }
TOKENS
end
|