Sha256: a1a5674ad2f7a8c100438326a7e35781aa1c797362de18bd8f68eb31af365eb8
Contents?: true
Size: 776 Bytes
Versions: 1
Compression:
Stored size: 776 Bytes
Contents
module WriteDown class Template #替换模板变量 def self.render dist, articles #套入模板 index_file_content = File.open(File.expand_path(dist+"/index.html")).read post_file_content = File.open(File.expand_path(dist+"/post.html")).read index_html = Mustache.render(index_file_content, :articles => articles, :site => $site) #TODO should sort by some column? ret_fs = File.open(dist+"/index.html", "w") ret_fs.puts index_html ret_fs.close articles.each do |article| article_html = Mustache.render(post_file_content, :site => $site, :articles => articles) article_fs = File.open(dist+"/"+article.link, "w") article_fs.puts article_html article_fs.close end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
write_down-0.0.5 | lib/write_down/template.rb |