rfeedreader 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,8 +1,12 @@
1
- == 1.0.9 2007-01-11
1
+ == 1.0.9 2008-03-05
2
+
3
+ * Add: cut long words
4
+
5
+ == 1.0.9 2008-01-11
2
6
 
3
7
  * Solve: remove all html tags
4
8
 
5
- == 1.0.8 2007-01-11
9
+ == 1.0.8 2008-01-11
6
10
 
7
11
  * Add: alias Entry.url for Entry.link
8
12
 
data/lib/rfeedreader.rb CHANGED
@@ -13,6 +13,16 @@ module Rfeedreader
13
13
  module_function
14
14
 
15
15
  class TextyHelper
16
+
17
+ def TextyHelper.split_str(str, len = 10)
18
+ if str !~ /http:\/\//
19
+ fragment = /.{#{len}}/
20
+ str.split(/(\s+)/).map! { |word|
21
+ (/\s/ === word) ? word : word.gsub(fragment, '\0<wbr />')
22
+ }.join
23
+ end
24
+ end
25
+
16
26
  def TextyHelper.clean(text, length)
17
27
  return text if text.empty?
18
28
 
@@ -212,6 +222,7 @@ module Rfeedreader
212
222
 
213
223
  TITLE_LENGTH = 45
214
224
  DESCRIPTION_LENGTH = 250
225
+ WORD_LENGTH = 10
215
226
 
216
227
  def initialize(item, charset)
217
228
  @hpricot_item = item
@@ -256,6 +267,11 @@ module Rfeedreader
256
267
  unless @description.empty?
257
268
  truncate_length = DESCRIPTION_LENGTH
258
269
  truncate_length = Rfeedreader::DESCRIPTION_LENGTH if Rfeedreader.const_defined? "DESCRIPTION_LENGTH"
270
+
271
+
272
+ word_length = WORD_LENGTH
273
+ word_length = Rfeedreader::WORD_LENGTH if Rfeedreader.const_defined? "WORD_LENGTH"
274
+
259
275
  @description = TextyHelper.clean(@description, truncate_length)
260
276
  @description = TextyHelper.convertEncoding(@description, @charset)
261
277
 
@@ -265,6 +281,8 @@ module Rfeedreader
265
281
 
266
282
  @description.gsub!(/((https?):\/\/([^\/]+)\/(\S*))/, '[<a href=\'\1\'>link</a>]')
267
283
  @description.strip!
284
+
285
+ @description = TextyHelper.split_str(@description, word_length)
268
286
  end
269
287
  end
270
288
 
@@ -350,9 +368,10 @@ module Rfeedreader
350
368
  return read_feed(uri, parse_entries=false)
351
369
  end
352
370
 
353
- def set_truncate_length(title = -1, description = -1)
371
+ def set_truncate_length(title = -1, description = -1, word_length = -1)
354
372
  const_set("TITLE_LENGTH", title)
355
373
  const_set("DESCRIPTION_LENGTH", description)
374
+ const_set("WORD_LENGTH", word_length)
356
375
  end
357
376
 
358
377
  def open_doc(link)
@@ -2,7 +2,7 @@ module Rfeedreader #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 9
5
+ TINY = 10
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -228,7 +228,7 @@ class TestRfeedreader < Test::Unit::TestCase
228
228
  end
229
229
 
230
230
  def test_bbvablogs
231
- read_first "http://centroinnovacion.bbvablogs.com/"
231
+ read_first "http://tomasconde.bbvablogs.com/feed/"
232
232
  end
233
233
 
234
234
  def test_ul_list
@@ -238,4 +238,13 @@ class TestRfeedreader < Test::Unit::TestCase
238
238
  def test_strong
239
239
  read_first "http://elbloglamentable.es/feed/"
240
240
  end
241
+
242
+ def test_refresh
243
+ read_first "http://bloc.balearweb.net/rss.php?blogId=1681&profile=rss20"
244
+ end
245
+
246
+ def test_maria
247
+ read_first "http://www.arfues.net/weblog/author/arnauh/feed"
248
+ read_first "http://elsantacrucenio.com/index.php?option=com_rss&feed=rss0.91&no_html=1"
249
+ end
241
250
  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.9</a>
36
+ <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">1.0.10</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
@@ -89,7 +89,7 @@ Rfeedfinder.read('http://blog.alexgirard.com/feed/', nb_posts=3)
89
89
 
90
90
  <p>Comments are welcome. Send an email to <a href="mailto:alx.girard@gmail.com">Alexandre Girard</a>.</p>
91
91
  <p class="coda">
92
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 29th October 2007<br>
92
+ <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 27th February 2008<br>
93
93
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
94
94
  </p>
95
95
  </div>
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.9
7
- date: 2008-01-11 00:00:00 +01:00
6
+ version: 1.0.10
7
+ date: 2008-03-05 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