rfeedreader 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,9 +1,11 @@
1
+ == 1.0.4 2007-11-26
2
+
3
+ * Solved: math error when getting truncation length
4
+
1
5
  == 1.0.3 2007-11-21
2
6
 
3
7
  * Solved: set special feed with other domains than google.com
4
8
 
5
- == 1.0.1 2007-11-14
6
-
7
9
  == 1.0.2 2007-11-14
8
10
 
9
11
  * Add Rfeedreader.set_truncate_length(title = 45, description = 200) to manage tuncation size. No truncation: -1
@@ -2,7 +2,7 @@ module Rfeedreader #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/rfeedreader.rb CHANGED
@@ -32,7 +32,8 @@ module Rfeedreader
32
32
 
33
33
  # Remove size of truncate string
34
34
  # and add space added by html entities
35
- l = length - truncate_string.length + (text.size - text.gsub(/(?:&.[^;]*;)/, " ").size)
35
+ l = length - truncate_string.length
36
+ l += l - text[0...l].gsub(/(?:&.[^;]*;)/, " ").size
36
37
  truncated_text = text[0...l]
37
38
 
38
39
  # Avoid html entity truncation
@@ -207,6 +208,9 @@ module Rfeedreader
207
208
  class Entry
208
209
  attr_accessor :title, :link, :description, :charset, :hpricot_item
209
210
 
211
+ TITLE_LENGTH = 45
212
+ DESCRIPTION_LENGTH = 250
213
+
210
214
  def initialize(item, charset)
211
215
  @hpricot_item = item
212
216
  @charset = charset
@@ -231,7 +235,7 @@ module Rfeedreader
231
235
  preformatted_title.gsub!(/<\!\[CDATA\[/, '')
232
236
  preformatted_title.gsub!(/\]\]>/, '')
233
237
  end
234
- truncate_length = 45
238
+ truncate_length = TITLE_LENGTH
235
239
  truncate_length = Rfeedreader::TITLE_LENGTH if Rfeedreader.const_defined? "TITLE_LENGTH"
236
240
  @title = TextyHelper.convertEncoding(TextyHelper.clean(preformatted_title, truncate_length), @charset)
237
241
  end
@@ -248,7 +252,7 @@ module Rfeedreader
248
252
  end
249
253
 
250
254
  unless @description.empty?
251
- truncate_length = 200
255
+ truncate_length = DESCRIPTION_LENGTH
252
256
  truncate_length = Rfeedreader::DESCRIPTION_LENGTH if Rfeedreader.const_defined? "DESCRIPTION_LENGTH"
253
257
  @description = TextyHelper.clean(@description, truncate_length)
254
258
  @description = TextyHelper.convertEncoding(@description, @charset)
@@ -222,4 +222,8 @@ class TestRfeedreader < Test::Unit::TestCase
222
222
  read_first "http://www.gobmenorca.com/noticies/RSS"
223
223
  #read_first "http://www.liberafolio.org/search_rss?SearchableText=&Title=&Description=&portal_type:list=News+Item&portal_type:list=Link&portal_type:list=Document&Creator=&submit=Search&sort_on=created&sort_order=reverse&review_s"
224
224
  end
225
+
226
+ def test_description_length
227
+ read_first "http://sine-die.blogspot.com/"
228
+ end
225
229
  end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>rfeedreader</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rfeedreader"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">1.0.3</a>
36
+ <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">1.0.4</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rfeedreader
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.3
7
- date: 2007-11-21 00:00:00 +01:00
6
+ version: 1.0.4
7
+ date: 2007-11-26 00:00:00 +01:00
8
8
  summary: Feed parser to read feed and return first posts of this feed. Special parsing from sources like Flickr, Jumcut, Google video, ...
9
9
  require_paths:
10
10
  - lib