coderay 0.4.5.73 → 0.5.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +3 -2
- data/demo/demo_css.rb +1 -1
- data/demo/demo_load_encoder.rb +8 -0
- data/demo/demo_load_scanner.rb +25 -0
- data/demo/demo_more.rb +3 -2
- data/demo/suite.rb +82 -0
- data/lib/coderay.rb +8 -2
- data/lib/coderay/encoder.rb +1 -1
- data/lib/coderay/encoders/_map.rb +8 -0
- data/lib/coderay/encoders/div.rb +3 -1
- data/lib/coderay/encoders/html.rb +8 -5
- data/lib/coderay/encoders/{helpers/html_helper.rb → html/classes.rb} +1 -0
- data/lib/coderay/encoders/html/css.rb +66 -0
- data/lib/coderay/encoders/html/numerization.rb +112 -0
- data/lib/coderay/encoders/{helpers/html_output.rb → html/output.rb} +27 -90
- data/lib/coderay/encoders/span.rb +2 -1
- data/lib/coderay/encoders/statistic.rb +1 -1
- data/lib/coderay/helpers/plugin.rb +100 -88
- data/lib/coderay/helpers/word_list.rb +108 -0
- data/lib/coderay/scanner.rb +3 -3
- data/lib/coderay/scanners/_map.rb +10 -0
- data/lib/coderay/scanners/c.rb +1 -1
- data/lib/coderay/scanners/delphi.rb +1 -1
- data/lib/coderay/scanners/ruby.rb +1 -1
- data/lib/coderay/scanners/{helpers/ruby_helper.rb → ruby/patterns.rb} +0 -0
- data/lib/coderay/style.rb +20 -0
- data/lib/coderay/{encoders/helpers/html_css.rb → styles/cycnus.rb} +22 -59
- data/lib/coderay/styles/murphy.rb +119 -0
- data/lib/coderay/tokens.rb +1 -1
- metadata +23 -15
- data/lib/coderay/helpers/scanner_helper.rb +0 -63
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: coderay
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2005-10
|
6
|
+
version: 0.5.0.100
|
7
|
+
date: 2005-12-10
|
8
8
|
summary: CodeRay is a fast syntax highlighter engine for many languages.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,49 +32,57 @@ authors:
|
|
32
32
|
files:
|
33
33
|
- "./lib/coderay.rb"
|
34
34
|
- "./lib/coderay/tokens.rb"
|
35
|
-
- "./lib/coderay/scanner.rb"
|
36
35
|
- "./lib/coderay/encoder.rb"
|
36
|
+
- "./lib/coderay/scanner.rb"
|
37
|
+
- "./lib/coderay/style.rb"
|
38
|
+
- "./lib/coderay/encoders/statistic.rb"
|
37
39
|
- "./lib/coderay/encoders/xml.rb"
|
38
|
-
- "./lib/coderay/encoders/span.rb"
|
39
|
-
- "./lib/coderay/encoders/div.rb"
|
40
40
|
- "./lib/coderay/encoders/yaml.rb"
|
41
41
|
- "./lib/coderay/encoders/tokens.rb"
|
42
42
|
- "./lib/coderay/encoders/text.rb"
|
43
|
-
- "./lib/coderay/encoders/statistic.rb"
|
44
43
|
- "./lib/coderay/encoders/count.rb"
|
45
44
|
- "./lib/coderay/encoders/null.rb"
|
46
45
|
- "./lib/coderay/encoders/debug.rb"
|
46
|
+
- "./lib/coderay/encoders/_map.rb"
|
47
|
+
- "./lib/coderay/encoders/span.rb"
|
48
|
+
- "./lib/coderay/encoders/div.rb"
|
47
49
|
- "./lib/coderay/encoders/html.rb"
|
48
|
-
- "./lib/coderay/encoders/
|
49
|
-
- "./lib/coderay/encoders/
|
50
|
-
- "./lib/coderay/encoders/
|
50
|
+
- "./lib/coderay/encoders/html/numerization.rb"
|
51
|
+
- "./lib/coderay/encoders/html/classes.rb"
|
52
|
+
- "./lib/coderay/encoders/html/output.rb"
|
53
|
+
- "./lib/coderay/encoders/html/css.rb"
|
51
54
|
- "./lib/coderay/helpers/filetype.rb"
|
52
55
|
- "./lib/coderay/helpers/plugin.rb"
|
53
|
-
- "./lib/coderay/helpers/
|
56
|
+
- "./lib/coderay/helpers/word_list.rb"
|
54
57
|
- "./lib/coderay/helpers/gzip_simple.rb"
|
58
|
+
- "./lib/coderay/scanners/plaintext.rb"
|
55
59
|
- "./lib/coderay/scanners/c.rb"
|
56
60
|
- "./lib/coderay/scanners/delphi.rb"
|
57
|
-
- "./lib/coderay/scanners/
|
61
|
+
- "./lib/coderay/scanners/_map.rb"
|
58
62
|
- "./lib/coderay/scanners/ruby.rb"
|
59
|
-
- "./lib/coderay/scanners/
|
63
|
+
- "./lib/coderay/scanners/ruby/patterns.rb"
|
64
|
+
- "./lib/coderay/styles/murphy.rb"
|
65
|
+
- "./lib/coderay/styles/cycnus.rb"
|
66
|
+
- "./demo/demo_load_encoder.rb"
|
67
|
+
- "./demo/demo_load_scanner.rb"
|
68
|
+
- "./demo/demo_more.rb"
|
69
|
+
- "./demo/demo_css.rb"
|
60
70
|
- "./demo/demo_global_vars2.rb"
|
61
71
|
- "./demo/demo_stream2.rb"
|
62
|
-
- "./demo/demo_load_encoder.rb"
|
63
72
|
- "./demo/demo_encoder.rb"
|
64
73
|
- "./demo/demo_div.rb"
|
65
74
|
- "./demo/demo_html2.rb"
|
66
|
-
- "./demo/demo_css.rb"
|
67
75
|
- "./demo/demo_count.rb"
|
68
76
|
- "./demo/demo_simple.rb"
|
69
77
|
- "./demo/demo_scanner.rb"
|
70
78
|
- "./demo/demo_stream.rb"
|
71
79
|
- "./demo/demo_global_vars.rb"
|
72
|
-
- "./demo/demo_more.rb"
|
73
80
|
- "./demo/demo_tokens.rb"
|
74
81
|
- "./demo/demo_html.rb"
|
75
82
|
- "./demo/demo_dump.rb"
|
76
83
|
- "./demo/demo_server.rb"
|
77
84
|
- "./demo/demo_highlight.rb"
|
85
|
+
- "./demo/suite.rb"
|
78
86
|
- "./README"
|
79
87
|
- "./LICENSE"
|
80
88
|
test_files: []
|
@@ -1,63 +0,0 @@
|
|
1
|
-
module CodeRay
|
2
|
-
module Scanners
|
3
|
-
|
4
|
-
class Scanner
|
5
|
-
|
6
|
-
# A WordList is a Hash with some additional features.
|
7
|
-
# It is intended to be used for keyword recognition.
|
8
|
-
class WordList < Hash
|
9
|
-
|
10
|
-
def initialize default = false, case_mode = :case_match
|
11
|
-
@case_ignore =
|
12
|
-
case case_mode
|
13
|
-
when :case_match then false
|
14
|
-
when :case_ignore then true
|
15
|
-
else
|
16
|
-
raise ArgumentError,
|
17
|
-
"#{self.class.name}.new: second argument must be :case_ignore or :case_match, but #{case_mode} was given."
|
18
|
-
end
|
19
|
-
|
20
|
-
if @case_ignore
|
21
|
-
super() do |h, k|
|
22
|
-
h[k] = h.fetch k.downcase, default
|
23
|
-
end
|
24
|
-
else
|
25
|
-
super default
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def include? word
|
30
|
-
self[word] if @case_ignore
|
31
|
-
has_key? word
|
32
|
-
end
|
33
|
-
|
34
|
-
def add words, kind = true
|
35
|
-
words.each do |word|
|
36
|
-
self[mind_case(word)] = kind
|
37
|
-
end
|
38
|
-
self
|
39
|
-
end
|
40
|
-
|
41
|
-
alias words keys
|
42
|
-
|
43
|
-
def case_ignore?
|
44
|
-
@case_mode
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
def mind_case word
|
49
|
-
if @case_ignore
|
50
|
-
word.downcase
|
51
|
-
else
|
52
|
-
word.dup
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# vim:sw=2:ts=2:et:tw=78
|