coderay 0.9.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{lib/README → README_INDEX.rdoc} +10 -21
- data/Rakefile +6 -6
- data/bin/coderay +193 -64
- data/lib/coderay.rb +61 -105
- data/lib/coderay/duo.rb +17 -21
- data/lib/coderay/encoder.rb +100 -112
- data/lib/coderay/encoders/_map.rb +12 -7
- data/lib/coderay/encoders/comment_filter.rb +12 -30
- data/lib/coderay/encoders/count.rb +29 -11
- data/lib/coderay/encoders/debug.rb +32 -20
- data/lib/coderay/encoders/div.rb +13 -9
- data/lib/coderay/encoders/filter.rb +34 -51
- data/lib/coderay/encoders/html.rb +155 -161
- data/lib/coderay/encoders/html/css.rb +4 -9
- data/lib/coderay/encoders/html/numbering.rb +115 -0
- data/lib/coderay/encoders/html/output.rb +22 -70
- data/lib/coderay/encoders/json.rb +59 -45
- data/lib/coderay/encoders/lines_of_code.rb +12 -57
- data/lib/coderay/encoders/null.rb +6 -14
- data/lib/coderay/encoders/page.rb +13 -9
- data/lib/coderay/encoders/span.rb +13 -9
- data/lib/coderay/encoders/statistic.rb +58 -39
- data/lib/coderay/encoders/terminal.rb +179 -0
- data/lib/coderay/encoders/text.rb +31 -17
- data/lib/coderay/encoders/token_kind_filter.rb +111 -0
- data/lib/coderay/encoders/xml.rb +19 -18
- data/lib/coderay/encoders/yaml.rb +37 -9
- data/lib/coderay/for_redcloth.rb +4 -4
- data/lib/coderay/helpers/file_type.rb +127 -246
- data/lib/coderay/helpers/gzip.rb +41 -0
- data/lib/coderay/helpers/plugin.rb +241 -306
- data/lib/coderay/helpers/word_list.rb +65 -126
- data/lib/coderay/scanner.rb +173 -156
- data/lib/coderay/scanners/_map.rb +18 -17
- data/lib/coderay/scanners/c.rb +63 -77
- data/lib/coderay/scanners/clojure.rb +217 -0
- data/lib/coderay/scanners/cpp.rb +71 -84
- data/lib/coderay/scanners/css.rb +103 -120
- data/lib/coderay/scanners/debug.rb +47 -44
- data/lib/coderay/scanners/delphi.rb +70 -76
- data/lib/coderay/scanners/diff.rb +141 -50
- data/lib/coderay/scanners/erb.rb +81 -0
- data/lib/coderay/scanners/groovy.rb +104 -113
- data/lib/coderay/scanners/haml.rb +168 -0
- data/lib/coderay/scanners/html.rb +181 -110
- data/lib/coderay/scanners/java.rb +73 -75
- data/lib/coderay/scanners/java/builtin_types.rb +2 -0
- data/lib/coderay/scanners/java_script.rb +90 -101
- data/lib/coderay/scanners/json.rb +40 -53
- data/lib/coderay/scanners/php.rb +123 -147
- data/lib/coderay/scanners/python.rb +93 -91
- data/lib/coderay/scanners/raydebug.rb +66 -0
- data/lib/coderay/scanners/ruby.rb +343 -326
- data/lib/coderay/scanners/ruby/patterns.rb +40 -106
- data/lib/coderay/scanners/ruby/string_state.rb +71 -0
- data/lib/coderay/scanners/sql.rb +80 -66
- data/lib/coderay/scanners/text.rb +26 -0
- data/lib/coderay/scanners/xml.rb +1 -1
- data/lib/coderay/scanners/yaml.rb +74 -73
- data/lib/coderay/style.rb +10 -7
- data/lib/coderay/styles/_map.rb +3 -3
- data/lib/coderay/styles/alpha.rb +143 -0
- data/lib/coderay/token_kinds.rb +90 -0
- data/lib/coderay/tokens.rb +102 -277
- data/lib/coderay/tokens_proxy.rb +55 -0
- data/lib/coderay/version.rb +3 -0
- data/test/functional/basic.rb +200 -18
- data/test/functional/examples.rb +130 -0
- data/test/functional/for_redcloth.rb +15 -8
- data/test/functional/suite.rb +9 -6
- metadata +103 -123
- data/FOLDERS +0 -53
- data/bin/coderay_stylesheet +0 -4
- data/lib/coderay/encoders/html/numerization.rb +0 -133
- data/lib/coderay/encoders/term.rb +0 -158
- data/lib/coderay/encoders/token_class_filter.rb +0 -84
- data/lib/coderay/helpers/gzip_simple.rb +0 -123
- data/lib/coderay/scanners/nitro_xhtml.rb +0 -136
- data/lib/coderay/scanners/plaintext.rb +0 -20
- data/lib/coderay/scanners/rhtml.rb +0 -78
- data/lib/coderay/scanners/scheme.rb +0 -145
- data/lib/coderay/styles/cycnus.rb +0 -152
- data/lib/coderay/styles/murphy.rb +0 -134
- data/lib/coderay/token_classes.rb +0 -86
- data/test/functional/load_plugin_scanner.rb +0 -11
- data/test/functional/vhdl.rb +0 -126
- data/test/functional/word_list.rb +0 -79
@@ -1,20 +0,0 @@
|
|
1
|
-
module CodeRay
|
2
|
-
module Scanners
|
3
|
-
|
4
|
-
class Plaintext < Scanner
|
5
|
-
|
6
|
-
register_for :plaintext, :plain
|
7
|
-
title 'Plain text'
|
8
|
-
|
9
|
-
include Streamable
|
10
|
-
|
11
|
-
KINDS_NOT_LOC = [:plain]
|
12
|
-
|
13
|
-
def scan_tokens tokens, options
|
14
|
-
tokens << [scan_rest, :plain]
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
module CodeRay
|
2
|
-
module Scanners
|
3
|
-
|
4
|
-
load :html
|
5
|
-
load :ruby
|
6
|
-
|
7
|
-
# RHTML Scanner
|
8
|
-
class RHTML < Scanner
|
9
|
-
|
10
|
-
include Streamable
|
11
|
-
register_for :rhtml
|
12
|
-
title 'HTML ERB Template'
|
13
|
-
|
14
|
-
KINDS_NOT_LOC = HTML::KINDS_NOT_LOC
|
15
|
-
|
16
|
-
ERB_RUBY_BLOCK = /
|
17
|
-
<%(?!%)[=-]?
|
18
|
-
(?>
|
19
|
-
[^\-%]* # normal*
|
20
|
-
(?> # special
|
21
|
-
(?: %(?!>) | -(?!%>) )
|
22
|
-
[^\-%]* # normal*
|
23
|
-
)*
|
24
|
-
)
|
25
|
-
(?: -?%> )?
|
26
|
-
/x
|
27
|
-
|
28
|
-
START_OF_ERB = /
|
29
|
-
<%(?!%)
|
30
|
-
/x
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def setup
|
35
|
-
@ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true
|
36
|
-
@html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true
|
37
|
-
end
|
38
|
-
|
39
|
-
def reset_instance
|
40
|
-
super
|
41
|
-
@html_scanner.reset
|
42
|
-
end
|
43
|
-
|
44
|
-
def scan_tokens tokens, options
|
45
|
-
|
46
|
-
until eos?
|
47
|
-
|
48
|
-
if (match = scan_until(/(?=#{START_OF_ERB})/o) || scan_rest) and not match.empty?
|
49
|
-
@html_scanner.tokenize match
|
50
|
-
|
51
|
-
elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
|
52
|
-
start_tag = match[/\A<%[-=#]?/]
|
53
|
-
end_tag = match[/-?%?>?\z/]
|
54
|
-
tokens << [:open, :inline]
|
55
|
-
tokens << [start_tag, :inline_delimiter]
|
56
|
-
code = match[start_tag.size .. -1 - end_tag.size]
|
57
|
-
if start_tag == '<%#'
|
58
|
-
tokens << [code, :comment]
|
59
|
-
else
|
60
|
-
@ruby_scanner.tokenize code
|
61
|
-
end
|
62
|
-
tokens << [end_tag, :inline_delimiter] unless end_tag.empty?
|
63
|
-
tokens << [:close, :inline]
|
64
|
-
|
65
|
-
else
|
66
|
-
raise_inspect 'else-case reached!', tokens
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
tokens
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
end
|
@@ -1,145 +0,0 @@
|
|
1
|
-
module CodeRay
|
2
|
-
module Scanners
|
3
|
-
|
4
|
-
# Scheme scanner for CodeRay (by closure).
|
5
|
-
# Thanks to murphy for putting CodeRay into public.
|
6
|
-
class Scheme < Scanner
|
7
|
-
|
8
|
-
# TODO: function defs
|
9
|
-
# TODO: built-in functions
|
10
|
-
|
11
|
-
register_for :scheme
|
12
|
-
file_extension 'scm'
|
13
|
-
|
14
|
-
CORE_FORMS = %w[
|
15
|
-
lambda let let* letrec syntax-case define-syntax let-syntax
|
16
|
-
letrec-syntax begin define quote if or and cond case do delay
|
17
|
-
quasiquote set! cons force call-with-current-continuation call/cc
|
18
|
-
]
|
19
|
-
|
20
|
-
IDENT_KIND = CaseIgnoringWordList.new(:ident).
|
21
|
-
add(CORE_FORMS, :reserved)
|
22
|
-
|
23
|
-
#IDENTIFIER_INITIAL = /[a-z!@\$%&\*\/\:<=>\?~_\^]/i
|
24
|
-
#IDENTIFIER_SUBSEQUENT = /#{IDENTIFIER_INITIAL}|\d|\.|\+|-/
|
25
|
-
#IDENTIFIER = /#{IDENTIFIER_INITIAL}#{IDENTIFIER_SUBSEQUENT}*|\+|-|\.{3}/
|
26
|
-
IDENTIFIER = /[a-zA-Z!@$%&*\/:<=>?~_^][\w!@$%&*\/:<=>?~^.+\-]*|[+-]|\.\.\./
|
27
|
-
DIGIT = /\d/
|
28
|
-
DIGIT10 = DIGIT
|
29
|
-
DIGIT16 = /[0-9a-f]/i
|
30
|
-
DIGIT8 = /[0-7]/
|
31
|
-
DIGIT2 = /[01]/
|
32
|
-
RADIX16 = /\#x/i
|
33
|
-
RADIX8 = /\#o/i
|
34
|
-
RADIX2 = /\#b/i
|
35
|
-
RADIX10 = /\#d/i
|
36
|
-
EXACTNESS = /#i|#e/i
|
37
|
-
SIGN = /[\+-]?/
|
38
|
-
EXP_MARK = /[esfdl]/i
|
39
|
-
EXP = /#{EXP_MARK}#{SIGN}#{DIGIT}+/
|
40
|
-
SUFFIX = /#{EXP}?/
|
41
|
-
PREFIX10 = /#{RADIX10}?#{EXACTNESS}?|#{EXACTNESS}?#{RADIX10}?/
|
42
|
-
PREFIX16 = /#{RADIX16}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX16}/
|
43
|
-
PREFIX8 = /#{RADIX8}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX8}/
|
44
|
-
PREFIX2 = /#{RADIX2}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX2}/
|
45
|
-
UINT10 = /#{DIGIT10}+#*/
|
46
|
-
UINT16 = /#{DIGIT16}+#*/
|
47
|
-
UINT8 = /#{DIGIT8}+#*/
|
48
|
-
UINT2 = /#{DIGIT2}+#*/
|
49
|
-
DECIMAL = /#{DIGIT10}+#+\.#*#{SUFFIX}|#{DIGIT10}+\.#{DIGIT10}*#*#{SUFFIX}|\.#{DIGIT10}+#*#{SUFFIX}|#{UINT10}#{EXP}/
|
50
|
-
UREAL10 = /#{UINT10}\/#{UINT10}|#{DECIMAL}|#{UINT10}/
|
51
|
-
UREAL16 = /#{UINT16}\/#{UINT16}|#{UINT16}/
|
52
|
-
UREAL8 = /#{UINT8}\/#{UINT8}|#{UINT8}/
|
53
|
-
UREAL2 = /#{UINT2}\/#{UINT2}|#{UINT2}/
|
54
|
-
REAL10 = /#{SIGN}#{UREAL10}/
|
55
|
-
REAL16 = /#{SIGN}#{UREAL16}/
|
56
|
-
REAL8 = /#{SIGN}#{UREAL8}/
|
57
|
-
REAL2 = /#{SIGN}#{UREAL2}/
|
58
|
-
IMAG10 = /i|#{UREAL10}i/
|
59
|
-
IMAG16 = /i|#{UREAL16}i/
|
60
|
-
IMAG8 = /i|#{UREAL8}i/
|
61
|
-
IMAG2 = /i|#{UREAL2}i/
|
62
|
-
COMPLEX10 = /#{REAL10}@#{REAL10}|#{REAL10}\+#{IMAG10}|#{REAL10}-#{IMAG10}|\+#{IMAG10}|-#{IMAG10}|#{REAL10}/
|
63
|
-
COMPLEX16 = /#{REAL16}@#{REAL16}|#{REAL16}\+#{IMAG16}|#{REAL16}-#{IMAG16}|\+#{IMAG16}|-#{IMAG16}|#{REAL16}/
|
64
|
-
COMPLEX8 = /#{REAL8}@#{REAL8}|#{REAL8}\+#{IMAG8}|#{REAL8}-#{IMAG8}|\+#{IMAG8}|-#{IMAG8}|#{REAL8}/
|
65
|
-
COMPLEX2 = /#{REAL2}@#{REAL2}|#{REAL2}\+#{IMAG2}|#{REAL2}-#{IMAG2}|\+#{IMAG2}|-#{IMAG2}|#{REAL2}/
|
66
|
-
NUM10 = /#{PREFIX10}?#{COMPLEX10}/
|
67
|
-
NUM16 = /#{PREFIX16}#{COMPLEX16}/
|
68
|
-
NUM8 = /#{PREFIX8}#{COMPLEX8}/
|
69
|
-
NUM2 = /#{PREFIX2}#{COMPLEX2}/
|
70
|
-
NUM = /#{NUM10}|#{NUM16}|#{NUM8}|#{NUM2}/
|
71
|
-
|
72
|
-
private
|
73
|
-
def scan_tokens tokens,options
|
74
|
-
|
75
|
-
state = :initial
|
76
|
-
ident_kind = IDENT_KIND
|
77
|
-
|
78
|
-
until eos?
|
79
|
-
kind = match = nil
|
80
|
-
|
81
|
-
case state
|
82
|
-
when :initial
|
83
|
-
if scan(/ \s+ | \\\n /x)
|
84
|
-
kind = :space
|
85
|
-
elsif scan(/['\(\[\)\]]|#\(/)
|
86
|
-
kind = :operator_fat
|
87
|
-
elsif scan(/;.*/)
|
88
|
-
kind = :comment
|
89
|
-
elsif scan(/#\\(?:newline|space|.?)/)
|
90
|
-
kind = :char
|
91
|
-
elsif scan(/#[ft]/)
|
92
|
-
kind = :pre_constant
|
93
|
-
elsif scan(/#{IDENTIFIER}/o)
|
94
|
-
kind = ident_kind[matched]
|
95
|
-
elsif scan(/\./)
|
96
|
-
kind = :operator
|
97
|
-
elsif scan(/"/)
|
98
|
-
tokens << [:open, :string]
|
99
|
-
state = :string
|
100
|
-
tokens << ['"', :delimiter]
|
101
|
-
next
|
102
|
-
elsif scan(/#{NUM}/o) and not matched.empty?
|
103
|
-
kind = :integer
|
104
|
-
elsif getch
|
105
|
-
kind = :error
|
106
|
-
end
|
107
|
-
|
108
|
-
when :string
|
109
|
-
if scan(/[^"\\]+/) or scan(/\\.?/)
|
110
|
-
kind = :content
|
111
|
-
elsif scan(/"/)
|
112
|
-
tokens << ['"', :delimiter]
|
113
|
-
tokens << [:close, :string]
|
114
|
-
state = :initial
|
115
|
-
next
|
116
|
-
else
|
117
|
-
raise_inspect "else case \" reached; %p not handled." % peek(1),
|
118
|
-
tokens, state
|
119
|
-
end
|
120
|
-
|
121
|
-
else
|
122
|
-
raise "else case reached"
|
123
|
-
end
|
124
|
-
|
125
|
-
match ||= matched
|
126
|
-
if $CODERAY_DEBUG and not kind
|
127
|
-
raise_inspect 'Error token %p in line %d' %
|
128
|
-
[[match, kind], line], tokens
|
129
|
-
end
|
130
|
-
raise_inspect 'Empty token', tokens, state unless match
|
131
|
-
|
132
|
-
tokens << [match, kind]
|
133
|
-
|
134
|
-
end # until eos
|
135
|
-
|
136
|
-
if state == :string
|
137
|
-
tokens << [:close, :string]
|
138
|
-
end
|
139
|
-
|
140
|
-
tokens
|
141
|
-
|
142
|
-
end #scan_tokens
|
143
|
-
end #class
|
144
|
-
end #module scanners
|
145
|
-
end #module coderay
|
@@ -1,152 +0,0 @@
|
|
1
|
-
module CodeRay
|
2
|
-
module Styles
|
3
|
-
|
4
|
-
class Cycnus < Style
|
5
|
-
|
6
|
-
register_for :cycnus
|
7
|
-
|
8
|
-
code_background = '#f8f8f8'
|
9
|
-
numbers_background = '#def'
|
10
|
-
border_color = 'silver'
|
11
|
-
normal_color = '#000'
|
12
|
-
|
13
|
-
CSS_MAIN_STYLES = <<-MAIN
|
14
|
-
.CodeRay {
|
15
|
-
background-color: #{code_background};
|
16
|
-
border: 1px solid #{border_color};
|
17
|
-
font-family: 'Courier New', 'Terminal', monospace;
|
18
|
-
color: #{normal_color};
|
19
|
-
}
|
20
|
-
.CodeRay pre { margin: 0px }
|
21
|
-
|
22
|
-
div.CodeRay { }
|
23
|
-
|
24
|
-
span.CodeRay { white-space: pre; border: 0px; padding: 2px }
|
25
|
-
|
26
|
-
table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px }
|
27
|
-
table.CodeRay td { padding: 2px 4px; vertical-align: top }
|
28
|
-
|
29
|
-
.CodeRay .line_numbers, .CodeRay .no {
|
30
|
-
background-color: #{numbers_background};
|
31
|
-
color: gray;
|
32
|
-
text-align: right;
|
33
|
-
}
|
34
|
-
.CodeRay .line_numbers tt { font-weight: bold }
|
35
|
-
.CodeRay .line_numbers .highlighted { color: red }
|
36
|
-
.CodeRay .line { display: block; float: left; width: 100%; }
|
37
|
-
.CodeRay .no { padding: 0px 4px }
|
38
|
-
.CodeRay .code { width: 100% }
|
39
|
-
|
40
|
-
ol.CodeRay { font-size: 10pt }
|
41
|
-
ol.CodeRay li { white-space: pre }
|
42
|
-
|
43
|
-
.CodeRay .code pre { overflow: auto }
|
44
|
-
MAIN
|
45
|
-
|
46
|
-
TOKEN_COLORS = <<-'TOKENS'
|
47
|
-
.debug { color:white ! important; background:blue ! important; }
|
48
|
-
|
49
|
-
.af { color:#00C }
|
50
|
-
.an { color:#007 }
|
51
|
-
.at { color:#f08 }
|
52
|
-
.av { color:#700 }
|
53
|
-
.aw { color:#C00 }
|
54
|
-
.bi { color:#509; font-weight:bold }
|
55
|
-
.c { color:#888; }
|
56
|
-
|
57
|
-
.ch { color:#04D }
|
58
|
-
.ch .k { color:#04D }
|
59
|
-
.ch .dl { color:#039 }
|
60
|
-
|
61
|
-
.cl { color:#B06; font-weight:bold }
|
62
|
-
.cm { color:#A08; font-weight:bold }
|
63
|
-
.co { color:#036; font-weight:bold }
|
64
|
-
.cr { color:#0A0 }
|
65
|
-
.cv { color:#369 }
|
66
|
-
.de { color:#B0B; }
|
67
|
-
.df { color:#099; font-weight:bold }
|
68
|
-
.di { color:#088; font-weight:bold }
|
69
|
-
.dl { color:black }
|
70
|
-
.do { color:#970 }
|
71
|
-
.dt { color:#34b }
|
72
|
-
.ds { color:#D42; font-weight:bold }
|
73
|
-
.e { color:#666; font-weight:bold }
|
74
|
-
.en { color:#800; font-weight:bold }
|
75
|
-
.er { color:#F00; background-color:#FAA }
|
76
|
-
.ex { color:#C00; font-weight:bold }
|
77
|
-
.fl { color:#60E; font-weight:bold }
|
78
|
-
.fu { color:#06B; font-weight:bold }
|
79
|
-
.gv { color:#d70; font-weight:bold }
|
80
|
-
.hx { color:#058; font-weight:bold }
|
81
|
-
.i { color:#00D; font-weight:bold }
|
82
|
-
.ic { color:#B44; font-weight:bold }
|
83
|
-
|
84
|
-
.il { background: #ddd; color: black }
|
85
|
-
.il .il { background: #ccc }
|
86
|
-
.il .il .il { background: #bbb }
|
87
|
-
.il .idl { background: #ddd; font-weight: bold; color: #666 }
|
88
|
-
.idl { background-color: #bbb; font-weight: bold; color: #666; }
|
89
|
-
|
90
|
-
.im { color:#f00; }
|
91
|
-
.in { color:#B2B; font-weight:bold }
|
92
|
-
.iv { color:#33B }
|
93
|
-
.la { color:#970; font-weight:bold }
|
94
|
-
.lv { color:#963 }
|
95
|
-
.oc { color:#40E; font-weight:bold }
|
96
|
-
.of { color:#000; font-weight:bold }
|
97
|
-
.op { }
|
98
|
-
.pc { color:#038; font-weight:bold }
|
99
|
-
.pd { color:#369; font-weight:bold }
|
100
|
-
.pp { color:#579; }
|
101
|
-
.ps { color:#00C; font-weight:bold }
|
102
|
-
.pt { color:#074; font-weight:bold }
|
103
|
-
.r, .kw { color:#080; font-weight:bold }
|
104
|
-
|
105
|
-
.ke { color: #808; }
|
106
|
-
.ke .dl { color: #606; }
|
107
|
-
.ke .ch { color: #80f; }
|
108
|
-
.vl { color: #088; }
|
109
|
-
|
110
|
-
.rx { background-color:#fff0ff }
|
111
|
-
.rx .k { color:#808 }
|
112
|
-
.rx .dl { color:#404 }
|
113
|
-
.rx .mod { color:#C2C }
|
114
|
-
.rx .fu { color:#404; font-weight: bold }
|
115
|
-
|
116
|
-
.s { background-color:#fff0f0; color: #D20; }
|
117
|
-
.s .s { background-color:#ffe0e0 }
|
118
|
-
.s .s .s { background-color:#ffd0d0 }
|
119
|
-
.s .k { }
|
120
|
-
.s .ch { color: #b0b; }
|
121
|
-
.s .dl { color: #710; }
|
122
|
-
|
123
|
-
.sh { background-color:#f0fff0; color:#2B2 }
|
124
|
-
.sh .k { }
|
125
|
-
.sh .dl { color:#161 }
|
126
|
-
|
127
|
-
.sy { color:#A60 }
|
128
|
-
.sy .k { color:#A60 }
|
129
|
-
.sy .dl { color:#630 }
|
130
|
-
|
131
|
-
.ta { color:#070 }
|
132
|
-
.tf { color:#070; font-weight:bold }
|
133
|
-
.ts { color:#D70; font-weight:bold }
|
134
|
-
.ty { color:#339; font-weight:bold }
|
135
|
-
.v { color:#036 }
|
136
|
-
.xt { color:#444 }
|
137
|
-
|
138
|
-
.ins { background: #afa; }
|
139
|
-
.del { background: #faa; }
|
140
|
-
.chg { color: #aaf; background: #007; }
|
141
|
-
.head { color: #f8f; background: #505 }
|
142
|
-
|
143
|
-
.ins .ins { color: #080; font-weight:bold }
|
144
|
-
.del .del { color: #800; font-weight:bold }
|
145
|
-
.chg .chg { color: #66f; }
|
146
|
-
.head .head { color: #f4f; }
|
147
|
-
TOKENS
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
end
|
152
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
module CodeRay
|
2
|
-
module Styles
|
3
|
-
|
4
|
-
class Murphy < Style
|
5
|
-
|
6
|
-
register_for :murphy
|
7
|
-
|
8
|
-
code_background = '#001129'
|
9
|
-
numbers_background = code_background
|
10
|
-
border_color = 'silver'
|
11
|
-
normal_color = '#C0C0C0'
|
12
|
-
|
13
|
-
CSS_MAIN_STYLES = <<-MAIN
|
14
|
-
.CodeRay {
|
15
|
-
background-color: #{code_background};
|
16
|
-
border: 1px solid #{border_color};
|
17
|
-
font-family: 'Courier New', 'Terminal', monospace;
|
18
|
-
color: #{normal_color};
|
19
|
-
}
|
20
|
-
.CodeRay pre { margin: 0px; }
|
21
|
-
|
22
|
-
div.CodeRay { }
|
23
|
-
|
24
|
-
span.CodeRay { white-space: pre; border: 0px; padding: 2px; }
|
25
|
-
|
26
|
-
table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; }
|
27
|
-
table.CodeRay td { padding: 2px 4px; vertical-align: top; }
|
28
|
-
|
29
|
-
.CodeRay .line_numbers, .CodeRay .no {
|
30
|
-
background-color: #{numbers_background};
|
31
|
-
color: gray;
|
32
|
-
text-align: right;
|
33
|
-
}
|
34
|
-
.CodeRay .line_numbers tt { font-weight: bold; }
|
35
|
-
.CodeRay .line_numbers .highlighted { color: red }
|
36
|
-
.CodeRay .line { display: block; float: left; width: 100%; }
|
37
|
-
.CodeRay .no { padding: 0px 4px; }
|
38
|
-
.CodeRay .code { width: 100%; }
|
39
|
-
|
40
|
-
ol.CodeRay { font-size: 10pt; }
|
41
|
-
ol.CodeRay li { white-space: pre; }
|
42
|
-
|
43
|
-
.CodeRay .code pre { overflow: auto; }
|
44
|
-
MAIN
|
45
|
-
|
46
|
-
TOKEN_COLORS = <<-'TOKENS'
|
47
|
-
.af { color:#00C; }
|
48
|
-
.an { color:#007; }
|
49
|
-
.av { color:#700; }
|
50
|
-
.aw { color:#C00; }
|
51
|
-
.bi { color:#509; font-weight:bold; }
|
52
|
-
.c { color:#555; background-color: black; }
|
53
|
-
|
54
|
-
.ch { color:#88F; }
|
55
|
-
.ch .k { color:#04D; }
|
56
|
-
.ch .dl { color:#039; }
|
57
|
-
|
58
|
-
.cl { color:#e9e; font-weight:bold; }
|
59
|
-
.co { color:#5ED; font-weight:bold; }
|
60
|
-
.cr { color:#0A0; }
|
61
|
-
.cv { color:#ccf; }
|
62
|
-
.df { color:#099; font-weight:bold; }
|
63
|
-
.di { color:#088; font-weight:bold; }
|
64
|
-
.dl { color:black; }
|
65
|
-
.do { color:#970; }
|
66
|
-
.ds { color:#D42; font-weight:bold; }
|
67
|
-
.e { color:#666; font-weight:bold; }
|
68
|
-
.er { color:#F00; background-color:#FAA; }
|
69
|
-
.ex { color:#F00; font-weight:bold; }
|
70
|
-
.fl { color:#60E; font-weight:bold; }
|
71
|
-
.fu { color:#5ed; font-weight:bold; }
|
72
|
-
.gv { color:#f84; }
|
73
|
-
.hx { color:#058; font-weight:bold; }
|
74
|
-
.i { color:#66f; font-weight:bold; }
|
75
|
-
.ic { color:#B44; font-weight:bold; }
|
76
|
-
.il { }
|
77
|
-
.in { color:#B2B; font-weight:bold; }
|
78
|
-
.iv { color:#aaf; }
|
79
|
-
.la { color:#970; font-weight:bold; }
|
80
|
-
.lv { color:#963; }
|
81
|
-
.oc { color:#40E; font-weight:bold; }
|
82
|
-
.of { color:#000; font-weight:bold; }
|
83
|
-
.op { }
|
84
|
-
.pc { color:#08f; font-weight:bold; }
|
85
|
-
.pd { color:#369; font-weight:bold; }
|
86
|
-
.pp { color:#579; }
|
87
|
-
.pt { color:#66f; font-weight:bold; }
|
88
|
-
.r { color:#5de; font-weight:bold; }
|
89
|
-
.r, .kw { color:#5de; font-weight:bold }
|
90
|
-
|
91
|
-
.ke { color: #808; }
|
92
|
-
|
93
|
-
.rx { background-color:#221133; }
|
94
|
-
.rx .k { color:#f8f; }
|
95
|
-
.rx .dl { color:#f0f; }
|
96
|
-
.rx .mod { color:#f0b; }
|
97
|
-
.rx .fu { color:#404; font-weight: bold; }
|
98
|
-
|
99
|
-
.s { background-color:#331122; }
|
100
|
-
.s .s { background-color:#ffe0e0; }
|
101
|
-
.s .s .s { background-color:#ffd0d0; }
|
102
|
-
.s .k { color:#F88; }
|
103
|
-
.s .dl { color:#f55; }
|
104
|
-
|
105
|
-
.sh { background-color:#f0fff0; }
|
106
|
-
.sh .k { color:#2B2; }
|
107
|
-
.sh .dl { color:#161; }
|
108
|
-
|
109
|
-
.sy { color:#Fc8; }
|
110
|
-
.sy .k { color:#Fc8; }
|
111
|
-
.sy .dl { color:#F84; }
|
112
|
-
|
113
|
-
.ta { color:#070; }
|
114
|
-
.tf { color:#070; font-weight:bold; }
|
115
|
-
.ts { color:#D70; font-weight:bold; }
|
116
|
-
.ty { color:#339; font-weight:bold; }
|
117
|
-
.v { color:#036; }
|
118
|
-
.xt { color:#444; }
|
119
|
-
|
120
|
-
.ins { background: #afa; }
|
121
|
-
.del { background: #faa; }
|
122
|
-
.chg { color: #aaf; background: #007; }
|
123
|
-
.head { color: #f8f; background: #505 }
|
124
|
-
|
125
|
-
.ins .ins { color: #080; font-weight:bold }
|
126
|
-
.del .del { color: #800; font-weight:bold }
|
127
|
-
.chg .chg { color: #66f; }
|
128
|
-
.head .head { color: #f4f; }
|
129
|
-
TOKENS
|
130
|
-
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
end
|