summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-04-11 23:00:53 +0000
committermurphy <murphy@rubychan.de>2010-04-11 23:00:53 +0000
commit5347e2ce2ceab3246ef4cadbf67fc2c6c2f818c8 (patch)
tree50bf43a6211b28bd37a83eb0c63b9fa59b686ace
parenta0cfcf343238e0345c5fec8ac5902bf1ffaf1c98 (diff)
downloadcoderay-5347e2ce2ceab3246ef4cadbf67fc2c6c2f818c8.tar.gz
Converted binary to UNIX format, and some cleanup in the version history.
-rw-r--r--Changes.textile29
-rw-r--r--bin/coderay196
-rw-r--r--etc/coderay-lib.tmproj8
-rw-r--r--test/scanners/coderay_suite.rb3
4 files changed, 123 insertions, 113 deletions
diff --git a/Changes.textile b/Changes.textile
index 8d5a78e..6842e10 100644
--- a/Changes.textile
+++ b/Changes.textile
@@ -1,4 +1,4 @@
-h1=. CodeRay Version Changes
+h1=. CodeRay Version History
p=. _This files lists all changes in the CodeRay library since the 0.8.4 release._
@@ -8,13 +8,6 @@ h2. Changes in 1.0
* *FIXED* some image links in the documentation
* *IMPROVED* Ruby 1.9 support (_._ not in @$LOAD_PATH@)
-h3. @coderay@ executable
-
-* *NEW* automatic TTY detection, uses @Terminal@ encoder.
-* *NEW* optional 3rd parameter for the filename.
-* *FIXED*: Warn about generated files.
-* *FIXED*: Ensure linebreak after the output (was problematic for LoC counter).
-
h3. @Tokens::AbbreviationForKind@
* *RENAMED* from @ClassOfKind@. The term "token class" is no longer used in CodeRay. Instead, tokens have _kinds_.
@@ -54,7 +47,6 @@ h3. @Encoders::TokenKindFilter@
h3. @Scanners::Scanner@
-* *FIXED* Ruby 1.9.2 compatibility problem (see revision 463).
* *REMOVED* @String#to_unix@.
h3. @Scanners::Debug@
@@ -81,7 +73,6 @@ h3. @Scanners::Diff@
h3. @Scanners::JavaScript@
* *IMPROVED*: Added @NaN@ and @Infinity@ to list of predefined constants.
-* *FIXED*: Don't keep state of XML scanner between calls for E4X literals.
h3. @Scanners::Java@
@@ -138,6 +129,24 @@ h3. Internal API changes
* *FIXED* @Encoders::HTML#token@'s second parameter is no longer optional.
+h2. Changes in 0.9.3
+
+* *FIXED*: Documentation of Tokens.
+ ("#218":http://redmine.rubychan.de/issues/218)
+
+h3. @coderay@ executable
+
+* *NEW*: automatic TTY detection (uses @Term@ encoder)
+* *NEW*: optional 3rd parameter for the filename
+* *FIXED*: Converted to UNIX format.
+* *FIXED*: Warn about generated files.
+* *FIXED*: Ensure line break after the output (especially for LoC counter).
+
+h3. @Scanners::JavaScript@
+
+* *FIXED*: Don't keep state of XML scanner between calls for E4X literals.
+
+
h2. Changes in 0.9.2
* *NEW* Basic tests and a _Rakefile_ are now included in the Gem. [Flameeyes]
diff --git a/bin/coderay b/bin/coderay
index 24e662a..e895c7e 100644
--- a/bin/coderay
+++ b/bin/coderay
@@ -1,96 +1,100 @@
-#!/usr/bin/env ruby
-# CodeRay Executable
-#
-# Version: 0.2
-# Author: murphy
-
-def err msg
- $stderr.puts msg
-end
-
-def read
- if file = ARGV[2]
- File.read file
- else
- $stdin.read
- end
-end
-
-begin
- require 'coderay'
-
- if ARGV.empty?
- puts <<-USAGE
-CodeRay #{CodeRay::VERSION} (http://coderay.rubychan.de)
-Usage:
- coderay -<lang> [-<format>] < file > output
- coderay file [-<format>]
-Example:
- coderay -ruby -statistic < foo.rb
- coderay -ruby < foo.rb # colorized output on terminal
- coderay codegen.c # generates codegen.c.html
- USAGE
- end
-
- first, second = ARGV
-
- if first
- if first[/-(\w+)/] == first
- lang = $1
- input = read
- tokens = :scan
- elsif first == '-'
- lang = $1
- input = read
- tokens = :scan
- else
- file = first
- tokens = CodeRay.scan_file file
- output_filename, output_ext = file, /#{Regexp.escape(File.extname(file))}$/
- end
- else
- puts 'No lang/file given.'
- exit 1
- end
-
- if second
- if second[/-(\w+)/] == second
- format = $1
- else
- raise 'invalid format (must be -xxx)'
- end
- else
- if $stdout.tty?
- format = :term
- else
- $stderr.puts 'No format given; setting to default (HTML Page).'
- format = :page
- end
- end
-
- # TODO: allow streaming
- if tokens == :scan
- output = CodeRay::Duo[lang => format].highlight input #, :stream => true
- else
- output = tokens.encode format
- end
- out = $stdout
- if output_filename
- output_filename += '.' + CodeRay::Encoders[format]::FILE_EXTENSION
- if File.exist? output_filename
- err 'File %s already exists.' % output_filename
- exit
- else
- out = File.open output_filename, 'w'
- puts "Writing to #{output_filename}..."
- end
- end
- out.puts output
-
-rescue => boom
- err "Error: #{boom.message}\n"
- err boom.backtrace
- err '-' * 50
- err ARGV
- exit 1
-end
+#!/usr/bin/env ruby
+# CodeRay Executable
+#
+# Version: 0.2
+# Author: murphy
+
+def err msg
+ $stderr.puts msg
+end
+
+def read
+ if file = ARGV[2]
+ File.read file
+ else
+ $stdin.read
+ end
+end
+
+begin
+ require 'coderay'
+
+ if ARGV.empty?
+ puts <<-USAGE
+CodeRay #{CodeRay::VERSION} (http://coderay.rubychan.de)
+
+Usage:
+ coderay -<lang> [-<format>] < file > output
+ coderay file [-<format>]
+
+Examples:
+ coderay -ruby -statistic < foo.rb
+ coderay -ruby < foo.rb # colorized output to terminal
+ coderay -ruby -page foo.rb # HTML page output to terminal
+ coderay -ruby -page foo.rb > foo.html # HTML page output to file
+ coderay codegen.c # generates codegen.c.html
+ USAGE
+ end
+
+ first, second = ARGV
+
+ if first
+ if first[/-(\w+)/] == first
+ lang = $1
+ input = read
+ tokens = :scan
+ elsif first == '-'
+ lang = $1
+ input = read
+ tokens = :scan
+ else
+ file = first
+ tokens = CodeRay.scan_file file
+ output_filename, output_ext = file, /#{Regexp.escape(File.extname(file))}$/
+ end
+ else
+ puts 'No lang/file given.'
+ exit 1
+ end
+
+ if second
+ if second[/-(\w+)/] == second
+ format = $1
+ else
+ raise 'invalid format (must be -xxx)'
+ end
+ else
+ if $stdout.tty?
+ format = :term
+ else
+ $stderr.puts 'No format given; setting to default (HTML Page).'
+ format = :page
+ end
+ end
+
+ # TODO: allow streaming
+ if tokens == :scan
+ output = CodeRay::Duo[lang => format].highlight input #, :stream => true
+ else
+ output = tokens.encode format
+ end
+ out = $stdout
+ if output_filename
+ output_filename += '.' + CodeRay::Encoders[format]::FILE_EXTENSION
+ if File.exist? output_filename
+ err 'File %s already exists.' % output_filename
+ exit
+ else
+ out = File.open output_filename, 'w'
+ puts "Writing to #{output_filename}..."
+ end
+ end
+ out.puts output
+
+rescue => boom
+ err "Error: #{boom.message}\n"
+ err boom.backtrace
+ err '-' * 50
+ err ARGV
+ exit 1
+end
diff --git a/etc/coderay-lib.tmproj b/etc/coderay-lib.tmproj
index db26fe0..db03710 100644
--- a/etc/coderay-lib.tmproj
+++ b/etc/coderay-lib.tmproj
@@ -26,9 +26,7 @@
<key>filename</key>
<string>../diff</string>
<key>lastUsed</key>
- <date>2010-03-31T22:10:55Z</date>
- <key>selected</key>
- <true/>
+ <date>2010-04-02T06:59:44Z</date>
</dict>
<dict>
<key>filename</key>
@@ -40,7 +38,7 @@
<key>filename</key>
<string>../Changes.textile</string>
<key>lastUsed</key>
- <date>2010-03-31T21:22:49Z</date>
+ <date>2010-04-02T06:59:45Z</date>
</dict>
<dict>
<key>filename</key>
@@ -118,7 +116,7 @@
<key>filename</key>
<string>../test/scanners/coderay_suite.rb</string>
<key>lastUsed</key>
- <date>2010-03-30T23:48:57Z</date>
+ <date>2010-04-11T21:08:06Z</date>
</dict>
<dict>
<key>filename</key>
diff --git a/test/scanners/coderay_suite.rb b/test/scanners/coderay_suite.rb
index 9b7da98..aa46f9b 100644
--- a/test/scanners/coderay_suite.rb
+++ b/test/scanners/coderay_suite.rb
@@ -416,8 +416,7 @@ module CodeRay
end
File.open(actual_html, 'w') { |f| f.write highlighted }
if okay
- debug = $DEBUG
- $DEBUG = false
+ debug, $DEBUG = $DEBUG, false
FileUtils.copy(actual_html, name + '.expected.html')
$DEBUG = debug
end