Merge commit 'd9b183f99826df630eedeae29f70005993da3d64' into cat
This commit is contained in:
commit
c274ed3592
|
@ -104,6 +104,8 @@ module Jekyll
|
||||||
entries = entries.reject do |e|
|
entries = entries.reject do |e|
|
||||||
(e != '_posts') and ['.', '_'].include?(e[0..0]) unless ['.htaccess'].include?(e)
|
(e != '_posts') and ['.', '_'].include?(e[0..0]) unless ['.htaccess'].include?(e)
|
||||||
end
|
end
|
||||||
|
directories = entries.select { |e| File.directory?(File.join(base, e)) }
|
||||||
|
files = entries.reject { |e| File.directory?(File.join(base, e)) }
|
||||||
|
|
||||||
# we need to make sure to process _posts *first* otherwise they
|
# we need to make sure to process _posts *first* otherwise they
|
||||||
# might not be available yet to other templates as {{ site.posts }}
|
# might not be available yet to other templates as {{ site.posts }}
|
||||||
|
@ -111,23 +113,24 @@ module Jekyll
|
||||||
entries.delete('_posts')
|
entries.delete('_posts')
|
||||||
read_posts(dir)
|
read_posts(dir)
|
||||||
end
|
end
|
||||||
|
[directories, files].each do |entries|
|
||||||
entries.each do |f|
|
entries.each do |f|
|
||||||
if File.directory?(File.join(base, f))
|
if File.directory?(File.join(base, f))
|
||||||
next if self.dest.sub(/\/$/, '') == File.join(base, f)
|
next if self.dest.sub(/\/$/, '') == File.join(base, f)
|
||||||
transform_pages(File.join(dir, f))
|
transform_pages(File.join(dir, f))
|
||||||
else
|
|
||||||
first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }
|
|
||||||
|
|
||||||
if first3 == "---"
|
|
||||||
# file appears to have a YAML header so process it as a page
|
|
||||||
page = Page.new(self.source, dir, f)
|
|
||||||
page.render(self.layouts, site_payload)
|
|
||||||
page.write(self.dest)
|
|
||||||
else
|
else
|
||||||
# otherwise copy the file without transforming it
|
first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }
|
||||||
FileUtils.mkdir_p(File.join(self.dest, dir))
|
|
||||||
FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))
|
if first3 == "---"
|
||||||
|
# file appears to have a YAML header so process it as a page
|
||||||
|
page = Page.new(self.source, dir, f)
|
||||||
|
page.render(self.layouts, site_payload)
|
||||||
|
page.write(self.dest)
|
||||||
|
else
|
||||||
|
# otherwise copy the file without transforming it
|
||||||
|
FileUtils.mkdir_p(File.join(self.dest, dir))
|
||||||
|
FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Categories
|
||||||
|
---
|
||||||
|
|
||||||
|
Categories _should_ work
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
layout: default
|
||||||
|
title: Categories
|
||||||
|
---
|
||||||
|
|
||||||
|
Categories _should_ work. Even if ordered after index.
|
|
@ -11,6 +11,7 @@ class TestGeneratedSite < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_site_posts_in_index
|
def test_site_posts_in_index
|
||||||
# confirm that {{ site.posts }} is working
|
# confirm that {{ site.posts }} is working
|
||||||
|
puts @s.posts.size
|
||||||
assert @index.include?("#{@s.posts.size} Posts")
|
assert @index.include?("#{@s.posts.size} Posts")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue