Merge pull request #1848 from afeld/sort-pages

This commit is contained in:
Parker Moore 2013-12-19 12:19:49 -08:00
commit 94e96d325b
2 changed files with 9 additions and 0 deletions

View File

@ -175,6 +175,8 @@ module Jekyll
static_files << StaticFile.new(self, self.source, dir, f) static_files << StaticFile.new(self, self.source, dir, f)
end end
end end
pages.sort_by!(&:name)
end end
# Read all the files in <source>/<dir>/_posts and create a new Post # Read all the files in <source>/<dir>/_posts and create a new Post

View File

@ -154,6 +154,13 @@ class TestSite < Test::Unit::TestCase
assert_equal @site.generators.sort_by(&:class).map{|g|g.class.priority}, @site.generators.map{|g|g.class.priority} assert_equal @site.generators.sort_by(&:class).map{|g|g.class.priority}, @site.generators.map{|g|g.class.priority}
end end
should "sort pages alphabetically" do
stub.proxy(Dir).entries { |entries| entries.reverse }
@site.process
sorted_pages = %w(.htaccess about.html bar.html contacts.html deal.with.dots.html foo.md index.html index.html sitemap.xml symlinked-file)
assert_equal sorted_pages, @site.pages.map(&:name)
end
should "read layouts" do should "read layouts" do
@site.read_layouts @site.read_layouts
assert_equal ["default", "simple", "post/simple"].sort, @site.layouts.keys.sort assert_equal ["default", "simple", "post/simple"].sort, @site.layouts.keys.sort