lib/post.rb in runeblog-0.0.81 vs lib/post.rb in runeblog-0.0.82
- old
+ new
@@ -16,26 +16,16 @@
raise "RuneBlog.blog is not set!" if RuneBlog.blog.nil?
@blog = RuneBlog.blog
@title = meta.title
@view = @blog.str2view(view_name)
@num, @slug = make_slug
- date = Time.now.strftime("%Y-%m-%d")
- template = <<-EOS.gsub(/^ */, "")
- .mixin liveblog
-
- .title #@title
- .pubdate #{date}
- .views #@view
-
- .teaser
- #{meta.teaser}
- .end
- #{meta.remainder}
- EOS
-
+ @date = Time.now.strftime("%Y-%m-%d")
+ template = RuneBlog::Default::PostTemplate
+ @meta = meta
+ html = interpolate(template)
@draft = "#{@blog.root}/src/#@slug.lt3"
- File.write(@draft, template)
+ File.write(@draft, html)
end
def edit
result = system("vi #@draft +8")
raise "Problem editing #@draft" unless result
@@ -70,10 +60,10 @@
def create_post_subtree(vdir)
create_dir("assets")
File.write("metadata.yaml", @meta.to_yaml)
File.write("teaser.txt", @meta.teaser)
File.write("remainder.txt", @meta.remainder)
- template = RuneBlog::Default::PostTemplate
+ template = RuneBlog::Default::TeaserTemplate
text = interpolate(template)
File.write("index.html", text)
end
def make_slug(postnum = nil)