Skip to content
Browse files

fix edge case of an item title with a newline in it

  • Loading branch information...
1 parent fa9f992 commit c799521fe8688e7acfbd5713b66044101465e6d0 @danchoi committed Feb 23, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/vnews/display.rb
View
6 lib/vnews/display.rb
@@ -65,13 +65,15 @@ def format_long_date(d)
def format_item_summary(i, width)
varwidth = width.to_i - 35
feed_title = col i['feed_title'], varwidth * 0.25
+ raw_title = i['title'].gsub(/[\n\r\t]/,' ')
title = if i['score'] # search result
width = varwidth * 0.75
- "#{col(i['title'], (width - 6))} | #{"%.3s" % i['score']}"
+ "#{col(raw_title, (width - 6))} | #{"%.3s" % i['score']}"
else
- col i['title'], varwidth * 0.75
+ col raw_title, varwidth * 0.75
end
word_count = i['word_count'].to_s.rjust(6)
+
date = format_date(i['pub_date']).rjust(8)
spacer = " " * 20 # to push guid all the way off screen
guid = i['guid']

0 comments on commit c799521

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