jekyll-cleansing-rite 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +9 -0
- data/README.md +61 -0
- data/lib/jekyll-cleansing-rite/document_ritual.rb +17 -0
- data/lib/jekyll-cleansing-rite/page_ritual.rb +17 -0
- data/lib/jekyll-cleansing-rite/ritual.rb +25 -0
- data/lib/jekyll-cleansing-rite/version.rb +7 -0
- metadata +7 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f798ce5483f40db347c12c524a98eca81b533cd98d8185c7a30cbba129504f4c
|
4
|
+
data.tar.gz: '09a380b37935c11c14517ae4a4e3f6f30f76d941b1f14312e3c4660851c64037'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a2b692c191b663432c5b952d243a26db01f6e634ee15470ce1c9149d485dd51f34c0785d5ec289fe605930e390329cfc111ee0e5669b4d349615265cace4ab
|
7
|
+
data.tar.gz: 4144c677831d4fa177305aed932f864d1dd9c2a4cf5364312e64d468426d2b6eee10df985cc337d7a739269a75210f144247eb713daa2b0fa2ff0e69e1003bd1
|
data/LICENSE.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Released under MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Jamison Griffith.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Praise the Omnissiah!
|
2
|
+
|
3
|
+
Jekyll Cleansing Rite purges heretical voidspace from HTML to appease Jekyll's Machine Spirit.
|
4
|
+
|
5
|
+
## Huh?
|
6
|
+
|
7
|
+
The Cleansing Rite first consists of lighting incense to appease Jekyll's Machine Spirit. Then, when Jekyll is rendering documents and pages, sacred Rituals will be performed to cleanse voidspace-ridden files. Those with arcane mastery of the command prompt may view these rituals if the following incantation is invoked:
|
8
|
+
```
|
9
|
+
$ JEKYLL_LOG_LEVEL='debug' jekyll build
|
10
|
+
```
|
11
|
+
|
12
|
+
## The Following is Considered Great Heresy
|
13
|
+
|
14
|
+
This plugin uses [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier) to format HTML output before its written to a file in Jekyll's render pipeline. It exists because the resulting HTML source code that Jekyll outputs by default is pretty gross:
|
15
|
+
|
16
|
+
### HTML without Cleaning Rite
|
17
|
+
```html
|
18
|
+
<body>
|
19
|
+
<div class="container">
|
20
|
+
<header class="masthead">
|
21
|
+
<h3 class="masthead-title">
|
22
|
+
<a href="/" title="Home">Jamogriff</a>
|
23
|
+
</h3>
|
24
|
+
|
25
|
+
<ul class="nav">
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
<li>
|
30
|
+
<a href="/about/">About</a>
|
31
|
+
</li>
|
32
|
+
|
33
|
+
|
34
|
+
</ul>
|
35
|
+
|
36
|
+
|
37
|
+
</header>
|
38
|
+
```
|
39
|
+
|
40
|
+
### HTML with Cleansing Rite
|
41
|
+
```html
|
42
|
+
<body>
|
43
|
+
<div class="container">
|
44
|
+
<header class="masthead">
|
45
|
+
<h3 class="masthead-title">
|
46
|
+
<a href="/" title="Home">Jamogriff</a>
|
47
|
+
</h3>
|
48
|
+
<ul class="nav">
|
49
|
+
<li>
|
50
|
+
<a href="/about/">About</a>
|
51
|
+
</li>
|
52
|
+
</ul>
|
53
|
+
</header>
|
54
|
+
```
|
55
|
+
|
56
|
+
## Available as a Gem
|
57
|
+
Just add the following to your Jekyll site's `_config.yml`:
|
58
|
+
```yaml
|
59
|
+
plugins:
|
60
|
+
- jekyll-cleansing-rite
|
61
|
+
```
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module CleansingRite
|
3
|
+
class DocumentRitual < Ritual
|
4
|
+
|
5
|
+
def initialize(logger)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def perform(doc)
|
10
|
+
@logger.debug('Cleansing Spirit:', doc.relative_path)
|
11
|
+
doc.output = self.cleanse(doc.output)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module CleansingRite
|
3
|
+
class PageRitual < Ritual
|
4
|
+
|
5
|
+
def initialize(logger)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def perform(page)
|
10
|
+
@logger.debug('Cleansing Spirit:', page.name)
|
11
|
+
page.output = self.cleanse(page.output)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'htmlbeautifier'
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
module CleansingRite
|
5
|
+
class Ritual
|
6
|
+
attr_reader :logger
|
7
|
+
|
8
|
+
def initialize(logger)
|
9
|
+
@logger = logger
|
10
|
+
@logger.debug("Invocation:", "#{self.class.name.split('::').last} has been instantiated")
|
11
|
+
end
|
12
|
+
|
13
|
+
def perform(file)
|
14
|
+
raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def cleanse(uncleansed_html)
|
20
|
+
HtmlBeautifier.beautify(uncleansed_html)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-cleansing-rite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamison Griffith
|
@@ -65,7 +65,13 @@ executables: []
|
|
65
65
|
extensions: []
|
66
66
|
extra_rdoc_files: []
|
67
67
|
files:
|
68
|
+
- LICENSE.md
|
69
|
+
- README.md
|
68
70
|
- lib/jekyll-cleansing-rite.rb
|
71
|
+
- lib/jekyll-cleansing-rite/document_ritual.rb
|
72
|
+
- lib/jekyll-cleansing-rite/page_ritual.rb
|
73
|
+
- lib/jekyll-cleansing-rite/ritual.rb
|
74
|
+
- lib/jekyll-cleansing-rite/version.rb
|
69
75
|
homepage: https://github.com/jamogriff/jekyll-cleansing-rite
|
70
76
|
licenses:
|
71
77
|
- MIT
|