Created
February 3, 2011 16:02
-
-
Save dokipen/809678 to your computer and use it in GitHub Desktop.
Template for Atom embed in Kalimba
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _content preview | |
case preview.type | |
when 'image' | |
a.embedly_thumbnail(:href => preview.original_url) do | |
img.thumbnail :src => preview.url, | |
:alt => 'goto article' | |
end | |
when 'video' | |
video.embedly_video :src => preview.url, | |
:controls => "controls", :preload => "preload" | |
when 'audio' | |
audio.embedly_video :src => preview.url, | |
:controls => "controls", :preload => "preload" | |
else | |
if preview.content | |
div.embedly_content do | |
p { preview.content } | |
end | |
else | |
case preview.object.type | |
when 'photo' | |
div.embedly_content do | |
a.embedly_thumbnail( | |
:href => preview.original_url) do | |
img.thumbnail :src => preview.object_url, | |
:alt => 'goto article' | |
end | |
end | |
when 'video', 'rich' | |
div.embedly_content { preview.object['html'] } | |
else | |
div.embedly_content do | |
if preview.images.length != 0 | |
a.embedly_thumbnail_small :target => '_blank', | |
:href => preview.original_url, | |
:title => preview.url do | |
img.thumbnail( | |
:src => preview.images.first['url'], | |
:alt => 'thumbnail') | |
end | |
end | |
p { preview.description } | |
div do | |
if preview.embeds.length > 0 | |
preview.embeds.first['html'] | |
end | |
end | |
end | |
end | |
end | |
end | |
div.clear {} | |
div.provider :style => 'float: right;' do | |
self << 'via ' | |
if preview.favicon_url | |
img.provider_favicon :src => preview.favicon_url, | |
:alt => 'favicon' | |
self << ' ' | |
end | |
a.provider_link preview.provider_name, | |
:href => preview.provider_url | |
end | |
end | |
def _rss_content article, preview | |
div do | |
self << "#{article.points} points by " | |
a article.author, :href => article.author_link | |
self << " | " | |
a "#{article.comment_count} comments", | |
:href => article.comments | |
end | |
hr | |
_content preview | |
div(:style => 'clear: both;') {' '} | |
hr | |
if CONFIG[:tagline] and article.comment_count and | |
article.comment_count > 0 | |
div do | |
div do | |
self << "#{article.top_comment_points} points by " | |
a article.top_comment_author, | |
:href => R(HackerNews, "user", | |
:id => article.top_comment_author) | |
end | |
br | |
div { article.top_comment_content } | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment