Sha256: 3d4637d27e0df64c339ffceb6387955d6d6af6b124c19f8a2b2213235223ff42

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

feed.entry(item, id: "urn:uuid:#{item.guid}", published: item.published_at,
                 url: item.permalink_url) do |entry|
  entry.author do
    entry.name item.author_name
  end

  if item.is_a?(Note)
    truncated_body = truncate(item.html(:body).strip_html,
                              length: 80, separator: " ", omissions: "...")
    entry.title truncated_body, "type" => "html"
  else
    entry.title item.title, "type" => "html"
  end

  if item.is_a?(Article)

    item.tags.each do |tag|
      entry.category "term" => tag.display_name, "scheme" => tag_url(tag.permalink)
    end

    # TODO: Add tests for this
    item.resources.each do |resource|
      link_options = { rel: "enclosure",
                       type: resource.mime,
                       title: item.title,
                       href: this_blog.file_url(resource.upload_url) }
      # The Atom spec disallows files with size=0
      link_options[:length] = resource.size if resource.size > 0
      entry.tag! :link, link_options
    end
  end
  content_html = fetch_html_content_for_feeds(item, this_blog)
  entry.content content_html + item.rss_description, "type" => "html"
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
publify_core-10.0.2 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.5.0 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.4.0 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.3.0 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.2.0 app/views/shared/_atom_item_article.atom.builder
publify_core-10.0.1 app/views/shared/_atom_item_article.atom.builder
publify_core-10.0.0 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.10 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.1.1 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.1.0 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.0.3 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.0.2 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.0.1 app/views/shared/_atom_item_article.atom.builder
HornsAndHooves-publify_core-10.0.0 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.9 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.8 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.7 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.6 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.5 app/views/shared/_atom_item_article.atom.builder
publify_core-9.2.4 app/views/shared/_atom_item_article.atom.builder