Sha256: d00f978f78863938774447b201657731b2c82f42f3bf685903d3f828e3af6c3c

Contents?: true

Size: 788 Bytes

Versions: 5

Compression:

Stored size: 788 Bytes

Contents

module Howl
  class Post < Template
    include Comparable

    def date
      view.date? ? Time.parse(view.date.to_s) : File.mtime(path)
    end

    def <=>(other)
      self.date <=> other.date
    end

    def output_path
      site.output_path("posts") + date.strftime("%Y/%m/%d") + output_filename
    end

    def title
      view.title || path.basename(extension).to_s
    end

    def dom_id
      title.slugify
    end

    def link
      "/" + output_path.relative_path_from(site.output_path).to_s
    end

    def rendered_content
      render_view = view.dup
      render_view.delete('template')
      converter.convert(Mustache.render(@content, render_view))
    end

    def view_data
      { :site => site,
        :date => date,
        :link => link }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
howl-0.5.4 lib/howl/post.rb
howl-0.5.3 lib/howl/post.rb
howl-0.5.2 lib/howl/post.rb
howl-0.5.1 lib/howl/post.rb
howl-0.5.0 lib/howl/post.rb