Merge commit 'b45fd6'
This commit is contained in:
commit
cdb0634ce8
|
@ -4,7 +4,6 @@
|
|||
* Minor Enhancements
|
||||
* Added post categories based on directories containing _posts [github.com/mreid]
|
||||
* Added new date filter that shows the full month name [github.com/mreid]
|
||||
* Make post's YAML front matter available as post.data [github.com/remi]
|
||||
* Merge Post's YAML front matter into its to_liquid payload [github.com/remi]
|
||||
* Restrict includes to regular files underneath _includes
|
||||
* Bug Fixes
|
||||
|
|
|
@ -54,7 +54,12 @@ module Jekyll
|
|||
entries = entries.reject { |e| File.directory?(e) }
|
||||
|
||||
entries.each do |f|
|
||||
self.posts << Post.new(base, f) if Post.valid?(f)
|
||||
if Post.valid?(f)
|
||||
post = Post.new(base, f)
|
||||
post.content = Liquid::Template.parse(post.content).render(site_payload, [Jekyll::Filters])
|
||||
post.transform
|
||||
self.posts << post
|
||||
end
|
||||
end
|
||||
|
||||
self.posts.sort!
|
||||
|
@ -86,10 +91,15 @@ module Jekyll
|
|||
(e != '_posts') and ['.', '_'].include?(e[0..0])
|
||||
}
|
||||
|
||||
# we need to make sure to process _posts *first* otherwise they
|
||||
# might not be available yet to other templates as {{ site.posts }}
|
||||
if entries.include? '_posts'
|
||||
entries.delete '_posts'
|
||||
read_posts(File.join(base, '_posts'))
|
||||
end
|
||||
|
||||
entries.each do |f|
|
||||
if f == '_posts'
|
||||
read_posts(File.join(base, f))
|
||||
elsif File.directory?(File.join(base, f))
|
||||
if File.directory?(File.join(base, f))
|
||||
next if self.dest.sub(/\/$/, '') == File.join(base, f)
|
||||
transform_pages(File.join(dir, f))
|
||||
else
|
||||
|
|
|
@ -5,8 +5,18 @@ title: Tom Preston-Werner
|
|||
|
||||
h1. Welcome to my site
|
||||
|
||||
h2. Please read our {{ site.posts | size }} Posts
|
||||
|
||||
<ul>
|
||||
{% for post in site.posts %}
|
||||
<li>{{ post.date }} <a href="{{ post.url }}">{{ post.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
{% assign first_post = site.posts.first %}
|
||||
<div id="first_post">
|
||||
<h1>{{ first_post.title }}</h1>
|
||||
<div>
|
||||
{{ first_post.content }}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
require File.dirname(__FILE__) + '/helper'
|
||||
|
||||
class TestGeneratedSite < Test::Unit::TestCase
|
||||
def setup
|
||||
clear_dest
|
||||
source = File.join(File.dirname(__FILE__), *%w[source])
|
||||
@s = Site.new(source, dest_dir)
|
||||
@s.process
|
||||
@index = File.read(File.join(dest_dir, 'index.html'))
|
||||
end
|
||||
|
||||
def test_site_posts_in_index
|
||||
# confirm that {{ site.posts }} is working
|
||||
assert @index.include?("#{@s.posts.size} Posts")
|
||||
end
|
||||
|
||||
def test_post_content_in_index
|
||||
# confirm that the {{ post.content }} is rendered OK
|
||||
assert @index.include?('<p>This <em>is</em> cool</p>')
|
||||
end
|
||||
end
|
|
@ -27,4 +27,4 @@ class TestSite < Test::Unit::TestCase
|
|||
|
||||
@s.process
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue