Sha256: f203648a1de4de65a0f025c92c17d5015cf6ac060ab33e09cc9bd630d0077ed6
Contents?: true
Size: 844 Bytes
Versions: 3
Compression:
Stored size: 844 Bytes
Contents
# coding: utf-8 require 'pathname' require 'date' require 'json' require 'time' module WriteDown module Model # 代表单个页面 class Page < Base def render template_file = File.expand_path('../../erb/page.erb', __FILE__) template = File.read(template_file) html_string = ERB.new(template).result(binding) end def build Layout.new(self, @target_file).render self end # 概览 def summary @meta['summary'] end # 标题 def title @meta['title'] end # 生成的链接 def url if @draft "posts/drafts/#{@base_name}/index.html" else "posts/#{@base_name}/index.html" end end def link_to "posts/#{@base_name}/" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
write_down-0.2.2 | lib/write_down/model/page.rb |
write_down-0.2.1 | lib/write_down/model/page.rb |
write_down-0.2.0 | lib/write_down/model/page.rb |