summaryrefslogtreecommitdiff
path: root/lib/coderay/helpers
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-08-19 03:09:35 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-08-19 03:09:35 +0200
commit75bc5455af8c3c3381066aac3d5fff42264cac6f (patch)
tree589d2c912ddd94c517eb794bcdf3257f8348f3c0 /lib/coderay/helpers
parentfdd17b6a09efb275238a3baef275465d31452f2a (diff)
downloadcoderay-75bc5455af8c3c3381066aac3d5fff42264cac6f.tar.gz
Major rewrite of encoders to support IO output; fixed some minor scanner bugs; cleanups; dropped NitroXHTML scanner; improved tests
Diffstat (limited to 'lib/coderay/helpers')
-rw-r--r--lib/coderay/helpers/file_type.rb4
-rw-r--r--lib/coderay/helpers/plugin.rb12
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb
index ea7125f..c752a03 100644
--- a/lib/coderay/helpers/file_type.rb
+++ b/lib/coderay/helpers/file_type.rb
@@ -90,7 +90,7 @@ module CodeRay
'h' => :c,
'htm' => :page,
'html' => :page,
- 'html.erb' => :rhtml,
+ 'html.erb' => :erb,
'java' => :java,
'js' => :java_script,
'json' => :json,
@@ -109,7 +109,7 @@ module CodeRay
'raydebug' => :raydebug,
'rb' => :ruby,
'rbw' => :ruby,
- 'rhtml' => :rhtml,
+ 'rhtml' => :erb,
'rjs' => :ruby,
'rpdf' => :ruby,
'ru' => :ruby,
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb
index 8a8e149..06c1233 100644
--- a/lib/coderay/helpers/plugin.rb
+++ b/lib/coderay/helpers/plugin.rb
@@ -114,9 +114,10 @@ module CodeRay
def default id = nil
if id
id = validate_id id
- plugin_hash[nil] = id
+ raise "The default plugin can't be named \"default\"." if id == :default
+ plugin_hash[:default] = id
else
- load nil
+ load :default
end
end
@@ -179,10 +180,11 @@ module CodeRay
require path
rescue LoadError => boom
if @plugin_map_loaded
- if h.has_key?(nil) # default plugin
- h[nil]
+ if h.has_key?(:default)
+ warn '%p could not load plugin %p; falling back to %p' % [self, id, h[:default]]
+ h[:default]
else
- raise PluginNotFound, 'Could not load plugin %p: %s' % [id, boom]
+ raise PluginNotFound, '%p could not load plugin %p: %s' % [self, id, boom]
end
else
load_plugin_map