Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directories with valid post names should be filtered out #875

Merged
merged 2 commits into from Apr 7, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/jekyll/site.rb
Expand Up @@ -405,6 +405,7 @@ def get_entries(dir, subfolder)
base = File.join(self.source, dir, subfolder)
return [] unless File.exists?(base)
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
entries.delete_if { |e| File.directory?(File.join(base, e)) }
end

# Aggregate post information
Expand Down
Empty file.
4 changes: 3 additions & 1 deletion test/test_site.rb
Expand Up @@ -161,6 +161,7 @@ def generate(site)
should "read posts" do
@site.read_posts('')
posts = Dir[source_dir('_posts', '*')]
posts.delete_if { |post| File.directory?(post) }
assert_equal posts.size - 1, @site.posts.size
end

Expand All @@ -169,9 +170,10 @@ def generate(site)
@site.process

posts = Dir[source_dir("**", "_posts", "*")]
posts.delete_if { |post| File.directory?(post) }
categories = %w(bar baz category foo z_category publish_test win).sort

assert_equal posts.size - 1, @site.posts.size
assert_equal posts.size, @site.posts.size
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tombell Do you know why it was posts.size - 1 in the previous version? Couldn't figure it out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't look at previous tests unless I wrote them or something broke.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither do I! :-) This one broke, which is weird. The previous test uses posts.size - 1 and passes. Weiiiiiird

assert_equal categories, @site.categories.keys.sort
assert_equal 4, @site.categories['foo'].size
end
Expand Down