jekyll-uj-powertools 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78896ed25c81af20190b917ba4d81c27270d344b30d99c46ec0c00a4f320eb79
4
- data.tar.gz: d25997423dd230dd9aca65dafbbd05404b6ec2a302ba518e8eb17b66aa8a2d0b
3
+ metadata.gz: 1b6d677c7527d35be38d783a4d7e0ae0b75008c509a57536002e32f628e7914e
4
+ data.tar.gz: 6b406248ced940be822db945101183c6e7b558962cec1b5d31bb69e6cb28fc8f
5
5
  SHA512:
6
- metadata.gz: d1fdb5c682a3fb096275083f5f9fc6a8fef7d61f00269b75d1eb8e4483430b5849a050d6f7becdbb69d235911a10557cfaebec08208a9f9c9e257bd386bcb13c
7
- data.tar.gz: 5cd4c5b464644d75dac84f09f49f58dd4939165375624e42ddf8da9da7ed32da058fc794af2dd2e0f4a98a62e3f6a4005dc020e53bd572915dea6ed6b62d967d
6
+ metadata.gz: b548b726718786b5eeaa7d26097a76a3317974d142e91d4f1e8cb9c4c38141ce0f0d3e06d855d500daba03382fe17e269a26f768eb68c7493dbb64ea1ce5cf8c
7
+ data.tar.gz: e0e02c8c8f08bf2504b3c280bb9095178c2f68befbcf4a245ee348575ead8ce5d6c787dd1699f918533589a75960a11d1cb6ee44f77bb4bee9f44811fed2a155
data/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  ## Features
28
28
  * Powerful utility for Jekyll sites
29
- * `remove_ads` filter to remove ads from a string
29
+ * `strip_ads` filter to remove ads from a string
30
30
  * `json_escape` filter to escape JSON characters
31
31
 
32
32
  # Jekyll::uj-powertools
@@ -46,13 +46,13 @@ gem install jekyll-uj-powertools
46
46
  ```
47
47
 
48
48
  ## Usage
49
- Now you can use the `remove_ads` and `json_escape` filters in your Jekyll site:
49
+ Now you can use the `strip_ads` and `json_escape` filters in your Jekyll site:
50
50
 
51
- ### `remove_ads` Filter
51
+ ### `strip_ads` Filter
52
52
  Remove ads from a string, such as a blog post or article.
53
53
 
54
54
  ```liquid
55
- {{ post.content | remove_ads }}
55
+ {{ post.content | strip_ads }}
56
56
  ```
57
57
 
58
58
  ### `json_escape` Filter
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module UJPowertools
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -2,8 +2,9 @@ require "jekyll"
2
2
 
3
3
  module Jekyll
4
4
  module UJPowertools
5
- def remove_ads(input)
6
- input.gsub(/<[^>]*class="uj-vert-unit"[^>]*>.*?<\/[^>]*>/m, '')
5
+ def strip_ads(input)
6
+ # input.gsub(/\{% include \/master\/modules\/adunits[^%]*%\}/, '')
7
+ input.gsub(/<!--\s*ADUNIT_START\s*-->.*?<!--\s*ADUNIT_END\s*-->/m, '')
7
8
  end
8
9
 
9
10
  def json_escape(value)
@@ -8,15 +8,22 @@ RSpec.describe Jekyll::UJPowertools do
8
8
 
9
9
  let(:dummy) { DummyClass.new }
10
10
 
11
- # describe '.remove_ads' do
12
- # it 'removes ads from the string' do
13
- # expect(dummy.remove_ads('This is an ad! Buy now!')).to eq('This is an !')
14
- # end
11
+ describe '.strip_ads' do
12
+ # it 'removes ads from the string' do
13
+ # expect(dummy.strip_ads('{% include /master/modules/adunits/adsense-in-article.html index="0" %} This is content')).to eq(' This is content')
14
+ # end
15
15
 
16
- # it 'returns the original string if no ads are present' do
17
- # expect(dummy.remove_ads('No ads here')).to eq('No ads here')
18
- # end
19
- # end
16
+ # it 'returns the original string if no ads are present' do
17
+ # expect(dummy.strip_ads('No ads here')).to eq('No ads here')
18
+ # end
19
+ it 'removes ads from the string' do
20
+ expect(dummy.remove_ads('This is <!-- ADUNIT_START -->and ad<!-- ADUNIT_END -->')).to eq('This is ')
21
+ end
22
+
23
+ it 'returns the original string if no ads are present' do
24
+ expect(dummy.remove_ads('No ads here')).to eq('No ads here')
25
+ end
26
+ end
20
27
 
21
28
  describe '.json_escape' do
22
29
  it 'escapes double quotes in JSON string' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-uj-powertools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITW Creative Works