Created
March 26, 2009 21:17
-
-
Save TwP/86348 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc 'add a new blog summary entry' | |
task :add_to_blog do | |
# Load up all files and populate the @pages DB | |
Webby.load_files | |
# Find the page that has the table of interest | |
page = Webby::Resources.pages.find('Page Title') | |
# Create a new renderer for this page and then render it | |
renderer = Webby::Renderer.new(page) | |
renderer._render_page | |
# The page will contain an ERB section that uses the "content_for" method | |
# to capture content into the named variable :desired_table | |
table = renderer.content_for(:desired_table) | |
# Now we tell the builder to create a new page, and we pass in the table | |
# as a local variable. Your page template will use ERB to insert this | |
# table into the page at the proper location. | |
Webby::Builder.create( | |
"path/to/blog/entry/entry-name.txt", :from => "templates/blog.erb", | |
:locals => {:title => title, :directory => dir, :table => table}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment