don't mess with dir parameter
This commit is contained in:
parent
642349f797
commit
78831d94cd
|
@ -13,6 +13,11 @@ module Jekyll
|
||||||
name =~ MATCHER
|
name =~ MATCHER
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get the full path to the directory containing the draft files
|
||||||
|
def get_base(source, dir)
|
||||||
|
return File.join(source, dir, '_drafts')
|
||||||
|
end
|
||||||
|
|
||||||
# Extract information from the post filename.
|
# Extract information from the post filename.
|
||||||
#
|
#
|
||||||
# name - The String filename of the post file.
|
# name - The String filename of the post file.
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Jekyll
|
||||||
# Returns the new Post.
|
# Returns the new Post.
|
||||||
def initialize(site, source, dir, name)
|
def initialize(site, source, dir, name)
|
||||||
@site = site
|
@site = site
|
||||||
@base = File.join(source, dir)
|
@base = self.get_base(source, dir)
|
||||||
@name = name
|
@name = name
|
||||||
|
|
||||||
self.categories = dir.split('/').reject { |x| x.empty? }
|
self.categories = dir.split('/').reject { |x| x.empty? }
|
||||||
|
@ -65,6 +65,11 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get the full path to the directory containing the post files
|
||||||
|
def get_base(source, dir)
|
||||||
|
return File.join(source, dir, '_posts')
|
||||||
|
end
|
||||||
|
|
||||||
# Read the YAML frontmatter.
|
# Read the YAML frontmatter.
|
||||||
#
|
#
|
||||||
# base - The String path to the dir containing the file.
|
# base - The String path to the dir containing the file.
|
||||||
|
|
|
@ -177,9 +177,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def read_posts(dir)
|
def read_posts(dir)
|
||||||
dir = File.join(dir, '_posts')
|
base = File.join(self.source, dir, '_posts')
|
||||||
|
|
||||||
base = File.join(self.source, dir)
|
|
||||||
return unless File.exists?(base)
|
return unless File.exists?(base)
|
||||||
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
||||||
|
|
||||||
|
@ -204,9 +202,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def read_drafts(dir)
|
def read_drafts(dir)
|
||||||
dir = File.join(dir, '_drafts')
|
base = File.join(self.source, dir, '_drafts')
|
||||||
|
|
||||||
base = File.join(self.source, dir)
|
|
||||||
return unless File.exists?(base)
|
return unless File.exists?(base)
|
||||||
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "read posts" do
|
should "read posts" do
|
||||||
@site.read_posts('', '_posts')
|
@site.read_posts('')
|
||||||
posts = Dir[source_dir('_posts', '*')]
|
posts = Dir[source_dir('_posts', '*')]
|
||||||
assert_equal posts.size - 1, @site.posts.size
|
assert_equal posts.size - 1, @site.posts.size
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ class TestTags < Test::Unit::TestCase
|
||||||
site = Site.new(Jekyll.configuration)
|
site = Site.new(Jekyll.configuration)
|
||||||
|
|
||||||
if override['read_posts']
|
if override['read_posts']
|
||||||
site.read_posts('', '_posts')
|
site.read_posts('')
|
||||||
end
|
end
|
||||||
|
|
||||||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
||||||
|
|
Loading…
Reference in New Issue