coderay 0.7.1.147 → 0.7.2.165

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/bin/coderay +54 -56
  2. data/demo/suite.rb +54 -54
  3. data/lib/coderay.rb +187 -187
  4. data/lib/coderay/duo.rb +29 -29
  5. data/lib/coderay/encoder.rb +173 -173
  6. data/lib/coderay/encoders/_map.rb +8 -8
  7. data/lib/coderay/encoders/count.rb +21 -21
  8. data/lib/coderay/encoders/debug.rb +46 -46
  9. data/lib/coderay/encoders/div.rb +20 -20
  10. data/lib/coderay/encoders/html.rb +249 -245
  11. data/lib/coderay/encoders/html/classes.rb +73 -73
  12. data/lib/coderay/encoders/html/css.rb +65 -65
  13. data/lib/coderay/encoders/html/numerization.rb +122 -122
  14. data/lib/coderay/encoders/html/output.rb +195 -195
  15. data/lib/coderay/encoders/null.rb +26 -26
  16. data/lib/coderay/encoders/page.rb +21 -21
  17. data/lib/coderay/encoders/span.rb +20 -20
  18. data/lib/coderay/encoders/statistic.rb +81 -81
  19. data/lib/coderay/encoders/text.rb +33 -33
  20. data/lib/coderay/encoders/tokens.rb +44 -44
  21. data/lib/coderay/encoders/xml.rb +71 -71
  22. data/lib/coderay/encoders/yaml.rb +22 -22
  23. data/lib/coderay/helpers/filetype.rb +152 -153
  24. data/lib/coderay/helpers/gzip_simple.rb +67 -68
  25. data/lib/coderay/helpers/plugin.rb +297 -297
  26. data/lib/coderay/helpers/word_list.rb +46 -47
  27. data/lib/coderay/scanner.rb +238 -238
  28. data/lib/coderay/scanners/_map.rb +15 -14
  29. data/lib/coderay/scanners/c.rb +163 -155
  30. data/lib/coderay/scanners/delphi.rb +131 -129
  31. data/lib/coderay/scanners/html.rb +174 -167
  32. data/lib/coderay/scanners/nitro_xhtml.rb +130 -0
  33. data/lib/coderay/scanners/plaintext.rb +15 -15
  34. data/lib/coderay/scanners/rhtml.rb +73 -65
  35. data/lib/coderay/scanners/ruby.rb +404 -397
  36. data/lib/coderay/scanners/ruby/patterns.rb +216 -216
  37. data/lib/coderay/scanners/xml.rb +18 -18
  38. data/lib/coderay/style.rb +20 -20
  39. data/lib/coderay/styles/_map.rb +3 -3
  40. data/lib/coderay/styles/cycnus.rb +18 -18
  41. data/lib/coderay/styles/murphy.rb +18 -18
  42. data/lib/coderay/tokens.rb +322 -322
  43. metadata +86 -86
  44. data/lib/coderay/scanners/nitro_html.rb +0 -125
  45. data/lib/coderay/scanners/yaml.rb +0 -85
metadata CHANGED
@@ -3,113 +3,113 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: coderay
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.7.1.147
7
- date: 2006-07-05 00:00:00 +02:00
6
+ version: 0.7.2.165
7
+ date: 2006-07-11 00:00:00 +02:00
8
8
  summary: CodeRay is a fast syntax highlighter engine for many languages.
9
9
  require_paths:
10
- - lib
10
+ - lib
11
11
  email: murphy@cYcnus.de
12
12
  homepage: http://coderay.rubychan.de
13
13
  rubyforge_project: coderay
14
- description: "CodeRay is a Ruby library for syntax highlighting. I try to make CodeRay easy to use and intuitive, but at the same time fully featured, complete, fast and efficient. Usage is simple: require 'coderay' code = 'some %q(weird (Ruby) can't shock) me!' puts CodeRay.scan(code, :ruby).html"
14
+ description: "CodeRay is a Ruby library for syntax highlighting. I try to make CodeRay easy to
15
+ use and intuitive, but at the same time fully featured, complete, fast and
16
+ efficient. Usage is simple: require 'coderay' code = 'some %q(weird (Ruby)
17
+ can't shock) me!' puts CodeRay.scan(code, :ruby).html"
15
18
  autorequire: coderay
16
19
  default_executable:
17
20
  bindir: bin
18
21
  has_rdoc: true
19
22
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
23
  requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
+ -
25
+ - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 1.8.2
24
28
  version:
25
29
  platform: ruby
26
30
  signing_key:
27
31
  cert_chain:
28
32
  post_install_message:
29
33
  authors:
30
- - murphy
34
+ - murphy
31
35
  files:
32
- - ./lib/coderay.rb
33
- - ./lib/coderay/duo.rb
34
- - ./lib/coderay/encoder.rb
35
- - ./lib/coderay/scanner.rb
36
- - ./lib/coderay/style.rb
37
- - ./lib/coderay/tokens.rb
38
- - ./lib/coderay/encoders/count.rb
39
- - ./lib/coderay/encoders/debug.rb
40
- - ./lib/coderay/encoders/div.rb
41
- - ./lib/coderay/encoders/html.rb
42
- - ./lib/coderay/encoders/null.rb
43
- - ./lib/coderay/encoders/page.rb
44
- - ./lib/coderay/encoders/span.rb
45
- - ./lib/coderay/encoders/statistic.rb
46
- - ./lib/coderay/encoders/text.rb
47
- - ./lib/coderay/encoders/tokens.rb
48
- - ./lib/coderay/encoders/xml.rb
49
- - ./lib/coderay/encoders/yaml.rb
50
- - ./lib/coderay/encoders/_map.rb
51
- - ./lib/coderay/encoders/html/classes.rb
52
- - ./lib/coderay/encoders/html/css.rb
53
- - ./lib/coderay/encoders/html/numerization.rb
54
- - ./lib/coderay/encoders/html/output.rb
55
- - ./lib/coderay/helpers/filetype.rb
56
- - ./lib/coderay/helpers/gzip_simple.rb
57
- - ./lib/coderay/helpers/plugin.rb
58
- - ./lib/coderay/helpers/word_list.rb
59
- - ./lib/coderay/scanners/c.rb
60
- - ./lib/coderay/scanners/delphi.rb
61
- - ./lib/coderay/scanners/html.rb
62
- - ./lib/coderay/scanners/nitro_html.rb
63
- - ./lib/coderay/scanners/plaintext.rb
64
- - ./lib/coderay/scanners/rhtml.rb
65
- - ./lib/coderay/scanners/ruby.rb
66
- - ./lib/coderay/scanners/xml.rb
67
- - ./lib/coderay/scanners/yaml.rb
68
- - ./lib/coderay/scanners/_map.rb
69
- - ./lib/coderay/scanners/ruby/patterns.rb
70
- - ./lib/coderay/styles/cycnus.rb
71
- - ./lib/coderay/styles/murphy.rb
72
- - ./lib/coderay/styles/_map.rb
73
- - ./demo/demo_cache.rb
74
- - ./demo/demo_count.rb
75
- - ./demo/demo_css.rb
76
- - ./demo/demo_div.rb
77
- - ./demo/demo_dump.rb
78
- - ./demo/demo_encoder.rb
79
- - ./demo/demo_global_vars.rb
80
- - ./demo/demo_global_vars2.rb
81
- - ./demo/demo_highlight.rb
82
- - ./demo/demo_html.rb
83
- - ./demo/demo_html2.rb
84
- - ./demo/demo_html_list.rb
85
- - ./demo/demo_load_encoder.rb
86
- - ./demo/demo_load_scanner.rb
87
- - ./demo/demo_more.rb
88
- - ./demo/demo_scanner.rb
89
- - ./demo/demo_server.rb
90
- - ./demo/demo_simple.rb
91
- - ./demo/demo_stream.rb
92
- - ./demo/demo_stream2.rb
93
- - ./demo/demo_tokens.rb
94
- - ./demo/suite.rb
95
- - ./README
96
- - ./LICENSE
97
- - ./FOLDERS
36
+ - "./lib/coderay.rb"
37
+ - "./lib/coderay/style.rb"
38
+ - "./lib/coderay/encoder.rb"
39
+ - "./lib/coderay/scanner.rb"
40
+ - "./lib/coderay/duo.rb"
41
+ - "./lib/coderay/tokens.rb"
42
+ - "./lib/coderay/encoders/html.rb"
43
+ - "./lib/coderay/encoders/debug.rb"
44
+ - "./lib/coderay/encoders/xml.rb"
45
+ - "./lib/coderay/encoders/_map.rb"
46
+ - "./lib/coderay/encoders/div.rb"
47
+ - "./lib/coderay/encoders/tokens.rb"
48
+ - "./lib/coderay/encoders/count.rb"
49
+ - "./lib/coderay/encoders/null.rb"
50
+ - "./lib/coderay/encoders/statistic.rb"
51
+ - "./lib/coderay/encoders/yaml.rb"
52
+ - "./lib/coderay/encoders/span.rb"
53
+ - "./lib/coderay/encoders/text.rb"
54
+ - "./lib/coderay/encoders/page.rb"
55
+ - "./lib/coderay/encoders/html/classes.rb"
56
+ - "./lib/coderay/encoders/html/output.rb"
57
+ - "./lib/coderay/encoders/html/numerization.rb"
58
+ - "./lib/coderay/encoders/html/css.rb"
59
+ - "./lib/coderay/helpers/plugin.rb"
60
+ - "./lib/coderay/helpers/filetype.rb"
61
+ - "./lib/coderay/helpers/gzip_simple.rb"
62
+ - "./lib/coderay/helpers/word_list.rb"
63
+ - "./lib/coderay/scanners/rhtml.rb"
64
+ - "./lib/coderay/scanners/delphi.rb"
65
+ - "./lib/coderay/scanners/c.rb"
66
+ - "./lib/coderay/scanners/_map.rb"
67
+ - "./lib/coderay/scanners/html.rb"
68
+ - "./lib/coderay/scanners/ruby.rb"
69
+ - "./lib/coderay/scanners/xml.rb"
70
+ - "./lib/coderay/scanners/plaintext.rb"
71
+ - "./lib/coderay/scanners/nitro_xhtml.rb"
72
+ - "./lib/coderay/scanners/ruby/patterns.rb"
73
+ - "./lib/coderay/styles/cycnus.rb"
74
+ - "./lib/coderay/styles/murphy.rb"
75
+ - "./lib/coderay/styles/_map.rb"
76
+ - "./demo/suite.rb"
77
+ - "./demo/demo_server.rb"
78
+ - "./demo/demo_load_encoder.rb"
79
+ - "./demo/demo_load_scanner.rb"
80
+ - "./demo/demo_more.rb"
81
+ - "./demo/demo_css.rb"
82
+ - "./demo/demo_cache.rb"
83
+ - "./demo/demo_html_list.rb"
84
+ - "./demo/demo_global_vars2.rb"
85
+ - "./demo/demo_stream2.rb"
86
+ - "./demo/demo_encoder.rb"
87
+ - "./demo/demo_div.rb"
88
+ - "./demo/demo_html2.rb"
89
+ - "./demo/demo_count.rb"
90
+ - "./demo/demo_simple.rb"
91
+ - "./demo/demo_scanner.rb"
92
+ - "./demo/demo_stream.rb"
93
+ - "./demo/demo_global_vars.rb"
94
+ - "./demo/demo_tokens.rb"
95
+ - "./demo/demo_html.rb"
96
+ - "./demo/demo_dump.rb"
97
+ - "./demo/demo_highlight.rb"
98
+ - "./README"
99
+ - "./LICENSE"
100
+ - "./FOLDERS"
98
101
  test_files: []
99
-
100
102
  rdoc_options:
101
- - -SNw2
102
- - -mREADME
103
- - -a
104
- - -t CodeRay Documentation
103
+ - "-SNw2"
104
+ - "-mREADME"
105
+ - "-a"
106
+ - "-t CodeRay Documentation"
105
107
  extra_rdoc_files:
106
- - ./README
107
- - ./FOLDERS
108
+ - "./README"
109
+ - "./FOLDERS"
108
110
  executables:
109
- - coderay
111
+ - coderay
110
112
  extensions: []
111
-
112
113
  requirements:
113
- - strscan
114
- dependencies: []
115
-
114
+ - strscan
115
+ dependencies: []
@@ -1,125 +0,0 @@
1
- module CodeRay
2
- module Scanners
3
-
4
- load :html
5
- load :ruby
6
-
7
- # RHTML Scanner
8
- #
9
- # $Id$
10
- class NitroHTML < Scanner
11
-
12
- include Streamable
13
- register_for :nitro_html
14
-
15
- NITRO_RUBY_BLOCK = /
16
- <\?r
17
- (?>
18
- [^\?]*
19
- (?> \?(?!>) [^\?]* )*
20
- )
21
- (?: \?> )?
22
- |
23
- <ruby>
24
- (?>
25
- [^<]*
26
- (?> <(?!\/ruby>) [^<]* )*
27
- )
28
- (?: <\/ruby> )?
29
- |
30
- <%
31
- (?>
32
- [^%]*
33
- (?> %(?!>) [^%]* )*
34
- )
35
- (?: %> )?
36
- /mx
37
-
38
- NITRO_VALUE_BLOCK = /
39
- \#
40
- (?:
41
- \{
42
- [^{}]*
43
- (?>
44
- \{ [^}]* \}
45
- (?> [^{}]* )
46
- )*
47
- \}?
48
- | \| [^|]* \|?
49
- | \( [^)]* \)?
50
- | \[ [^\]]* \]?
51
- | \\ [^\\]* \\?
52
- )
53
- /x
54
-
55
- NITRO_ENTITY = /
56
- % (?: \#\d+ | \w+ ) ;
57
- /
58
-
59
- START_OF_RUBY = /
60
- (?=[<\#%])
61
- < (?: \?r | % | ruby> )
62
- | \# [{(|]
63
- | % (?: \#\d+ | \w+ ) ;
64
- /x
65
-
66
- CLOSING_PAREN = Hash.new do |h, p|
67
- h[p] = p
68
- end.update( {
69
- '(' => ')',
70
- '[' => ']',
71
- '{' => '}',
72
- } )
73
-
74
- private
75
-
76
- def setup
77
- @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true
78
- @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true
79
- end
80
-
81
- def scan_tokens tokens, options
82
-
83
- until eos?
84
-
85
- if (match = scan_until(/(?=#{START_OF_RUBY})/o) || scan_until(/\z/)) and not match.empty?
86
- @html_scanner.tokenize match
87
-
88
- elsif match = scan(/#{NITRO_VALUE_BLOCK}/o)
89
- start_tag = match[0,2]
90
- delimiter = CLOSING_PAREN[start_tag[1,1]]
91
- end_tag = match[-1,1] == delimiter ? delimiter : ''
92
- tokens << [:open, :inline]
93
- tokens << [start_tag, :delimiter]
94
- code = match[start_tag.size .. -1 - end_tag.size]
95
- @ruby_scanner.tokenize code
96
- tokens << [end_tag, :delimiter] unless end_tag.empty?
97
- tokens << [:close, :inline]
98
-
99
- elsif match = scan(/#{NITRO_RUBY_BLOCK}/o)
100
- start_tag = '<?r'
101
- end_tag = match[-2,2] == '?>' ? '?>' : ''
102
- tokens << [:open, :inline]
103
- tokens << [start_tag, :delimiter]
104
- code = match[start_tag.size .. -(end_tag.size)-1]
105
- @ruby_scanner.tokenize code
106
- tokens << [end_tag, :delimiter] unless end_tag.empty?
107
- tokens << [:close, :inline]
108
-
109
- elsif entity = scan(/#{NITRO_ENTITY}/o)
110
- tokens << [entity, :entity]
111
-
112
- else
113
- raise_inspect 'else-case reached!', tokens
114
- end
115
-
116
- end
117
-
118
- tokens
119
-
120
- end
121
-
122
- end
123
-
124
- end
125
- end
@@ -1,85 +0,0 @@
1
- module CodeRay
2
- module Scanners
3
-
4
- # YAML Scanner
5
- #
6
- # $Id$
7
- #
8
- # See http://yaml.org for information about YAML.
9
- class YAML < Scanner
10
-
11
- include Streamable
12
- register_for :yaml
13
-
14
- private
15
- def setup
16
- @state = :initial
17
- end
18
-
19
- def scan_tokens tokens, options
20
-
21
- state = @state
22
- start_of_line = true
23
-
24
- until eos?
25
-
26
- kind = :error
27
- match = nil
28
-
29
- if match = scan(/\s+/m)
30
- if match.index ?\n # contains newline
31
- start_of_line = true
32
- end
33
- kind = :space
34
-
35
- else
36
-
37
- case state
38
-
39
- when :initial
40
- if bol? and scan(/---(\s*.+)/m)
41
- kind = :preprocessor
42
- else
43
- raise_inspect '[BUG] else-case reached with state %p' % [state], tokens
44
- end
45
-
46
- when :attribute
47
- if scan(/#{TAG_END}/)
48
- kind = :tag
49
- state = :initial
50
- elsif scan(/#{ATTR_NAME}/o)
51
- kind = :attribute_name
52
- state = :attribute_equal
53
- else
54
- getch
55
- end
56
-
57
- else
58
- raise_inspect 'Unknown state: %p' % [state], tokens
59
-
60
- end
61
-
62
- start_of_line = false
63
- end
64
-
65
- match ||= matched
66
- if $DEBUG and (not kind or kind == :error)
67
- raise_inspect 'Error token %p in line %d' %
68
- [[match, kind], line], tokens
69
- end
70
- raise_inspect 'Empty token', tokens unless match
71
-
72
- tokens << [match, kind]
73
- end
74
-
75
- if options[:keep_state]
76
- @state = state
77
- end
78
-
79
- tokens
80
- end
81
-
82
- end
83
-
84
- end
85
- end