lib/nanoc/data_sources/filesystem.rb in nanoc-2.0.3 vs lib/nanoc/data_sources/filesystem.rb in nanoc-2.0.4
- old
+ new
@@ -85,11 +85,11 @@
FileManager.create_file 'lib/default.rb' do
"\# All files in the 'lib' directory will be loaded\n" +
"\# before nanoc starts compiling.\n" +
"\n" +
"def html_escape(str)\n" +
- " str.gsub('&', '&').str('<', '<').str('>', '>').str('\"', '"')\n" +
+ " str.gsub('&', '&').gsub('<', '<').gsub('>', '>').gsub('\"', '"')\n" +
"end\n" +
"alias h html_escape\n"
end
end
@@ -150,14 +150,13 @@
# a basename (the part before the extension) and an extension. Unlike page
# content files, the extension _is_ used for determining the layout
# processor; which extension maps to which layout processor is defined in
# the layout processors.
def layouts
- Dir["layouts/**/*"].reject { |f| f =~ /~$/ }.map do |filename|
+ Dir["layouts/*"].reject { |f| f =~ /~$/ }.map do |filename|
# Get layout details
extension = File.extname(filename)
- #name = File.basename(filename, extension)
- name = filename.gsub(/layouts\//,"").gsub(extension,"")
+ name = File.basename(filename, extension)
content = File.read(filename)
# Build hash for layout
{ :name => name, :content => content, :extension => extension }
end