jekyll-uj-powertools 1.0.5 → 1.0.7
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 +4 -4
- data/lib/jekyll-uj-powertools/version.rb +1 -1
- data/lib/jekyll-uj-powertools.rb +2 -1
- data/spec/jekyll-uj-powertools_spec.rb +11 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9db7ef2a5b59ca20237faf78d7b55ad7efa383dd792420383fe5dac7b6f043e4
|
4
|
+
data.tar.gz: 66d40c4551b9a0f65b9a95bdf6a193e3383c9ae8c128db0f2a04f41cf659e966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 138078fa39a755f3cc5aae6360106dea7ecbe09f202469d7b805ccc0115944f2d953783252695d5593df8a3f528f47a26d4dbc6c3b52c4854b7e5e50be813dd1
|
7
|
+
data.tar.gz: 71a73c6f9d3281e3d8dfecf458e31f34935e1b337fa3e23c91865f2d4658e5c4a27cd54ff0b86ea7c756f16ec37db0a7e790d06c358b05736ba1bd8eef0dc9e9
|
data/lib/jekyll-uj-powertools.rb
CHANGED
@@ -3,7 +3,8 @@ require "jekyll"
|
|
3
3
|
module Jekyll
|
4
4
|
module UJPowertools
|
5
5
|
def strip_ads(input)
|
6
|
-
input.gsub(/<ad-unit>[\s\S]*?<\/ad-unit>/m, '')
|
6
|
+
# input.gsub(/<ad-unit>[\s\S]*?<\/ad-unit>/m, '')
|
7
|
+
input.gsub(/\s*<ad-unit>[\s\S]*?<\/ad-unit>\s*/m, '')
|
7
8
|
end
|
8
9
|
|
9
10
|
def json_escape(value)
|
@@ -9,19 +9,20 @@ RSpec.describe Jekyll::UJPowertools do
|
|
9
9
|
let(:dummy) { DummyClass.new }
|
10
10
|
|
11
11
|
describe '.strip_ads' do
|
12
|
-
|
13
|
-
|
14
|
-
# end
|
15
|
-
|
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_TRIGGER_START -->and ad<!-- ADUNIT_TRIGGER_END -->')).to eq('This is ')
|
12
|
+
it 'removes ads from the string with custom HTML elements' do
|
13
|
+
expect(dummy.strip_ads('This is <ad-unit>and ad</ad-unit>')).to eq('This is ')
|
21
14
|
end
|
22
15
|
|
23
16
|
it 'returns the original string if no ads are present' do
|
24
|
-
expect(dummy.
|
17
|
+
expect(dummy.strip_ads('No ads here')).to eq('No ads here')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'removes multiple ads from the string' do
|
21
|
+
expect(dummy.strip_ads('First part<ad-unit>ad content</ad-unit>Second part<ad-unit>more ad content</ad-unit>Third part')).to eq('First partSecond partThird part')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes surrounding whitespace' do
|
25
|
+
expect(dummy.strip_ads("Start\n<ad-unit>\n ad content\n</ad-unit>\nEnd")).to eq("Start\nEnd")
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|