Skip to content
Browse files

Formatted digest email

Added domain and comments links, and reformatted submission data
  • Loading branch information...
1 parent f1f52b8 commit 35087bc1705234cee0bd39df1c876b9218229b11 @rylnd rylnd committed Apr 13, 2012
Showing with 14 additions and 10 deletions.
  1. +8 −6 lib/parse.rb
  2. +6 −4 views/link.haml
View
14 lib/parse.rb
@@ -13,12 +13,14 @@ def parse_feed(doc)
if m[:time_type] =~ /minutes?|hours?/
post_map = {}
- post_map[:full_link] = e.first.xpath("a").to_html
- post_map[:text_link] = e.first.at_xpath("a[@href]").values.first
- post_map[:time_ago] = "#{m[:num_of]} #{m[:time_type]} ago"
- post_map[:points] = m[:points]
- post_map[:comments] = m[:comments] # if m[:comments] != "discuss"
- post_map[:poster] = m[:poster]
+ post_map[:full_link] = e.first.xpath("a").to_html
+ post_map[:text_link] = e.first.at_xpath("a[@href]").values.first
+ post_map[:domain] = e.first.children.children.last.text
+ post_map[:time_ago] = "#{m[:num_of]} #{m[:time_type]} ago"
+ post_map[:points] = m[:points]
+ post_map[:comments_link] = "#{HN_URL}/#{e[1].children[-1].attributes['href'].value}"
+ post_map[:comments] = m[:comments]
+ post_map[:poster] = m[:poster]
scraped_posts << post_map
end
end
View
10 views/link.haml
@@ -1,7 +1,9 @@
%li
= post[:full_link]
+ %span
+ = post[:domain]
%br
- %a{:href => post[:text_link]}
- = post[:text_link]
- %br
- = "by #{post[:poster]}, #{post[:points]}"
+ %span
+ = "#{post[:points]} by #{post[:poster]} | "
+ %span
+ %a{:href => post[:comments_link]}= post[:comments]

0 comments on commit 35087bc

Please sign in to comment.
Something went wrong with that request. Please try again.