coderay 1.0.0.798.pre → 1.0.0.800pre
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.rdoc +8 -20
- data/lib/coderay.rb +12 -17
- data/lib/coderay/version.rb +3 -0
- data/test/functional/basic.rb +1 -1
- metadata +5 -4
data/README.rdoc
CHANGED
@@ -1,57 +1,45 @@
|
|
1
1
|
= CodeRay
|
2
2
|
|
3
|
-
|
4
|
-
coderay.rubychan.de[http://coderay.rubychan.de/doc/]
|
3
|
+
Tired of blue'n'gray? Try the original version of this documentation on
|
4
|
+
coderay.rubychan.de[http://coderay.rubychan.de/doc/] :-)
|
5
5
|
|
6
6
|
== About
|
7
|
+
|
7
8
|
CodeRay is a Ruby library for syntax highlighting.
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
And with line numbers.
|
10
|
+
You put your code in, and you get it back colored; Keywords, strings,
|
11
|
+
floats, comments - all in different colors. And with line numbers.
|
12
12
|
|
13
13
|
*Syntax* *Highlighting*...
|
14
14
|
* makes code easier to read and maintain
|
15
15
|
* lets you detect syntax errors faster
|
16
16
|
* helps you to understand the syntax of a language
|
17
17
|
* looks nice
|
18
|
-
* is what everybody
|
18
|
+
* is what everybody wants to have on their website
|
19
19
|
* solves all your problems and makes the girls run after you
|
20
20
|
|
21
|
-
Version: 0.9.2
|
22
|
-
Author:: murphy (Kornelius Kalnbach)
|
23
|
-
Contact:: murphy rubychan de
|
24
|
-
Website:: coderay.rubychan.de[http://coderay.rubychan.de]
|
25
|
-
License:: GNU LGPL; see LICENSE file in the main directory.
|
26
21
|
|
27
22
|
== Installation
|
28
23
|
|
29
|
-
You need RubyGems[http://rubyforge.org/frs/?group_id=126].
|
30
|
-
|
31
24
|
% gem install coderay
|
32
25
|
|
33
26
|
|
34
27
|
=== Dependencies
|
35
28
|
|
36
|
-
CodeRay needs Ruby 1.8.
|
29
|
+
CodeRay needs Ruby 1.8.7+ or 1.9.2+. It also runs on Rubinius and JRuby.
|
37
30
|
|
38
31
|
|
39
32
|
== Example Usage
|
40
|
-
(Forgive me, but this is not highlighted.)
|
41
33
|
|
42
34
|
require 'coderay'
|
43
35
|
|
44
|
-
|
45
|
-
page = tokens.html :line_numbers => :inline, :wrap => :page
|
46
|
-
puts page
|
36
|
+
html = CodeRay.scan("puts 'Hello, world!'", :ruby).div(:line_numbers => :table)
|
47
37
|
|
48
38
|
|
49
39
|
== Documentation
|
50
40
|
|
51
41
|
See CodeRay.
|
52
42
|
|
53
|
-
Please report errors in this documentation to <murphy rubychan de>.
|
54
|
-
|
55
43
|
|
56
44
|
== Credits
|
57
45
|
|
data/lib/coderay.rb
CHANGED
@@ -127,12 +127,7 @@ module CodeRay
|
|
127
127
|
|
128
128
|
$CODERAY_DEBUG ||= false
|
129
129
|
|
130
|
-
|
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)
|
135
|
-
VERSION = '1.0.0'
|
130
|
+
require 'coderay/version'
|
136
131
|
|
137
132
|
# helpers
|
138
133
|
autoload :FileType, 'coderay/helpers/file_type'
|
@@ -166,7 +161,7 @@ module CodeRay
|
|
166
161
|
scanner = Scanners[lang].new code, options, &block
|
167
162
|
scanner.tokenize
|
168
163
|
end
|
169
|
-
|
164
|
+
|
170
165
|
# Scans +filename+ (a path to a code file) with the Scanner for +lang+.
|
171
166
|
#
|
172
167
|
# If +lang+ is :auto or omitted, the CodeRay::FileType module is used to
|
@@ -185,7 +180,7 @@ module CodeRay
|
|
185
180
|
end
|
186
181
|
scan file, lang, options = {}, &block
|
187
182
|
end
|
188
|
-
|
183
|
+
|
189
184
|
# Encode a string.
|
190
185
|
#
|
191
186
|
# This scans +code+ with the the Scanner for +lang+ and then
|
@@ -196,7 +191,7 @@ module CodeRay
|
|
196
191
|
def encode code, lang, format, options = {}
|
197
192
|
encoder(format, options).encode code, lang, options
|
198
193
|
end
|
199
|
-
|
194
|
+
|
200
195
|
# Encode pre-scanned Tokens.
|
201
196
|
# Use this together with CodeRay.scan:
|
202
197
|
#
|
@@ -209,7 +204,7 @@ module CodeRay
|
|
209
204
|
def encode_tokens tokens, format, options = {}
|
210
205
|
encoder(format, options).encode_tokens tokens, options
|
211
206
|
end
|
212
|
-
|
207
|
+
|
213
208
|
# Encodes +filename+ (a path to a code file) with the Scanner for +lang+.
|
214
209
|
#
|
215
210
|
# See CodeRay.scan_file.
|
@@ -222,7 +217,7 @@ module CodeRay
|
|
222
217
|
tokens = scan_file filename, :auto, get_scanner_options(options)
|
223
218
|
encode_tokens tokens, format, options
|
224
219
|
end
|
225
|
-
|
220
|
+
|
226
221
|
# Highlight a string into a HTML <div>.
|
227
222
|
#
|
228
223
|
# CSS styles use classes, so you have to include a stylesheet
|
@@ -232,7 +227,7 @@ module CodeRay
|
|
232
227
|
def highlight code, lang, options = { :css => :class }, format = :div
|
233
228
|
encode code, lang, format, options
|
234
229
|
end
|
235
|
-
|
230
|
+
|
236
231
|
# Highlight a file into a HTML <div>.
|
237
232
|
#
|
238
233
|
# CSS styles use classes, so you have to include a stylesheet
|
@@ -242,7 +237,7 @@ module CodeRay
|
|
242
237
|
def highlight_file filename, options = { :css => :class }, format = :div
|
243
238
|
encode_file filename, format, options
|
244
239
|
end
|
245
|
-
|
240
|
+
|
246
241
|
# Finds the Encoder class for +format+ and creates an instance, passing
|
247
242
|
# +options+ to it.
|
248
243
|
#
|
@@ -260,7 +255,7 @@ module CodeRay
|
|
260
255
|
def encoder format, options = {}
|
261
256
|
Encoders[format].new options
|
262
257
|
end
|
263
|
-
|
258
|
+
|
264
259
|
# Finds the Scanner class for +lang+ and creates an instance, passing
|
265
260
|
# +options+ to it.
|
266
261
|
#
|
@@ -268,7 +263,7 @@ module CodeRay
|
|
268
263
|
def scanner lang, options = {}
|
269
264
|
Scanners[lang].new '', options
|
270
265
|
end
|
271
|
-
|
266
|
+
|
272
267
|
# Extract the options for the scanner from the +options+ hash.
|
273
268
|
#
|
274
269
|
# Returns an empty Hash if <tt>:scanner_options</tt> is not set.
|
@@ -278,7 +273,7 @@ module CodeRay
|
|
278
273
|
def get_scanner_options options
|
279
274
|
options.fetch :scanner_options, {}
|
280
275
|
end
|
281
|
-
|
276
|
+
|
282
277
|
end
|
283
|
-
|
278
|
+
|
284
279
|
end
|
data/test/functional/basic.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coderay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 1.0.0.
|
4
|
+
prerelease: 9
|
5
|
+
version: 1.0.0.800pre
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kornelius Kalnbach
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
13
|
+
date: 2011-07-09 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Fast and easy syntax highlighting for selected languages, written in Ruby. Comes with RedCloth integration and LOC counter.
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/coderay/styles/murphy.rb
|
87
87
|
- lib/coderay/token_kinds.rb
|
88
88
|
- lib/coderay/tokens.rb
|
89
|
+
- lib/coderay/version.rb
|
89
90
|
- lib/coderay.rb
|
90
91
|
- Rakefile
|
91
92
|
- README.rdoc
|
@@ -110,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
111
|
requirements:
|
111
112
|
- - ">="
|
112
113
|
- !ruby/object:Gem::Version
|
113
|
-
version:
|
114
|
+
version: 1.8.7
|
114
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
116
|
none: false
|
116
117
|
requirements:
|