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 +4 -2
- data/lib/rfeedreader/version.rb +1 -1
- data/lib/rfeedreader.rb +7 -3
- data/test/test_rfeedreader.rb +4 -0
- data/website/index.html +1 -1
- metadata +2 -2
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
|
data/lib/rfeedreader/version.rb
CHANGED
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
|
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 =
|
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 =
|
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)
|
data/test/test_rfeedreader.rb
CHANGED
@@ -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.
|
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.
|
7
|
-
date: 2007-11-
|
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
|