Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

copied over blog tasks and templates from webby blog site template

  • Loading branch information...
commit cad3d76583e7f2379002ef2b5eadbe1fb34d331d 1 parent d25023a
Mike Green mikedamage authored
72 tasks/blog.rake
View
@@ -0,0 +1,72 @@
+
+namespace :blog do
+
+ # iterate over all the files in the "templates/blog" folder and create a
+ # rake task corresponding to each file found
+ FileList["#{Webby.site.template_dir}/blog/*"].each do |template|
+ next unless test(?f, template)
+ name = template.pathmap('%n')
+ next if name =~ %r/^(month|year)$/ # skip month/year blog entries
+
+ desc "Create a new blog #{name}"
+ task name => [:create_year_index, :create_month_index] do |t|
+ page, title, dir = Webby::Builder.new_page_info
+
+ # if no directory was given use the default blog directory (underneath
+ # the content directory)
+ dir = Webby.site.blog_dir if dir.empty?
+ dir = File.join(dir, Time.now.strftime('%Y/%m/%d'))
+
+ page = File.join(dir, File.basename(page))
+ page = Webby::Builder.create(page, :from => template,
+ :locals => {:title => title, :directory => dir})
+ exec(::Webby.editor, page) unless ::Webby.editor.nil?
+ end
+ end # each
+
+ # this task is used to create the year index file (blog/2008/index.txt)
+ task :create_year_index do |t|
+ # parse out information about the page to create
+ _, _, dir = Webby::Builder.new_page_info
+ year = Time.now.strftime '%Y'
+
+ # if no directory was given use the default blog directory (underneath
+ # the content directory)
+ dir = Webby.site.blog_dir if dir.empty?
+ dir = File.join(dir, year)
+
+ # determine the filename and template name
+ fn = File.join(dir, 'index.txt')
+ tmpl = Dir.glob(File.join(Webby.site.template_dir, 'blog/year.*')).first.to_s
+
+ if test(?f, tmpl) and not test(?f, File.join(Webby.site.content_dir, fn))
+ Webby::Builder.create(fn, :from => tmpl,
+ :locals => {:title => year, :directory => dir})
+ end
+ end
+
+ # this task is used to create the month index file (blog/2008/04/index.txt)
+ task :create_month_index do |t|
+ # parse out information about the page to create
+ _, _, dir = Webby::Builder.new_page_info
+ now = Time.now
+ month = now.strftime '%m'
+
+ # if no directory was given use the default blog directory (underneath
+ # the content directory)
+ dir = Webby.site.blog_dir if dir.empty?
+ dir = File.join(dir, now.strftime('%Y/%m'))
+
+ # determine the filename and template name
+ fn = File.join(dir, 'index.txt')
+ tmpl = Dir.glob(File.join(Webby.site.template_dir, 'blog/month.*')).first.to_s
+
+ if test(?f, tmpl) and not test(?f, File.join(Webby.site.content_dir, fn))
+ Webby::Builder.create(fn, :from => tmpl,
+ :locals => {:title => month, :directory => dir})
+ end
+ end
+
+end # namespace :blog
+
+# EOF
18 templates/_sidebar.html
View
@@ -1,18 +0,0 @@
-<div id="sidebar" class="prefix-1 span-7 last">
- <div id="github-commits">
- <h2>Recently on GitHub&hellip;</h2>
- <img src="images/loading_2.gif" width="16" height="16" class="loading" />
- <ul>
- </ul>
- </div>
-
- <div id="delicious-bookmarks">
- <h2>Tasty new bookmarks</h2>
- <img src="images/loading_2.gif" width="16" height="16" class="loading" />
- <ul>
- </ul>
- </div>
- <!-- Del.icio.us badge
- <script type="text/javascript" src="http://feeds.delicious.com/v2/js/networkbadge/mikedamage?showadd&amp;icon=s&amp;name&amp;itemcount&amp;nwcount&amp;fancount"></script>
- -->
-</div>
6 templates/blog/month.erb
View
@@ -0,0 +1,6 @@
+---
+title: <%= title %>
+created_at: <%= Time.now.to_y %>
+filter: erb
+dirty: true
+---
18 templates/blog/post.erb
View
@@ -0,0 +1,18 @@
+---
+title: <%= title %>
+created_at: <%= Time.now.to_y %>
+filter:
+ - erb
+ - textile
+---
+p(title). <%= h(@page.title) %>
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc congue ipsum vestibulum libero. Aenean vitae justo. Nam eget tellus. Etiam convallis, est eu lobortis mattis, lectus tellus tempus felis, a ultricies erat ipsum at metus.
+
+h2. Litora Sociis
+
+Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi et risus. Aliquam nisl. Nulla facilisi. Cras accumsan vestibulum ante. Vestibulum sed tortor. Praesent tempus fringilla elit. Ut elit diam, sagittis in, nonummy in, gravida non, nunc. Ut orci. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam egestas, orci eu imperdiet malesuada, nisl purus fringilla odio, quis commodo est orci vitae justo. Aliquam placerat odio tincidunt nulla. Cras in libero. Aenean rutrum, magna non tristique posuere, erat odio eleifend nisl, non convallis est tortor blandit ligula. Nulla id augue.
+
+bq. Nullam mattis, odio ut tempus facilisis, metus nisl facilisis metus, auctor consectetuer felis ligula nec mauris. Vestibulum odio erat, fermentum at, commodo vitae, ultrices et, urna. Mauris vulputate, mi pulvinar sagittis condimentum, sem nulla aliquam velit, sed imperdiet mi purus eu magna. Nulla varius metus ut eros. Aenean aliquet magna eget orci. Class aptent taciti sociosqu ad litora.
+
+Vivamus euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Suspendisse vel nibh ut turpis dictum sagittis. Aliquam vel velit a elit auctor sollicitudin. Nam vel dui vel neque lacinia pretium. Quisque nunc erat, venenatis id, volutpat ut, scelerisque sed, diam. Mauris ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec mattis. Morbi dignissim sollicitudin libero. Nulla lorem.
6 templates/blog/year.erb
View
@@ -0,0 +1,6 @@
+---
+title: <%= title %>
+created_at: <%= Time.now.to_y %>
+filter: erb
+dirty: true
+---
Please sign in to comment.
Something went wrong with that request. Please try again.