coderay 0.8.273 → 0.8.303

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ begin
13
13
 
14
14
  if ARGV.empty?
15
15
  puts <<-USAGE
16
- CodeRay #{CodeRay::VERSION} (http://rd.cYcnus.de/coderay)
16
+ CodeRay #{CodeRay::VERSION} (http://coderay.rubychan.de)
17
17
  Usage:
18
18
  coderay -<lang> [-<format>] < file > output
19
19
  coderay file [-<format>]
@@ -1,7 +1,7 @@
1
1
  = CodeRay
2
2
 
3
3
  [- Tired of blue'n'gray? Try the original version of this documentation on
4
- http://rd.cYcnus.de/coderay/doc (use Ctrl+Click to open it in its own frame.) -]
4
+ coderay.rubychan.de[http://coderay.rubychan.de/doc/] (use Ctrl+Click to open it in its own frame.) -]
5
5
 
6
6
  == About
7
7
  CodeRay is a Ruby library for syntax highlighting.
@@ -18,12 +18,11 @@ And with line numbers.
18
18
  * is what everybody should have on their website
19
19
  * solves all your problems and makes the girls run after you
20
20
 
21
- Version: 0.8.1
21
+ Version: 0.8.2
22
22
  Author:: murphy (Kornelius Kalnbach)
23
23
  Contact:: murphy rubychan de
24
24
  Website:: coderay.rubychan.de[http://coderay.rubychan.de]
25
25
  License:: GNU LGPL; see LICENSE file in the main directory.
26
- Subversion:: $Id: README 272 2009-01-01 13:57:08Z murphy $
27
26
 
28
27
  == Installation
29
28
 
@@ -34,7 +33,7 @@ You need RubyGems[http://rubyforge.org/frs/?group_id=126].
34
33
 
35
34
  === Dependencies
36
35
 
37
- CodeRay needs Ruby 1.8.6 or later. It should also run with Ruby 1.9 and JRuby.
36
+ CodeRay needs Ruby 1.8.6 or later. It also runs with Ruby 1.9.1+ and JRuby 1.1+.
38
37
 
39
38
 
40
39
  == Example Usage
@@ -51,7 +50,7 @@ CodeRay needs Ruby 1.8.6 or later. It should also run with Ruby 1.9 and JRuby.
51
50
 
52
51
  See CodeRay.
53
52
 
54
- Please report errors in this documentation to <coderay cycnus de>.
53
+ Please report errors in this documentation to <murphy rubychan de>.
55
54
 
56
55
 
57
56
  == Credits
@@ -75,8 +74,7 @@ Please report errors in this documentation to <coderay cycnus de>.
75
74
  * Doug Kearns and everyone else who worked on ruby.vim - it not only helped me
76
75
  coding CodeRay, but also gave me a wonderful target to reach for the Ruby
77
76
  scanner.
78
- * everyone who uses CodeBB on http://www.rubyforen.de, http://www.python-forum.de, and
79
- http://www.infhu.de/mx (down)
77
+ * everyone who uses CodeBB on http://www.rubyforen.de and http://www.python-forum.de
80
78
  * iGEL, magichisoka, manveru, WoNáDo and everyone I forgot from rubyforen.de
81
79
  * Dethix from ruby-mine.de
82
80
  * zickzackw
@@ -88,6 +86,7 @@ Please report errors in this documentation to <coderay cycnus de>.
88
86
  * Josh Goebel for another version of the JavaScript scanner and a Diff scanner.
89
87
  * Jonathan Younger for pointing out the licence confusion caused by wrong LICENSE file.
90
88
  * Jeremy Hinegardner for finding the shebang-on-empty-file bug in FileType.
89
+ * Charles Oliver Nutter and Yehuda Katz for helping me benchmark CodeRay on JRuby.
91
90
  * The folks at redmine.org - thank you for using and fixing CodeRay!
92
91
  * matz and all Ruby gods and gurus
93
92
  * The inventors of: the computer, the internet, the true color display, HTML &
@@ -99,9 +98,11 @@ Where would we be without all those people?
99
98
  === Created using
100
99
 
101
100
  * Ruby[http://ruby-lang.org/]
102
- * Chihiro (my Sony VAIO laptop); Henrietta (my old MacBook); Triella, born Rico (my new MacBook); as well as
101
+ * Chihiro (my Sony VAIO laptop); Henrietta (my old MacBook);
102
+ Triella, born Rico (my new MacBook); as well as
103
103
  Seras and Hikari (my PCs)
104
- * RDE[http://homepage2.nifty.com/sakazuki/rde_e.html], VIM[http://vim.org] and TextMate[http://macromates.com]
104
+ * RDE[http://homepage2.nifty.com/sakazuki/rde_e.html],
105
+ VIM[http://vim.org] and TextMate[http://macromates.com]
105
106
  * Subversion[http://subversion.tigris.org/]
106
107
  * Redmine[http://redmine.org/]
107
108
  * Firefox[http://www.mozilla.org/products/firefox/],
@@ -1,7 +1,5 @@
1
1
  # = CodeRay Library
2
2
  #
3
- # $Id: coderay.rb 260 2008-10-08 20:18:31Z murphy $
4
- #
5
3
  # CodeRay is a Ruby library for syntax highlighting.
6
4
  #
7
5
  # I try to make CodeRay easy to use and intuitive, but at the same time fully featured, complete,
@@ -130,10 +128,10 @@
130
128
  module CodeRay
131
129
 
132
130
  # Version: Major.Minor.Teeny[.Revision]
133
- # Major: 0 for pre-release
134
- # Minor: odd for beta, even for stable
135
- # Teeny: development state
136
- # Revision: Subversion Revision number (generated on rake)
131
+ # Major: 0 for pre-stable, 1 for stable
132
+ # Minor: feature milestone
133
+ # Teeny: development state, 0 for pre-release
134
+ # Revision: Subversion Revision number (generated on rake gem:make)
137
135
  VERSION = '0.8'
138
136
 
139
137
  require 'coderay/tokens'
@@ -1,4 +1,4 @@
1
- module CodeRay # :nodoc:
1
+ module CodeRay
2
2
 
3
3
  # A little hack to enable CodeRay highlighting in RedCloth.
4
4
  #
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # A simplified interface to the gzip library +zlib+ (from the Ruby Standard Library.)
4
4
  #
5
- # Author: murphy (mail to murphy cYcnus de)
5
+ # Author: murphy (mail to murphy rubychan de)
6
6
  #
7
7
  # Version: 0.2 (2005.may.28)
8
8
  #
@@ -7,6 +7,7 @@ module Scanners
7
7
  :irb => :ruby,
8
8
  :xhtml => :nitro_xhtml,
9
9
  :javascript => :java_script,
10
+ :js => :java_script,
10
11
  :nitro => :nitro_xhtml,
11
12
  :yml => :yaml
12
13
 
@@ -38,6 +38,7 @@ module Scanners
38
38
  Id = /##{Name}/
39
39
  Class = /\.#{Name}/
40
40
  PseudoClass = /:#{Name}/
41
+ AttributeSelector = /\[[^\]]*\]?/
41
42
 
42
43
  end
43
44
 
@@ -55,8 +56,8 @@ module Scanners
55
56
  kind = :space
56
57
 
57
58
  elsif case states.last
58
- when :initial
59
- if scan(/#{RE::Ident}|\*/ox)
59
+ when :initial, :media
60
+ if scan(/(?>#{RE::Ident})(?!\()|\*/ox)
60
61
  kind = :keyword
61
62
  elsif scan RE::Class
62
63
  kind = :class
@@ -64,10 +65,19 @@ module Scanners
64
65
  kind = :constant
65
66
  elsif scan RE::PseudoClass
66
67
  kind = :pseudo_class
67
- elsif scan RE::Name
68
- kind = :identifier
68
+ elsif match = scan(RE::AttributeSelector)
69
+ # TODO: Improve highlighting inside of attribute selectors.
70
+ tokens << [:open, :string]
71
+ tokens << [match[0,1], :delimiter]
72
+ tokens << [match[1..-2], :content] if match.size > 2
73
+ tokens << [match[-1,1], :delimiter] if match[-1] == ?]
74
+ tokens << [:close, :string]
75
+ next
76
+ elsif match = scan(/@media/)
77
+ kind = :directive
78
+ states.push :media_before_name
69
79
  end
70
-
80
+
71
81
  when :block
72
82
  if scan(/(?>#{RE::Ident})(?!\()/ox)
73
83
  if value_expected
@@ -77,6 +87,18 @@ module Scanners
77
87
  end
78
88
  end
79
89
 
90
+ when :media_before_name
91
+ if scan RE::Ident
92
+ kind = :type
93
+ states[-1] = :media_after_name
94
+ end
95
+
96
+ when :media_after_name
97
+ if scan(/\{/)
98
+ kind = :operator
99
+ states[-1] = :media
100
+ end
101
+
80
102
  when :comment
81
103
  if scan(/(?:[^*\s]|\*(?!\/))+/)
82
104
  kind = :comment
@@ -103,7 +125,7 @@ module Scanners
103
125
 
104
126
  elsif scan(/\}/)
105
127
  value_expected = false
106
- if states.last == :block
128
+ if states.last == :block || states.last == :media
107
129
  kind = :operator
108
130
  states.pop
109
131
  else
@@ -30,12 +30,11 @@ module Scanners
30
30
  add(KEYWORDS, :keyword).
31
31
  add(MAGIC_VARIABLES, :local_variable).
32
32
  add(TYPES, :type).
33
- add(BuiltinTypes::List, :type).
33
+ add(BuiltinTypes::List, :pre_type).
34
34
  add(DIRECTIVES, :directive)
35
35
 
36
36
  ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
37
37
  UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
38
- REGEXP_ESCAPE = / [bBdDsSwW] /x
39
38
  STRING_CONTENT_PATTERN = {
40
39
  "'" => /[^\\']+/,
41
40
  '"' => /[^\\"]+/,
@@ -117,15 +116,11 @@ module Scanners
117
116
 
118
117
  end
119
118
 
120
- when :string, :regexp
119
+ when :string
121
120
  if scan(STRING_CONTENT_PATTERN[string_delimiter])
122
121
  kind = :content
123
122
  elsif match = scan(/["'\/]/)
124
123
  tokens << [match, :delimiter]
125
- if state == :regexp
126
- modifiers = scan(/[gim]+/)
127
- tokens << [modifiers, :modifier] if modifiers && !modifiers.empty?
128
- end
129
124
  tokens << [:close, state]
130
125
  string_delimiter = nil
131
126
  state = :initial
@@ -136,8 +131,6 @@ module Scanners
136
131
  else
137
132
  kind = :char
138
133
  end
139
- elsif state == :regexp && scan(/ \\ (?: #{ESCAPE} | #{REGEXP_ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
140
- kind = :char
141
134
  elsif scan(/\\./m)
142
135
  kind = :content
143
136
  elsif scan(/ \\ | $ /x)
@@ -166,7 +159,7 @@ module Scanners
166
159
 
167
160
  end
168
161
 
169
- if [:string, :regexp].include? state
162
+ if state == :string
170
163
  tokens << [:close, state]
171
164
  end
172
165
 
@@ -147,6 +147,10 @@ module Scanners
147
147
  tokens << [match, kind]
148
148
  next
149
149
 
150
+ elsif bol? && match = scan(/\#!.*/)
151
+ tokens << [match, :doctype]
152
+ next
153
+
150
154
  elsif match = scan(/\#.*/) or
151
155
  ( bol? and match = scan(/#{patterns::RUBYDOC_OR_DATA}/o) )
152
156
  kind = :comment
@@ -191,6 +195,7 @@ module Scanners
191
195
  depth -= 1
192
196
  if depth == 0 # closing brace of inline block reached
193
197
  state, depth, heredocs = inline_block_stack.pop
198
+ heredocs = nil if heredocs && heredocs.empty?
194
199
  tokens << [match, :inline_delimiter]
195
200
  kind = :inline
196
201
  match = :close
@@ -346,7 +351,7 @@ module Scanners
346
351
  value_expected = value_expected == :set
347
352
  last_token_dot = last_token_dot == :set
348
353
  end
349
-
354
+
350
355
  if $DEBUG and not kind
351
356
  raise_inspect 'Error token %p in line %d' %
352
357
  [[match, kind], line], tokens, state
@@ -81,25 +81,30 @@ module Scanners
81
81
  /ox
82
82
  METHOD_NAME_OR_SYMBOL = / #{METHOD_NAME_EX} | #{SYMBOL} /ox
83
83
 
84
- # TODO investigste \M, \c and \C escape sequences
85
- # (?: M-\\C-|C-\\M-|M-\\c|c\\M-|c|C-|M-)? (?: \\ (?: [0-7]{3} | x[0-9A-Fa-f]{2} | . ) )
86
- # assert_equal(225, ?\M-a)
87
- # assert_equal(129, ?\M-\C-a)
88
- ESCAPE = /
84
+ SIMPLE_ESCAPE = /
89
85
  [abefnrstv]
90
- | M-\\C-|C-\\M-|M-\\c|c\\M-|c|C-|M-
91
86
  | [0-7]{1,3}
92
87
  | x[0-9A-Fa-f]{1,2}
93
- | .
88
+ | .?
94
89
  /mx
95
-
90
+
91
+ CONTROL_META_ESCAPE = /
92
+ (?: M-|C-|c )
93
+ (?: \\ (?: M-|C-|c ) )*
94
+ (?: [^\\] | \\ #{SIMPLE_ESCAPE} )?
95
+ /mox
96
+
97
+ ESCAPE = /
98
+ #{CONTROL_META_ESCAPE} | #{SIMPLE_ESCAPE}
99
+ /mox
100
+
96
101
  CHARACTER = /
97
102
  \?
98
103
  (?:
99
104
  [^\s\\]
100
105
  | \\ #{ESCAPE}
101
106
  )
102
- /mx
107
+ /mox
103
108
 
104
109
  # NOTE: This is not completely correct, but
105
110
  # nobody needs heredoc delimiters ending with \n.
@@ -1,7 +1,7 @@
1
- # by Keith Pitt
2
1
  module CodeRay
3
2
  module Scanners
4
3
 
4
+ # by Keith Pitt
5
5
  class SQL < Scanner
6
6
 
7
7
  register_for :sql
@@ -1,6 +1,6 @@
1
- # by Josh Goebel
2
1
  module CodeRay module Scanners
3
2
 
3
+ # by Josh Goebel
4
4
  class SQL < Scanner
5
5
 
6
6
  register_for :sql
@@ -8,7 +8,7 @@ module Styles
8
8
  code_background = '#f8f8f8'
9
9
  numbers_background = '#def'
10
10
  border_color = 'silver'
11
- normal_color = '#100'
11
+ normal_color = '#000'
12
12
 
13
13
  CSS_MAIN_STYLES = <<-MAIN
14
14
  .CodeRay {
@@ -50,7 +50,7 @@ ol.CodeRay li { white-space: pre }
50
50
  .av { color:#700 }
51
51
  .aw { color:#C00 }
52
52
  .bi { color:#509; font-weight:bold }
53
- .c { color:#666; }
53
+ .c { color:#888; }
54
54
 
55
55
  .ch { color:#04D }
56
56
  .ch .k { color:#04D }
@@ -77,10 +77,10 @@ ol.CodeRay li { white-space: pre }
77
77
  .i { color:#00D; font-weight:bold }
78
78
  .ic { color:#B44; font-weight:bold }
79
79
 
80
- .il { background: #eee }
80
+ .il { background: #eee; color: black }
81
81
  .il .il { background: #ddd }
82
82
  .il .il .il { background: #ccc }
83
- .il .idl { font-weight: bold; color: #888 }
83
+ .il .idl { font-weight: bold; color: #777 }
84
84
 
85
85
  .im { color:#f00; }
86
86
  .in { color:#B2B; font-weight:bold }
@@ -94,7 +94,7 @@ ol.CodeRay li { white-space: pre }
94
94
  .pd { color:#369; font-weight:bold }
95
95
  .pp { color:#579; }
96
96
  .ps { color:#00C; font-weight: bold; }
97
- .pt { color:#339; font-weight:bold }
97
+ .pt { color:#349; font-weight:bold }
98
98
  .r, .kw { color:#080; font-weight:bold }
99
99
 
100
100
  .ke { color: #808; }
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.273
4
+ version: 0.8.303
5
5
  platform: ruby
6
6
  authors:
7
7
  - murphy
8
- autorequire: coderay
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-04 00:00:00 +01:00
12
+ date: 2009-02-16 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
16
  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"
17
- email: murphy@cYcnus.de
17
+ email: murphy@rubychan.de
18
18
  executables:
19
19
  - coderay
20
20
  - coderay_stylesheet
21
21
  extensions: []
22
22
 
23
23
  extra_rdoc_files:
24
- - ./README
24
+ - ./lib/README
25
25
  - ./FOLDERS
26
26
  files:
27
27
  - ./lib/coderay/duo.rb
@@ -77,7 +77,7 @@ files:
77
77
  - ./lib/coderay/tokens.rb
78
78
  - ./lib/coderay.rb
79
79
  - ./lib/term/ansicolor.rb
80
- - ./README
80
+ - ./lib/README
81
81
  - ./LICENSE
82
82
  - ./FOLDERS
83
83
  has_rdoc: true
@@ -85,7 +85,7 @@ homepage: http://coderay.rubychan.de
85
85
  post_install_message:
86
86
  rdoc_options:
87
87
  - -SNw2
88
- - -mREADME
88
+ - -mlib/README
89
89
  - -a
90
90
  - -t CodeRay Documentation
91
91
  require_paths:
@@ -102,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: "0"
104
104
  version:
105
- requirements:
106
- - strscan
105
+ requirements: []
106
+
107
107
  rubyforge_project: coderay
108
108
  rubygems_version: 1.3.1
109
109
  signing_key: