feedtools 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/CHANGELOG +11 -0
  2. data/lib/feed_tools.rb +2496 -810
  3. data/lib/feed_tools/vendor/builder.rb +2 -0
  4. data/lib/feed_tools/vendor/builder/blankslate.rb +2 -0
  5. data/lib/feed_tools/vendor/builder/xmlbase.rb +2 -1
  6. data/lib/feed_tools/vendor/builder/xmlevents.rb +2 -0
  7. data/lib/feed_tools/vendor/builder/xmlmarkup.rb +4 -2
  8. data/lib/feed_tools/vendor/htree.rb +97 -0
  9. data/lib/feed_tools/vendor/htree/container.rb +10 -0
  10. data/lib/feed_tools/vendor/htree/context.rb +67 -0
  11. data/lib/feed_tools/vendor/htree/display.rb +27 -0
  12. data/lib/feed_tools/vendor/htree/doc.rb +149 -0
  13. data/lib/feed_tools/vendor/htree/elem.rb +262 -0
  14. data/lib/feed_tools/vendor/htree/encoder.rb +163 -0
  15. data/lib/feed_tools/vendor/htree/equality.rb +218 -0
  16. data/lib/feed_tools/vendor/htree/extract_text.rb +37 -0
  17. data/lib/feed_tools/vendor/htree/fstr.rb +33 -0
  18. data/lib/feed_tools/vendor/htree/gencode.rb +97 -0
  19. data/lib/feed_tools/vendor/htree/htmlinfo.rb +672 -0
  20. data/lib/feed_tools/vendor/htree/inspect.rb +108 -0
  21. data/lib/feed_tools/vendor/htree/leaf.rb +94 -0
  22. data/lib/feed_tools/vendor/htree/loc.rb +367 -0
  23. data/lib/feed_tools/vendor/htree/modules.rb +48 -0
  24. data/lib/feed_tools/vendor/htree/name.rb +124 -0
  25. data/lib/feed_tools/vendor/htree/output.rb +207 -0
  26. data/lib/feed_tools/vendor/htree/parse.rb +407 -0
  27. data/lib/feed_tools/vendor/htree/raw_string.rb +124 -0
  28. data/lib/feed_tools/vendor/htree/regexp-util.rb +15 -0
  29. data/lib/feed_tools/vendor/htree/rexml.rb +130 -0
  30. data/lib/feed_tools/vendor/htree/scan.rb +166 -0
  31. data/lib/feed_tools/vendor/htree/tag.rb +111 -0
  32. data/lib/feed_tools/vendor/htree/template.rb +909 -0
  33. data/lib/feed_tools/vendor/htree/text.rb +115 -0
  34. data/lib/feed_tools/vendor/htree/traverse.rb +465 -0
  35. data/rakefile +1 -1
  36. data/test/rss_test.rb +97 -0
  37. metadata +30 -1
data/rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/gempackagetask'
7
7
  require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_NAME = 'feedtools'
10
- PKG_VERSION = '0.1.0'
10
+ PKG_VERSION = '0.2.0'
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
 
13
13
  RELEASE_NAME = "REL #{PKG_VERSION}"
@@ -0,0 +1,97 @@
1
+ require 'test/unit'
2
+ require 'feed_tools'
3
+
4
+ # testing is done with the cache turned off
5
+ FeedTools.feed_cache = nil
6
+
7
+ class RssTest < Test::Unit::TestCase
8
+ def setup
9
+ end
10
+
11
+ def test_title
12
+ feed = FeedTools::Feed.open(
13
+ 'http://feedparser.org/tests/wellformed/rss/channel_title.xml')
14
+ assert_equal("Example feed", feed.title)
15
+ feed = FeedTools::Feed.open(
16
+ 'http://feedparser.org/tests/wellformed/rss/channel_title_apos.xml')
17
+ assert_equal("Mark's title", feed.title)
18
+ feed = FeedTools::Feed.open(
19
+ 'http://feedparser.org/tests/wellformed/rss/channel_title_gt.xml')
20
+ assert_equal("2 > 1", feed.title)
21
+ feed = FeedTools::Feed.open(
22
+ 'http://feedparser.org/tests/wellformed/rss/channel_title_lt.xml')
23
+ assert_equal("1 < 2", feed.title)
24
+ end
25
+
26
+ def test_description
27
+ feed = FeedTools::Feed.open(
28
+ 'http://feedparser.org/tests/wellformed/rss/channel_description.xml')
29
+ assert_equal("Example description", feed.description)
30
+ feed = FeedTools::Feed.open(
31
+ 'http://feedparser.org/tests/wellformed/rss/' +
32
+ 'channel_description_escaped_markup.xml')
33
+ assert_equal("<p>Example description</p>", feed.description)
34
+ feed = FeedTools::Feed.open(
35
+ 'http://feedparser.org/tests/wellformed/rss/' +
36
+ 'channel_description_map_tagline.xml')
37
+ assert_equal("Example description", feed.tagline)
38
+ feed = FeedTools::Feed.open(
39
+ 'http://feedparser.org/tests/wellformed/rss/' +
40
+ 'channel_description_naked_markup.xml')
41
+ assert_equal("<p>Example description</p>", feed.description)
42
+ feed = FeedTools::Feed.open(
43
+ 'http://feedparser.org/tests/wellformed/rss/' +
44
+ 'channel_description_shorttag.xml')
45
+ assert_equal(nil, feed.description)
46
+ assert_equal('http://example.com/', feed.link)
47
+ end
48
+
49
+ def test_ttl
50
+ feed = FeedTools::Feed.open(
51
+ 'http://feedparser.org/tests/wellformed/rss/channel_ttl.xml')
52
+ assert_equal(1.hour, feed.ttl)
53
+ end
54
+
55
+ def test_item_content
56
+ feed = FeedTools::Feed.open(
57
+ 'http://feedparser.org/tests/wellformed/rss/item_content_encoded.xml')
58
+ assert_equal('<p>Example content</p>', feed.entries.first.content)
59
+ end
60
+
61
+ def test_item_description
62
+ feed = FeedTools::Feed.open(
63
+ 'http://feedparser.org/tests/wellformed/rss/item_description.xml')
64
+ assert_equal('Example description', feed.entries.first.description)
65
+ feed = FeedTools::Feed.open(
66
+ 'http://feedparser.org/tests/wellformed/rss/' +
67
+ 'item_description_escaped_markup.xml')
68
+ assert_equal('<p>Example description</p>', feed.entries.first.description)
69
+ feed = FeedTools::Feed.open(
70
+ 'http://feedparser.org/tests/wellformed/rss/' +
71
+ 'item_description_map_summary.xml')
72
+ assert_equal('Example description', feed.entries.first.description)
73
+ feed = FeedTools::Feed.open(
74
+ 'http://feedparser.org/tests/wellformed/rss/' +
75
+ 'item_description_naked_markup.xml')
76
+ assert_equal('<p>Example description</p>', feed.entries.first.description)
77
+ feed = FeedTools::Feed.open(
78
+ 'http://feedparser.org/tests/wellformed/rss/' +
79
+ 'item_description_not_a_doctype.xml')
80
+ assert_equal('&lt;!\' <a href=\'foo\'/>', feed.entries.first.description)
81
+ end
82
+
83
+ def test_item_guid
84
+ feed = FeedTools::Feed.open(
85
+ 'http://feedparser.org/tests/wellformed/rss/item_guid.xml')
86
+ assert_equal('http://guid.example.com/', feed.entries.first.guid)
87
+ feed = FeedTools::Feed.open(
88
+ 'http://feedparser.org/tests/wellformed/rss/' +
89
+ 'item_guid_conflict_link.xml')
90
+ assert_equal('http://guid.example.com/', feed.entries.first.guid)
91
+ assert_equal('http://link.example.com/', feed.entries.first.link)
92
+ feed = FeedTools::Feed.open(
93
+ 'http://feedparser.org/tests/wellformed/rss/item_guid_guidislink.xml')
94
+ assert_equal('http://guid.example.com/', feed.entries.first.guid)
95
+ assert_equal('http://guid.example.com/', feed.entries.first.link)
96
+ end
97
+ end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: feedtools
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
6
+ version: 0.2.0
7
7
  date: 2005-07-30
8
8
  summary: "Parsing, generation, and caching system for xml news feeds."
9
9
  require_paths:
@@ -36,10 +36,39 @@ files:
36
36
  - lib/feed_tools/vendor
37
37
  - lib/feed_tools/vendor/builder
38
38
  - lib/feed_tools/vendor/builder.rb
39
+ - lib/feed_tools/vendor/htree
40
+ - lib/feed_tools/vendor/htree.rb
39
41
  - lib/feed_tools/vendor/builder/blankslate.rb
40
42
  - lib/feed_tools/vendor/builder/xmlbase.rb
41
43
  - lib/feed_tools/vendor/builder/xmlevents.rb
42
44
  - lib/feed_tools/vendor/builder/xmlmarkup.rb
45
+ - lib/feed_tools/vendor/htree/container.rb
46
+ - lib/feed_tools/vendor/htree/context.rb
47
+ - lib/feed_tools/vendor/htree/display.rb
48
+ - lib/feed_tools/vendor/htree/doc.rb
49
+ - lib/feed_tools/vendor/htree/elem.rb
50
+ - lib/feed_tools/vendor/htree/encoder.rb
51
+ - lib/feed_tools/vendor/htree/equality.rb
52
+ - lib/feed_tools/vendor/htree/extract_text.rb
53
+ - lib/feed_tools/vendor/htree/fstr.rb
54
+ - lib/feed_tools/vendor/htree/gencode.rb
55
+ - lib/feed_tools/vendor/htree/htmlinfo.rb
56
+ - lib/feed_tools/vendor/htree/inspect.rb
57
+ - lib/feed_tools/vendor/htree/leaf.rb
58
+ - lib/feed_tools/vendor/htree/loc.rb
59
+ - lib/feed_tools/vendor/htree/modules.rb
60
+ - lib/feed_tools/vendor/htree/name.rb
61
+ - lib/feed_tools/vendor/htree/output.rb
62
+ - lib/feed_tools/vendor/htree/parse.rb
63
+ - lib/feed_tools/vendor/htree/raw_string.rb
64
+ - lib/feed_tools/vendor/htree/regexp-util.rb
65
+ - lib/feed_tools/vendor/htree/rexml.rb
66
+ - lib/feed_tools/vendor/htree/scan.rb
67
+ - lib/feed_tools/vendor/htree/tag.rb
68
+ - lib/feed_tools/vendor/htree/template.rb
69
+ - lib/feed_tools/vendor/htree/text.rb
70
+ - lib/feed_tools/vendor/htree/traverse.rb
71
+ - test/rss_test.rb
43
72
  test_files: []
44
73
  rdoc_options:
45
74
  - "--main"