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

View File

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

View File

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