search paths first, then extensions when searching for a matching stylesheet.

This commit is contained in:
Chris Eppstein 2010-04-24 16:34:04 -07:00
parent 6dbee67bb0
commit d66687eace

View File

@ -34,8 +34,9 @@ def reference_item(options)
path = stylesheet_path(stylesheet) path = stylesheet_path(stylesheet)
if path if path
@items.detect do |i| @items.detect do |i|
i.identifier =~ /^\/reference/ && if i.identifier =~ /^\/reference/ && i[:stylesheet]
i[:stylesheet] == path i[:stylesheet] == path
end
end end
end end
end end
@ -64,8 +65,9 @@ end
def stylesheet_path(ss) def stylesheet_path(ss)
@site.cached("stylesheet/path/#{ss}") do @site.cached("stylesheet/path/#{ss}") do
possible_filenames_for_stylesheet(ss).each do |filename| possible_names = possible_filenames_for_stylesheet(ss)
import_paths.each do |import_path| import_paths.each do |import_path|
possible_names.each do |filename|
full_path = File.join(import_path.first, filename) full_path = File.join(import_path.first, filename)
if File.exist?(full_path) if File.exist?(full_path)
return "#{import_path.last}#{"/" if import_path.last && import_path.last.length > 0}#{filename}" return "#{import_path.last}#{"/" if import_path.last && import_path.last.length > 0}#{filename}"