diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-12 16:04:45 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-12 16:04:45 +0200 |
commit | 69246fc8ed0344eae4dab35286813a00010a08cb (patch) | |
tree | 9c4faf0bcc2bb53e7955aff0b139492ea04dbe2e /lib/coderay/helpers | |
parent | 34e823d709ce19a480dbd78e72e63ada0d3425fb (diff) | |
parent | 40bd2ef5d33d32c3b3987da1d115b717259819e4 (diff) | |
download | coderay-69246fc8ed0344eae4dab35286813a00010a08cb.tar.gz |
Merge branch 'master' into lua-scanner
Conflicts:
lib/coderay/token_kinds.rb
Diffstat (limited to 'lib/coderay/helpers')
-rw-r--r-- | lib/coderay/helpers/file_type.rb | 5 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 17 |
2 files changed, 7 insertions, 15 deletions
diff --git a/lib/coderay/helpers/file_type.rb b/lib/coderay/helpers/file_type.rb index 637001b..a5d83ff 100644 --- a/lib/coderay/helpers/file_type.rb +++ b/lib/coderay/helpers/file_type.rb @@ -99,6 +99,7 @@ module CodeRay 'mab' => :ruby, 'pas' => :delphi, 'patch' => :diff, + 'phtml' => :php, 'php' => :php, 'php3' => :php, 'php4' => :php, @@ -116,10 +117,10 @@ module CodeRay 'rpdf' => :ruby, 'ru' => :ruby, 'rxml' => :ruby, - # 'sch' => :scheme, + 'sass' => :sass, 'sql' => :sql, - # 'ss' => :scheme, 'tmproj' => :xml, + 'xaml' => :xml, 'xhtml' => :html, 'xml' => :xml, 'yaml' => :yaml, diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 137c1ab..d14c5a9 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -131,7 +131,7 @@ module CodeRay # A Hash of plugion_id => Plugin pairs. def plugin_hash - @plugin_hash ||= make_plugin_hash + @plugin_hash ||= (@plugin_hash = make_plugin_hash).tap { load_plugin_map } end # Returns an array of all .rb files in the plugin path. @@ -158,7 +158,6 @@ module CodeRay # This is done automatically when plugin_path is called. def load_plugin_map mapfile = path_to '_map' - @plugin_map_loaded = true if File.exist? mapfile require mapfile true @@ -171,23 +170,16 @@ module CodeRay # Return a plugin hash that automatically loads plugins. def make_plugin_hash - @plugin_map_loaded ||= false Hash.new do |h, plugin_id| id = validate_id(plugin_id) path = path_to id begin require path rescue LoadError => boom - if @plugin_map_loaded - 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, '%p could not load plugin %p: %s' % [self, id, boom] - end + if h.has_key?(:default) + h[:default] else - load_plugin_map - h[plugin_id] + raise PluginNotFound, '%p could not load plugin %p: %s' % [self, id, boom] end else # Plugin should have registered by now @@ -271,7 +263,6 @@ module CodeRay end def aliases - plugin_host.load_plugin_map plugin_host.plugin_hash.inject [] do |aliases, (key, _)| aliases << key if plugin_host[key] == self aliases |