Sha256: 7d7ab5e26089c94dfbb13b2537ef3ef17ad0982cfe27f5b1acff8b3d4f3643c3

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module XmlHelper
  def pub_date(time)
    time.rfc822
  end

  def post_title(post)
    h(post.title)
  end

  def item_link(item)
    item.location(nil, false)
  end

  alias_method :post_link,      :item_link
  alias_method :comment_link,   :item_link
  alias_method :trackback_link, :item_link

  def blog_title
    this_blog.blog_name || "Unnamed blog"
  end
  
  def tag_link(tag)
    url_for :controller => "articles", :action => 'tag', :id => tag.name, :only_path => false
  end

  def collection_lastmod(collection)
    article_updated = collection.articles.find(:first, :order => 'updated_at DESC')
    article_published = collection.articles.find(:first, :order => 'published_at DESC')

    times = []
    times.push article_updated.updated_at if article_updated
    times.push article_published.updated_at if article_published

    if times.empty?
      Time.at(0).xmlschema
    else
      times.max.xmlschema
    end
  end

  def category_link(category)
    url_for :controller => "articles", :action => 'category', :id => category.permalink, :only_path => false
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
typo-3.99.3 app/helpers/xml_helper.rb
typo-4.0.1 app/helpers/xml_helper.rb
typo-3.99.4 app/helpers/xml_helper.rb
typo-4.0.0 app/helpers/xml_helper.rb