summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2006-06-28 23:05:18 +0000
committermurphy <murphy@rubychan.de>2006-06-28 23:05:18 +0000
commit72a8989da58b16566558a373a4cf582cd36b3872 (patch)
treefcda6647ec3db395f3cffc9d7ff6de9dd90802c0 /lib
parentb5c6e09f9462acd5a8a98318c45bcc3f9114d137 (diff)
downloadcoderay-72a8989da58b16566558a373a4cf582cd36b3872.tar.gz
Fix:
HTML Scanner: Fixed a nasty bug with invalid entities. Thanks to Daniel Bovensiepen. Scanner: added Scanner.normify. Plugin: small documentation fix. Code statistic: added lib root folder rake_helpers/code_statistics.rb: added ability to include non-Ruby code in the statistics used it to count the mountain of test data There is some mixed space/tab indentation now. Complete 2-space-re-indentation will follow.
Diffstat (limited to 'lib')
-rw-r--r--lib/coderay/helpers/plugin.rb2
-rw-r--r--lib/coderay/scanner.rb8
-rw-r--r--lib/coderay/scanners/html.rb2
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb
index 938d1a8..3383828 100644
--- a/lib/coderay/helpers/plugin.rb
+++ b/lib/coderay/helpers/plugin.rb
@@ -224,7 +224,7 @@ protected
plugin_hash.fetch validate_id(id), *args, &blk
end
- # Returns the path to the encoder for format.
+ # Returns the expected path to the plugin file for the given id.
def path_to plugin_id
File.join plugin_path, "#{plugin_id}.rb"
end
diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb
index 8affb53..55c1485 100644
--- a/lib/coderay/scanner.rb
+++ b/lib/coderay/scanner.rb
@@ -65,6 +65,10 @@ module CodeRay
is_a? Streamable
end
+ def normify code
+ code = code.to_s.to_unix
+ end
+
end
=begin
@@ -96,7 +100,7 @@ module CodeRay
raise "I am only the basic Scanner class. I can't scan "\
"anything. :( Use my subclasses." if self.class == Scanner
- super code.to_s.to_unix
+ super Scanner.normify(code)
@tokens = options[:tokens]
if @options[:stream]
@@ -122,7 +126,7 @@ module CodeRay
end
def string= code
- code = code.to_s.to_unix
+ code = Scanner.normify(code)
super code
reset_instance
end
diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb
index f37a8dd..cbf8a55 100644
--- a/lib/coderay/scanners/html.rb
+++ b/lib/coderay/scanners/html.rb
@@ -74,7 +74,7 @@ module Scanners
kind = :plain
elsif scan(/#{ENTITY}/ox)
kind = :entity
- elsif scan(/>/)
+ elsif scan(/[>&]/)
kind = :error
else
raise_inspect '[BUG] else-case reached with state %p' % [state], tokens