Merge commit 'f3a1aa'

This commit is contained in:
Tom Preston-Werner 2008-12-10 15:47:58 -08:00
commit 436ada3679
3 changed files with 12 additions and 9 deletions

View File

@ -34,7 +34,7 @@ module Jekyll
end
end
# Add any necessary layouts to this post
# Add any necessary layouts to this convertible document
# +layouts+ is a Hash of {"name" => "layout"}
# +site_payload+ is the site payload hash
#
@ -42,7 +42,6 @@ module Jekyll
def do_layout(payload, layouts, site_payload)
# construct payload
payload = payload.merge(site_payload)
# render content
self.content = Liquid::Template.parse(self.content).render(payload, [Jekyll::Filters])
self.transform
@ -60,4 +59,4 @@ module Jekyll
end
end
end
end
end

View File

@ -9,7 +9,7 @@ module Jekyll
# Initialize a new Page.
# +base+ is the String path to the <source>
# +dir+ is the String path between <source> and the file
# +name+ is the String filename of the post file
# +name+ is the String filename of the file
#
# Returns <Page>
def initialize(base, dir, name)
@ -24,8 +24,8 @@ module Jekyll
#self.transform
end
# Extract information from the post filename
# +name+ is the String filename of the post file
# Extract information from the page filename
# +name+ is the String filename of the page file
#
# Returns nothing
def process(name)

View File

@ -74,9 +74,11 @@ module Jekyll
end
end
# Recursively transform and write all non-post pages to <dest>/
# +dir+ is the String path part representing the path from
# <source> to the currently processing dir (default '')
# Copy all regular files from <source> to <dest>/ ignoring
# any files/directories that are hidden (start with ".") or contain
# site content (start with "_")
# The +dir+ String is a relative path used to call this method
# recursively as it descends through directories
#
# Returns nothing
def transform_pages(dir = '')
@ -90,10 +92,12 @@ module Jekyll
else
first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }
# if the file appears to have a YAML header then process it as a page
if first3 == "---"
page = Page.new(self.source, dir, f)
page.add_layout(self.layouts, site_payload)
page.write(self.dest)
# otherwise copy the file without transforming it
else
FileUtils.mkdir_p(File.join(self.dest, dir))
FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))