jekyll-uj-powertools 1.0.0
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 +7 -0
- data/Gemfile +10 -0
- data/LICENSE +22 -0
- data/README.md +87 -0
- data/Rakefile +4 -0
- data/jekyll-uj-powertools.gemspec +37 -0
- data/lib/jekyll-uj-powertools/version.rb +5 -0
- data/lib/jekyll-uj-powertools.rb +15 -0
- data/spec/jekyll-uj-powertools_spec.rb +30 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e90145bcdbad261602234c4de838d92f316eeb59f96c89cba223d655014a51fc
|
4
|
+
data.tar.gz: 73a8176daa5ad5e4706349949e31ef6fe7fabd69547d731a6652f43cfb5ce56c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d6d53038e009eb6f1a3fcd0172a093c2f4e4fca9d203b598dba5a4242fac20f7afe22456813a22f7894b7c0be85822a1ac3e9ec0371a4e66c38520b8c16ad1d5
|
7
|
+
data.tar.gz: c1d437bb20f57ba35823a2209139de711687113303d61810363bbbbc3697a6c98c5531cc1300375235f344e54ccb51fe85d07f3f7f98b8edbf0af0e12ecfe5b4
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 ITW Creative Works
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/logo/itw-creative-works-brandmark-black-x.svg">
|
3
|
+
<img src="https://cdn.itwcreativeworks.com/assets/itw-creative-works/images/logo/itw-creative-works-brandmark-black-x.svg" width="100px">
|
4
|
+
</a>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<p align="center">
|
8
|
+
<img src="https://img.shields.io/gem/v/jekyll-uj-powertools">
|
9
|
+
<br>
|
10
|
+
<!-- <img src="https://img.shields.io/librariesio/release/npm/jekyll-uj-powertools.svg"> -->
|
11
|
+
<img src="https://img.shields.io/github/repo-size/itw-creative-works/jekyll-uj-powertools">
|
12
|
+
<img src="https://img.shields.io/codeclimate/maintainability-percentage/itw-creative-works/jekyll-uj-powertools.svg">
|
13
|
+
<img src="https://img.shields.io/gem/dt/jekyll-uj-powertools">
|
14
|
+
<!-- <img src="https://img.shields.io/node/v/jekyll-uj-powertools.svg"> -->
|
15
|
+
<img src="https://img.shields.io/website/https/itwcreativeworks.com.svg">
|
16
|
+
<img src="https://img.shields.io/github/license/itw-creative-works/jekyll-uj-powertools.svg">
|
17
|
+
<img src="https://img.shields.io/github/contributors/itw-creative-works/jekyll-uj-powertools.svg">
|
18
|
+
<img src="https://img.shields.io/github/last-commit/itw-creative-works/jekyll-uj-powertools.svg">
|
19
|
+
<br>
|
20
|
+
<br>
|
21
|
+
<a href="https://itwcreativeworks.com">Site</a> | <a href="https://www.npmjs.com/package/jekyll-uj-powertools">NPM Module</a> | <a href="https://github.com/itw-creative-works/jekyll-uj-powertools">GitHub Repo</a>
|
22
|
+
<br>
|
23
|
+
<br>
|
24
|
+
Meet <strong>jekyll-uj-powertools</strong>, your new best friend for developing with <a href="https://github.com/itw-creative-works/ultimate-jekyll">Ultimate jekyll</a>
|
25
|
+
</p>
|
26
|
+
|
27
|
+
## Features
|
28
|
+
* Powerful utility for Jekyll sites
|
29
|
+
* `remove_ads` filter to remove ads from a string
|
30
|
+
* `json_escape` filter to escape JSON characters
|
31
|
+
|
32
|
+
# Jekyll::uj-powertools
|
33
|
+
Meet `jekyll-uj-powertools`, the powerful set of utilities for Jekyll users.
|
34
|
+
|
35
|
+
It includes functions to remove ads from strings and escape JSON characters, making your Jekyll site cleaner and more efficient.
|
36
|
+
|
37
|
+
## Installation
|
38
|
+
Install the gem and add to the application's Gemfile by executing:
|
39
|
+
```shell
|
40
|
+
bundle add jekyll-uj-powertools
|
41
|
+
```
|
42
|
+
|
43
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
44
|
+
```shell
|
45
|
+
gem install jekyll-uj-powertools
|
46
|
+
```
|
47
|
+
|
48
|
+
## Usage
|
49
|
+
Now you can use the `remove_ads` and `json_escape` filters in your Jekyll site:
|
50
|
+
|
51
|
+
### `remove_ads` Filter
|
52
|
+
Remove ads from a string, such as a blog post or article.
|
53
|
+
|
54
|
+
```liquid
|
55
|
+
{{ post.content | remove_ads }}
|
56
|
+
```
|
57
|
+
|
58
|
+
### `json_escape` Filter
|
59
|
+
Escape JSON characters in a string making it safe to use in a JSON object.
|
60
|
+
|
61
|
+
```liquid
|
62
|
+
{{ post.content | json_escape }}
|
63
|
+
```
|
64
|
+
|
65
|
+
These examples show how you can use the features of `jekyll-uj-powertools` in your Jekyll site.
|
66
|
+
|
67
|
+
## Development
|
68
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
|
70
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
71
|
+
|
72
|
+
### Building and pushing
|
73
|
+
Run the tests
|
74
|
+
```shell
|
75
|
+
bundle install
|
76
|
+
bundle exec rspec
|
77
|
+
```
|
78
|
+
|
79
|
+
Publish the Gem
|
80
|
+
```shell
|
81
|
+
gem build jekyll-uj-powertools.gemspec
|
82
|
+
|
83
|
+
gem push jekyll-uj-powertools-1.0.0.gem
|
84
|
+
```
|
85
|
+
|
86
|
+
## Contributing
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/itw-creative-works/jekyll-uj-powertools.
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll-uj-powertools/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
# Gem info
|
8
|
+
spec.name = "jekyll-uj-powertools"
|
9
|
+
spec.version = Jekyll::UJPowertools::VERSION
|
10
|
+
|
11
|
+
# Author info
|
12
|
+
spec.authors = ["ITW Creative Works"]
|
13
|
+
spec.email = ["hello@itwcreativeworks.com"]
|
14
|
+
|
15
|
+
# Gem details
|
16
|
+
spec.summary = "A powerful set of utilities for Jekyll"
|
17
|
+
spec.description = "jekyll-uj-powertools provides a powerful set of utilities for Jekyll, including functions to remove ads from strings and escape JSON characters."
|
18
|
+
spec.homepage = "https://github.com/itw-creative-works/jekyll-uj-powertools"
|
19
|
+
spec.license = "MIT"
|
20
|
+
|
21
|
+
# Files
|
22
|
+
spec.files = Dir["CODE_OF_CONDUCT.md", "README*.md", "LICENSE", "Rakefile", "*.gemspec", "Gemfile", "lib/**/*", "spec/**/*"]
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
# Gem requires Jekyll to work
|
28
|
+
spec.add_runtime_dependency "jekyll", ">= 3.0", "< 5.0"
|
29
|
+
|
30
|
+
# Development requires more
|
31
|
+
spec.add_development_dependency "bundler"
|
32
|
+
spec.add_development_dependency "rake"
|
33
|
+
spec.add_development_dependency "rspec"
|
34
|
+
|
35
|
+
# Ruby version
|
36
|
+
spec.required_ruby_version = ">= 2.0.0"
|
37
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module UJPowertools
|
5
|
+
def remove_ads(input)
|
6
|
+
input.gsub(/<[^>]*class="uj-vert-unit"[^>]*>.*?<\/[^>]*>/m, '')
|
7
|
+
end
|
8
|
+
|
9
|
+
def json_escape(value)
|
10
|
+
value.gsub('\\', '\\\\').gsub('"', '\"')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Liquid::Template.register_filter(Jekyll::UJPowertools)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'jekyll-uj-powertools'
|
2
|
+
|
3
|
+
RSpec.describe Jekyll::UJPowertools do
|
4
|
+
# Dummy class to include the filter methods
|
5
|
+
class DummyClass
|
6
|
+
include Jekyll::UJPowertools
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:dummy) { DummyClass.new }
|
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
|
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
|
20
|
+
|
21
|
+
describe '.json_escape' do
|
22
|
+
it 'escapes double quotes in JSON string' do
|
23
|
+
expect(dummy.json_escape('this is a "quote"')).to eq('this is a \"quote\"')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'escapes backslashes in JSON string' do
|
27
|
+
expect(dummy.json_escape('this is a nothing')).to eq('this is a nothing')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-uj-powertools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ITW Creative Works
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-05-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rspec
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
description: jekyll-uj-powertools provides a powerful set of utilities for Jekyll,
|
76
|
+
including functions to remove ads from strings and escape JSON characters.
|
77
|
+
email:
|
78
|
+
- hello@itwcreativeworks.com
|
79
|
+
executables: []
|
80
|
+
extensions: []
|
81
|
+
extra_rdoc_files: []
|
82
|
+
files:
|
83
|
+
- Gemfile
|
84
|
+
- LICENSE
|
85
|
+
- README.md
|
86
|
+
- Rakefile
|
87
|
+
- jekyll-uj-powertools.gemspec
|
88
|
+
- lib/jekyll-uj-powertools.rb
|
89
|
+
- lib/jekyll-uj-powertools/version.rb
|
90
|
+
- spec/jekyll-uj-powertools_spec.rb
|
91
|
+
homepage: https://github.com/itw-creative-works/jekyll-uj-powertools
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.0.0
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubygems_version: 3.2.3
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: A powerful set of utilities for Jekyll
|
114
|
+
test_files:
|
115
|
+
- spec/jekyll-uj-powertools_spec.rb
|