public
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/nex3/haml.git
Move file-loading into the Haml module.
nex3 (author)
Mon Mar 24 21:37:38 -0700 2008
commit  97d46e2d003b1275bce7bb31598fb89ddf6ffcb2
tree    eee9cfaeac1c79e9b1ab35d48aef35fc4a34aac3
parent  28cc786e6d4d1cb0ae5732f13e38825ab87dd38f
...
890
891
892
 
 
 
 
 
 
 
 
 
 
 
 
 
 
893
894
895
...
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
0
@@ -890,6 +890,20 @@ module Haml
0
   def self.init_rails(binding)
0
     %w[haml/template sass sass/plugin].each(&method(:require))
0
   end
0
+
0
+ # This method is used by both Haml and Sass to load imports/partials.
0
+ # It looks for files in load paths.
0
+ def self.find_file_to_load(load_paths, *filenames) # :nodoc:
0
+ load_paths.each do |path|
0
+ filenames.each do |name|
0
+ full_path = File.join(path, name)
0
+ if File.readable?(full_path)
0
+ return full_path
0
+ end
0
+ end
0
+ end
0
+ nil
0
+ end
0
 end
0
 
0
 require 'haml/engine'
...
358
359
360
361
 
 
362
363
364
...
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
...
358
359
360
 
361
362
363
364
365
...
371
372
373
 
 
 
 
 
 
 
 
 
 
 
 
374
375
0
@@ -358,7 +358,8 @@ module Sass
0
         return filename
0
       end
0
 
0
- new_filename = find_full_path("#{filename}.sass", load_paths)
0
+
0
+ new_filename = Haml::find_file_to_load(load_paths, "_#{filename}.sass", "#{filename}.sass")
0
 
0
       if new_filename.nil?
0
         if was_sass
0
@@ -370,17 +371,5 @@ module Sass
0
         new_filename
0
       end
0
     end
0
-
0
- def self.find_full_path(filename, load_paths)
0
- load_paths.each do |path|
0
- ["_#{filename}", filename].each do |name|
0
- full_path = File.join(path, name)
0
- if File.readable?(full_path)
0
- return full_path
0
- end
0
- end
0
- end
0
- nil
0
- end
0
   end
0
 end

Comments

    No one has commented yet.