feedfilter 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6762d73b936aa611d5cf9a4730526db4b65f2e75
4
- data.tar.gz: 74a852cd7e09c1e430d7885053bfdba6ad4ce8f2
3
+ metadata.gz: c4e6f33ca3e35338b0d1e32d81fda9b4fef4bf18
4
+ data.tar.gz: 89b6850ef5738a0c092d9abb33e976e403dea277
5
5
  SHA512:
6
- metadata.gz: 0fa0eab480a9cfb044467110a4014dd00c82516ceef3fb4671ff3b3e2b49ea4d7ebb256d68f3197cbb4b27281e0cfe38e17f6eda1a361034da65ce7bed627dfe
7
- data.tar.gz: d9b49e7d0add3d4748923bb572e5e8ef3022f859a9aa5d966e9e4210c8f25f5edc2aaa5fb47a33f6a4d3c331f413ae8a27eb6d9840d4ed3b2a0a2db0d78b7bf0
6
+ metadata.gz: 259ab66f191ae4f1ce880d760cdecc2c891b3dfa5e5f47f8f98c37e35b135e71381e2d21d77a6a043ba2a6316405c6fe1dc7faf4c71865dd2221cadcd8eae196
7
+ data.tar.gz: fc9b241d1fe969884fb1a7436e7dd97034858395c29dade025094824dafaba16e06710b7ff9aa6f35b44e4be5bfb8513f4951aff0afe7f614f5a8e15cc970e8c
data/.gemtest ADDED
File without changes
data/README.md CHANGED
@@ -2,16 +2,74 @@
2
2
 
3
3
  * home :: [github.com/feedreader/feed.filter](https://github.com/feedreader/feed.filter)
4
4
  * bugs :: [github.com/feedreader/feed.filter/issues](https://github.com/feedreader/feed.filter/issues)
5
- * gem :: [rubygems.org/gems/feed-filter](https://rubygems.org/gems/feed-filter)
6
- * rdoc :: [rubydoc.info/gems/feed-filter](http://rubydoc.info/gems/feed-filter)
5
+ * gem :: [rubygems.org/gems/feedfilter](https://rubygems.org/gems/feedfilter)
6
+ * rdoc :: [rubydoc.info/gems/feedfilter](http://rubydoc.info/gems/feedfilter)
7
7
  * forum :: [groups.google.com/group/feedreader](http://groups.google.com/group/feedreader)
8
8
 
9
9
 
10
10
 
11
11
  ## Usage
12
12
 
13
- To be done
14
13
 
14
+ ### `strip_ads` in `AdsFilter` module
15
+
16
+ ~~~
17
+ require 'feedfilter'
18
+
19
+ include FeedFilter::AdsFilter # lets us use strip_ads
20
+
21
+
22
+ before_snippet =<<EOS
23
+ <div class="feedflare">
24
+ <a href="http://feeds.feedburner.com/~ff/Rubyflow?a=1wUDnBztAJY:fzqBvTOGB9M:3H-1DwQop_U">
25
+ <img src="http://feeds.feedburner.com/~ff/Rubyflow?i=1wUDnBztAJY:fzqBvTOGB9M:3H-1DwQop_U" border="0"></img>
26
+ </a>
27
+ </div>
28
+ EOS
29
+
30
+
31
+ snippet = strip_ads( before_snippet )
32
+
33
+ puts snippet
34
+ ~~~
35
+
36
+
37
+ ### Use Text Patterns (Regex) for Filters
38
+
39
+ Ads Example:
40
+
41
+ ~~~
42
+ FEEDFLARE_ADS = %r{
43
+ <div[^>]*?
44
+ class=("|')feedflare\1
45
+ [^>]*?>
46
+ .*?
47
+ <\/div>
48
+ }mix
49
+
50
+ FEEDBURNER_BUGS = %r{
51
+ <img[^>]*?
52
+ src=("|')(:?http:)?//feeds\.feedburner\.com/~r/[^>]+?\1
53
+ .*?>
54
+ }mix
55
+
56
+ ...
57
+ ~~~
58
+
59
+ or as one-liners (if you prefer)
60
+
61
+ ~~~
62
+ FEEDFLARE_ADS = %r{<div[^>]*?class=("|')feedflare\1[^>]*?>.*?<\/div>}mi
63
+ FEEDBURNER_BUGS = %r{<img[^>]*?src=("|')(:?http:)?//feeds\.feedburner\.com/~r/[^>]+?\1.*?>}mi
64
+ ...
65
+ ~~~
66
+
67
+
68
+ ## Alternatives
69
+
70
+ Node.js
71
+
72
+ - [node-resanitize](https://github.com/danmactough/node-resanitize)
15
73
 
16
74
 
17
75
  ## License
data/lib/feedfilter.rb CHANGED
@@ -11,6 +11,8 @@ require 'logutils'
11
11
  # our own code
12
12
 
13
13
  require 'feedfilter/version' # let it always go first
14
+ require 'feedfilter/ads'
15
+
14
16
 
15
17
 
16
18
  # say hello
@@ -3,7 +3,7 @@
3
3
  module FeedFilter
4
4
 
5
5
  MAJOR = 0
6
- MINOR = 1
6
+ MINOR = 2
7
7
  PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
data/test/test_ads.rb ADDED
@@ -0,0 +1,29 @@
1
+ ###
2
+ # to run use
3
+ # ruby -I ./lib -I ./test test/test_ads.rb
4
+ # or better
5
+ # rake test
6
+
7
+ require 'helper'
8
+
9
+
10
+ class TestAds < MiniTest::Test
11
+
12
+ include FeedFilter::AdsFilter
13
+
14
+ def test_feedflare_ads
15
+ text = read_snippet( 'feedflare.html' )
16
+ text = strip_ads( text ).strip
17
+
18
+ assert_equal '', text
19
+ end
20
+
21
+ def test_feedburner_bugs
22
+ text = read_snippet( 'feedburner.html' )
23
+ text = strip_ads( text ).strip
24
+
25
+ assert_equal '', text
26
+ end
27
+
28
+
29
+ end # class TestAds
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedfilter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
@@ -61,12 +61,14 @@ extra_rdoc_files:
61
61
  - Manifest.txt
62
62
  - README.md
63
63
  files:
64
+ - ".gemtest"
64
65
  - HISTORY.md
65
66
  - Manifest.txt
66
67
  - README.md
67
68
  - Rakefile
68
69
  - lib/feedfilter.rb
69
70
  - lib/feedfilter/version.rb
71
+ - test/test_ads.rb
70
72
  homepage: https://github.com/feedreader/feed.filter
71
73
  licenses:
72
74
  - Public Domain
@@ -93,4 +95,5 @@ rubygems_version: 2.4.2
93
95
  signing_key:
94
96
  specification_version: 4
95
97
  summary: feedfilter - feed filter and rules for easy (re)use
96
- test_files: []
98
+ test_files:
99
+ - test/test_ads.rb