jekyll-wns 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/gem-push.yml +43 -0
- data/.gitignore +4 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +110 -0
- data/jekyll-wns.gemspec +13 -0
- data/lib/.ruby-version +1 -0
- data/lib/jekyll-wns.rb +14 -0
- data/lib/jekyll-wns/assets/abbreviations.rb +20 -0
- data/lib/jekyll-wns/assets/digest_filters.rb +36 -0
- data/lib/jekyll-wns/assets/file_properties_filter.rb +7 -0
- data/lib/jekyll-wns/assets/quads.rb +18 -0
- data/lib/jekyll-wns/assets/quads_filter.rb +7 -0
- data/lib/jekyll-wns/assets/scene_break_tag.rb +24 -0
- data/lib/jekyll-wns/register_filters.rb +3 -0
- data/lib/jekyll-wns/register_hooks.rb +11 -0
- data/lib/jekyll-wns/register_tags.rb +1 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2fb3df193ce350ac996fb965a707f559129757461ab977c79fac36d3bb93c65d
|
4
|
+
data.tar.gz: 674a53eb066831f36a133492d5603b1f2fd3536de775bab6059b4e32083b0e45
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a919817f3c9f3f7fc8655f8e6cf1e3cd85f6b37219fef19ee5805fb2716ea1e9ffe7e3f7cbbdd3e40ac3fc90ac8c2756dd162e81680da1eb51e67117db469130
|
7
|
+
data.tar.gz: ec283dbe5c4dee47b38412edb829d112404ce2ac9286a9cc80019e9591f549c151fde25747f2f4ae26f32c19c94a1c29e519a43193013661f3dbabab226ed4f1
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags: "*"
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby 2.6
|
18
|
+
uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.6.x
|
21
|
+
|
22
|
+
- name: Publish to GPR
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
30
|
+
env:
|
31
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
32
|
+
OWNER: ${{ github.repository_owner }}
|
33
|
+
|
34
|
+
- name: Publish to RubyGems
|
35
|
+
run: |
|
36
|
+
mkdir -p $HOME/.gem
|
37
|
+
touch $HOME/.gem/credentials
|
38
|
+
chmod 0600 $HOME/.gem/credentials
|
39
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
40
|
+
gem build *.gemspec
|
41
|
+
gem push *.gem
|
42
|
+
env:
|
43
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Thai “0xReki” Chung
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# jekyll-wns
|
2
|
+
|
3
|
+
A collection of filters, tags and hooks that I use on my pages.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
1. Add `gem "jekyll-wns", git: "https://github.com/0xReki/jekyll-wns.git, branch: "main"` to your site's Gemfile and run `bundle`
|
8
|
+
2. Add the following to your site's `_config.yml`:
|
9
|
+
|
10
|
+
```yml
|
11
|
+
gems:
|
12
|
+
- jekyll-wns
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
### Filters
|
18
|
+
|
19
|
+
#### Checksums
|
20
|
+
|
21
|
+
```liquid
|
22
|
+
{{ site.content | sha384_64 }}
|
23
|
+
```
|
24
|
+
|
25
|
+
```liquid
|
26
|
+
{{ site.content | sha384 }}
|
27
|
+
```
|
28
|
+
|
29
|
+
```liquid
|
30
|
+
{{ site.content | sha256_64 }}
|
31
|
+
```
|
32
|
+
|
33
|
+
```liquid
|
34
|
+
{{ site.content | sha256 }}
|
35
|
+
```
|
36
|
+
|
37
|
+
#### File Size
|
38
|
+
|
39
|
+
```liquid
|
40
|
+
{{ site.content | file_size }}
|
41
|
+
```
|
42
|
+
|
43
|
+
### Tags
|
44
|
+
|
45
|
+
#### Scene Breaks
|
46
|
+
|
47
|
+
```liquid
|
48
|
+
{% scene_break leaves %}
|
49
|
+
```
|
50
|
+
|
51
|
+
```html
|
52
|
+
<p style="text-align:center" data-mce-style="text-align:center">🙐 🙑 🙓 🙒 🙐 🙑 🙓 🙒 🙐 🙑 🙓 🙒</p>
|
53
|
+
```
|
54
|
+
|
55
|
+
```liquid
|
56
|
+
{% scene_break wave %}
|
57
|
+
```
|
58
|
+
|
59
|
+
```html
|
60
|
+
<p style="text-align:center;letter-spacing:-.13em" data-mce-style="text-align:center;letter-spacing:-.13em">◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠</p>
|
61
|
+
```
|
62
|
+
|
63
|
+
```liquid
|
64
|
+
{% scene_break wall %}
|
65
|
+
```
|
66
|
+
|
67
|
+
```html
|
68
|
+
<p style="text-align:center;letter-spacing:-.2em" data-mce-style="text-align:center;letter-spacing:-.2em">⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎</p>
|
69
|
+
```
|
70
|
+
|
71
|
+
```liquid
|
72
|
+
{% scene_break %}
|
73
|
+
```
|
74
|
+
|
75
|
+
```html
|
76
|
+
<p style="text-align:center" data-mce-style="text-align:center">🙿🙾🙿🙾🙿🙾🙿🙾
|
77
|
+
```
|
78
|
+
|
79
|
+
### Hooks
|
80
|
+
|
81
|
+
#### Automatic replacement of spaces to en quads after each sentence
|
82
|
+
|
83
|
+
Assuming your files are each sentence in their own line,
|
84
|
+
just add this to your `_config.yml`:
|
85
|
+
|
86
|
+
```yml
|
87
|
+
wns:
|
88
|
+
quads: true
|
89
|
+
```
|
90
|
+
|
91
|
+
#### Automatic typographic handling of abbreviations
|
92
|
+
|
93
|
+
Just omit the space between the letters and use normal spaces, then add this to your `_config.yml`:
|
94
|
+
|
95
|
+
```yml
|
96
|
+
wns:
|
97
|
+
abbrevations: true
|
98
|
+
```
|
99
|
+
|
100
|
+
##### Example
|
101
|
+
|
102
|
+
```html
|
103
|
+
… tools, e.g., hammer,…
|
104
|
+
```
|
105
|
+
|
106
|
+
With `abbreviations: true`:
|
107
|
+
|
108
|
+
```html
|
109
|
+
… tools, e. \g., hammer,…
|
110
|
+
```
|
data/jekyll-wns.gemspec
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "jekyll-wns"
|
5
|
+
spec.version = "3.1.4"
|
6
|
+
spec.authors = ["Thai Chung"]
|
7
|
+
spec.email = ["mail@0xReki.de"]
|
8
|
+
spec.summary = "Collection of Filters, Tags and Hooks I use."
|
9
|
+
spec.homepage = "https://github.com/0xReki/jekyll-wns"
|
10
|
+
spec.licenses = "MIT"
|
11
|
+
|
12
|
+
spec.files = `git ls-files -z`.split("\x0")
|
13
|
+
end
|
data/lib/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.1
|
data/lib/jekyll-wns.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'liquid'
|
2
|
+
require 'jekyll'
|
3
|
+
|
4
|
+
require_relative 'jekyll-wns/assets/abbreviations'
|
5
|
+
require_relative 'jekyll-wns/assets/quads'
|
6
|
+
|
7
|
+
require_relative 'jekyll-wns/assets/digest_filters'
|
8
|
+
require_relative 'jekyll-wns/assets/file_properties_filter'
|
9
|
+
require_relative 'jekyll-wns/assets/quads_filter'
|
10
|
+
require_relative 'jekyll-wns/assets/scene_break_tag'
|
11
|
+
|
12
|
+
require_relative 'jekyll-wns/register_filters'
|
13
|
+
require_relative 'jekyll-wns/register_hooks'
|
14
|
+
require_relative 'jekyll-wns/register_tags'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module WNS
|
2
|
+
module Abbreviations
|
3
|
+
MAIN_EXPRESSION = /([a-zA-Z])\.([a-zA-Z])\.(,|) /
|
4
|
+
MAIN_REPLACEMENT = "\\1. \\2.\\3 "
|
5
|
+
CLEANUP_EXPRESSION = /, ([a-zA-Z]\.&)/
|
6
|
+
CLEANUP_REPLACEMENT = ", \\1"
|
7
|
+
|
8
|
+
def enabled?(doc)
|
9
|
+
wns = doc.site.config["wns"] || {}
|
10
|
+
wns["abbreviations"] || false
|
11
|
+
end
|
12
|
+
|
13
|
+
def replace_abbreviations!(doc)
|
14
|
+
if Abbreviations::enabled?(doc)
|
15
|
+
doc.content = doc.content.gsub(Abbreviations::MAIN_EXPRESSION, Abbreviations::MAIN_REPLACEMENT)
|
16
|
+
doc.content = doc.content.gsub(Abbreviations::CLEANUP_EXPRESSION, Abbreviations::CLEANUP_REPLACEMENT)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'digest/sha2'
|
2
|
+
module WNS
|
3
|
+
module DigestFilters
|
4
|
+
def sha256_64(input)
|
5
|
+
unless input.nil?
|
6
|
+
Digest::SHA256.base64digest input
|
7
|
+
else
|
8
|
+
""
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def sha384_64(input)
|
13
|
+
unless input.nil?
|
14
|
+
Digest::SHA384.base64digest input
|
15
|
+
else
|
16
|
+
""
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def sha256(input)
|
21
|
+
unless input.nil?
|
22
|
+
Digest::SHA256.hexdigest input
|
23
|
+
else
|
24
|
+
""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def sha384(input)
|
29
|
+
unless input.nil?
|
30
|
+
Digest::SHA384.hexdigest input
|
31
|
+
else
|
32
|
+
""
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module WNS
|
2
|
+
module Quads
|
3
|
+
MAIN_EXPRESSION = /([\.!?‽”“…])(\r|)\n(?![\n\-\/]|http|>\n)/
|
4
|
+
MAIN_REPLACEMENT = "\\1 "
|
5
|
+
CLEANUP_EXPRESSION = / ( |> )*/
|
6
|
+
CLEANUP_REPLACEMENT = " "
|
7
|
+
|
8
|
+
def enabled?(doc)
|
9
|
+
wns = doc.site.config["wns"] || {}
|
10
|
+
quads = wns["quads"] || false
|
11
|
+
end
|
12
|
+
|
13
|
+
def quads(input)
|
14
|
+
output = input.gsub(MAIN_EXPRESSION, MAIN_REPLACEMENT)
|
15
|
+
output = output.gsub(CLEANUP_EXPRESSION, CLEANUP_REPLACEMENT)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module WNS
|
2
|
+
class SceneBreakTag < Liquid::Tag
|
3
|
+
def initialize(tag_name, text, tokens)
|
4
|
+
super
|
5
|
+
|
6
|
+
@text = text.strip!
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
case @text
|
11
|
+
when "leaves"
|
12
|
+
'<p style="text-align:center" data-mce-style="text-align:center">🙐 🙑 🙓 🙒 🙐 🙑 🙓 🙒 🙐 🙑 🙓 🙒</p>'
|
13
|
+
when "wave"
|
14
|
+
'<p style="text-align:center;letter-spacing:-.13em" data-mce-style="text-align:center;letter-spacing:-.13em">◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠◡◠</p>'
|
15
|
+
when "wall"
|
16
|
+
'<p style="text-align:center;letter-spacing:-.2em" data-mce-style="text-align:center;letter-spacing:-.2em">⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎⚍⚎</p>'
|
17
|
+
else
|
18
|
+
'<p style="text-align:center" data-mce-style="text-align:center">🙿🙾🙿🙾🙿🙾🙿🙾🙿🙾🙿🙾🙿🙾🙿</p>'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
Jekyll::Hooks.register :documents, :pre_render do |document|
|
2
|
+
WNS::Abbreviations::replace_abbreviations! document
|
3
|
+
end
|
4
|
+
|
5
|
+
Jekyll::Hooks.register :pages, :pre_render do |document|
|
6
|
+
WNS::Abbreviations::replace_abbreviations! document
|
7
|
+
end
|
8
|
+
|
9
|
+
Jekyll::Hooks.register :posts, :pre_render do |document|
|
10
|
+
WNS::Abbreviations::replace_abbreviations! document
|
11
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Liquid::Template.register_tag('scene_break', WNS::SceneBreakTag)
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-wns
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thai Chung
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-06-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- mail@0xReki.de
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".github/workflows/gem-push.yml"
|
21
|
+
- ".gitignore"
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- jekyll-wns.gemspec
|
26
|
+
- lib/.ruby-version
|
27
|
+
- lib/jekyll-wns.rb
|
28
|
+
- lib/jekyll-wns/assets/abbreviations.rb
|
29
|
+
- lib/jekyll-wns/assets/digest_filters.rb
|
30
|
+
- lib/jekyll-wns/assets/file_properties_filter.rb
|
31
|
+
- lib/jekyll-wns/assets/quads.rb
|
32
|
+
- lib/jekyll-wns/assets/quads_filter.rb
|
33
|
+
- lib/jekyll-wns/assets/scene_break_tag.rb
|
34
|
+
- lib/jekyll-wns/register_filters.rb
|
35
|
+
- lib/jekyll-wns/register_hooks.rb
|
36
|
+
- lib/jekyll-wns/register_tags.rb
|
37
|
+
homepage: https://github.com/0xReki/jekyll-wns
|
38
|
+
licenses:
|
39
|
+
- MIT
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubygems_version: 3.0.3.1
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: Collection of Filters, Tags and Hooks I use.
|
60
|
+
test_files: []
|