jekyll-wns 3.2.0 β 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +1 -1
- data/README.md +77 -2
- data/jekyll-wns.gemspec +1 -1
- data/js/youtube.js +6 -0
- data/lib/jekyll-wns.rb +4 -0
- data/lib/jekyll-wns/assets/abbreviations.rb +15 -6
- data/lib/jekyll-wns/assets/label_unicode.rb +19 -0
- data/lib/jekyll-wns/assets/quads.rb +3 -1
- data/lib/jekyll-wns/assets/ruby_tag.rb +21 -0
- data/lib/jekyll-wns/assets/scene_break_tag.rb +1 -1
- data/lib/jekyll-wns/assets/youtube_tag.rb +30 -0
- data/lib/jekyll-wns/register_hooks.rb +15 -6
- data/lib/jekyll-wns/register_tags.rb +2 -0
- metadata +6 -3
- data/lib/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88c6a307f9dcfa02534630dd00aaa8934a9d53793d3eaee4b44a5e7e349374be
|
4
|
+
data.tar.gz: 70fd68ab8f8cc9c6e387b7067d06680ea01ecd3ac26e55e525c9335e77df2e3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9dfa46f956900df775184338cd195b7fa8c7f1e91dfd0d729024d196d9bf71fe70e5a6dd11d5a1fd917641478ab7d2e804184875319764ec1d21830c3a297d26
|
7
|
+
data.tar.gz: 7a7389c4347905765cf9edcd32848ba86f65c786f6c12a085165f8e416d5c48a280b30fdc64ba91ef8236b773f6cd68629326b5b85ac39c6eb8594ebba95f5ba
|
data/README.md
CHANGED
@@ -4,11 +4,11 @@ A collection of filters, tags and hooks that I use on my pages.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
1.
|
7
|
+
1. Run Μ bundle add jekyll-wns` and
|
8
8
|
2. Add the following to your site's `_config.yml`:
|
9
9
|
|
10
10
|
```yml
|
11
|
-
|
11
|
+
plugins:
|
12
12
|
- jekyll-wns
|
13
13
|
```
|
14
14
|
|
@@ -76,6 +76,62 @@ gems:
|
|
76
76
|
<p style="text-align:center" data-mce-style="text-align:center">πΏπΎπΏπΎπΏπΎπΏπΎ
|
77
77
|
```
|
78
78
|
|
79
|
+
#### Ruby Annotations
|
80
|
+
|
81
|
+
```liquid
|
82
|
+
{% ruby b|t %}
|
83
|
+
|
84
|
+
{% ruby a#b|t#s %}
|
85
|
+
|
86
|
+
{% ruby a#b#c|x#y#z %}
|
87
|
+
```
|
88
|
+
|
89
|
+
```html
|
90
|
+
<p><ruby><span class="rb first last" aria-hidden="true">b</span><rp>(</rp><rt first="" last="">t</rt><rp>)</rp></ruby></p>
|
91
|
+
|
92
|
+
<p><ruby><span class="rb first" aria-hidden="true">a</span><rp>(</rp><rt first="">t</rt><rp>)</rp><span class="rb last" aria-hidden="true">b</span><rp>(</rp><rt last="">s</rt><rp>)</rp></ruby></p>
|
93
|
+
|
94
|
+
<p><ruby><span class="rb first" aria-hidden="true">a</span><rp>(</rp><rt first="">x</rt><rp>)</rp><span class="rb" aria-hidden="true">b</span><rp>(</rp><rt>y</rt><rp>)</rp><span class="rb last" aria-hidden="true">c</span><rp>(</rp><rt last="">z</rt><rp>)</rp></ruby></p>
|
95
|
+
```
|
96
|
+
|
97
|
+
#### YouTube Embed
|
98
|
+
|
99
|
+
The following snippet should be integrated into your site for the tag to properly work:
|
100
|
+
|
101
|
+
```javascript
|
102
|
+
function loadYouTube() {
|
103
|
+
var videos = d.getElementsByClassName('youtube');
|
104
|
+
for (var i = 0; i < videos.length; i++) {
|
105
|
+
videos[i].innerHTML = d.getElementById(videos[i].getAttribute('data-videoid')).innerHTML;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
```
|
109
|
+
|
110
|
+
```liquid
|
111
|
+
{% youtube U6xJfP7-HCc|Base 12 β Numberphile %}
|
112
|
+
```
|
113
|
+
|
114
|
+
```html
|
115
|
+
<div class="youtube" data-videoid="youtube-U6xJfP7-HCc">
|
116
|
+
<a class="btn btn-lg btn-block btn-primary" href="https://youtu.be/U6xJfP7-HCc" target="_blank" rel="noopener">
|
117
|
+
Watch βBase 12 β Numberphileβ on YouTube
|
118
|
+
</a>
|
119
|
+
<a class="btn btn-lg btn-block btn-primary" href="javascript:loadYouTube();">
|
120
|
+
Load YouTube Video (3rd party script)
|
121
|
+
</a>
|
122
|
+
</div>
|
123
|
+
<script id="youtube-U6xJfP7-HCc" type="text/html">
|
124
|
+
<div style='position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;'>
|
125
|
+
<iframe
|
126
|
+
style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'
|
127
|
+
src='https://www.youtube-nocookie.com/embed/U6xJfP7-HCc?rel=0'
|
128
|
+
frameborder='0'
|
129
|
+
allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
|
130
|
+
allowfullscreen></iframe>
|
131
|
+
</div>
|
132
|
+
</script>
|
133
|
+
```
|
134
|
+
|
79
135
|
### Hooks
|
80
136
|
|
81
137
|
#### Automatic replacement of spaces to en quads after each sentence
|
@@ -108,3 +164,22 @@ With `abbreviations: true`:
|
|
108
164
|
```html
|
109
165
|
β¦ tools, e. \g., hammer,β¦
|
110
166
|
```
|
167
|
+
|
168
|
+
### Automatic labelling of Unicode Characters
|
169
|
+
|
170
|
+
Some assistive technologies don't play nice with Unicode character, this should improve thing by adding aria-labels spans to wherever necessary.
|
171
|
+
|
172
|
+
To enable this, add this to your `_config.yml`:
|
173
|
+
|
174
|
+
```yml
|
175
|
+
wns:
|
176
|
+
label_unicode: true
|
177
|
+
```
|
178
|
+
|
179
|
+
```markdown
|
180
|
+
Hyda-β
£
|
181
|
+
```
|
182
|
+
|
183
|
+
```html
|
184
|
+
Hyda-<span aria-label="4">β
£</span>
|
185
|
+
```
|
data/jekyll-wns.gemspec
CHANGED
data/js/youtube.js
ADDED
data/lib/jekyll-wns.rb
CHANGED
@@ -2,12 +2,16 @@ require 'liquid'
|
|
2
2
|
require 'jekyll'
|
3
3
|
|
4
4
|
require_relative 'jekyll-wns/assets/abbreviations'
|
5
|
+
require_relative 'jekyll-wns/assets/label_unicode'
|
5
6
|
require_relative 'jekyll-wns/assets/quads'
|
6
7
|
|
7
8
|
require_relative 'jekyll-wns/assets/digest_filters'
|
8
9
|
require_relative 'jekyll-wns/assets/file_properties_filter'
|
9
10
|
require_relative 'jekyll-wns/assets/quads_filter'
|
11
|
+
|
12
|
+
require_relative 'jekyll-wns/assets/ruby_tag'
|
10
13
|
require_relative 'jekyll-wns/assets/scene_break_tag'
|
14
|
+
require_relative 'jekyll-wns/assets/youtube_tag'
|
11
15
|
|
12
16
|
require_relative 'jekyll-wns/register_filters'
|
13
17
|
require_relative 'jekyll-wns/register_hooks'
|
@@ -1,9 +1,16 @@
|
|
1
1
|
module WNS
|
2
2
|
module Abbreviations
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
INNER_DOTS_EXPRESSION = /([a-zA-Z]\.)([a-zA-Z]\.)([a-zA-Z]\.|)([a-zA-Z]\.|)([a-zA-Z]\.|)(,|) /
|
4
|
+
INNER_DOTS_REPLACEMENT = "\\1 \\2 \\3 \\4 \\5 \\6 "
|
5
|
+
|
6
|
+
TITLE_EXPRESSION = /(Mr|Ms|Mrs|Messrs|Mmes|Msgr|Prof|Rev|Dr|Sr|St|[A-Z][a-z]|[A-Z][a-z][a-z])(\.|\.,|,) /
|
7
|
+
TITLE_REPLACEMENT = "\\1\\2 "
|
8
|
+
|
9
|
+
PREFIX_EXPRESSION = /, ([a-zA-Z]\.&)/
|
10
|
+
PREFIX_REPLACEMENT = ", \\1"
|
11
|
+
|
12
|
+
COLLAPSE_SPACES_EXPRESSION = /( )*( |,)/
|
13
|
+
COLLAPSE_SPACES_REPLACEMENT = "\\2"
|
7
14
|
|
8
15
|
def self.enabled?(doc)
|
9
16
|
wns = doc.site.config["wns"] || {}
|
@@ -12,8 +19,10 @@ module WNS
|
|
12
19
|
|
13
20
|
def self.replace_abbreviations!(doc)
|
14
21
|
if Abbreviations::enabled?(doc)
|
15
|
-
doc.content = doc.content.gsub(Abbreviations::
|
16
|
-
doc.content = doc.content.gsub(Abbreviations::
|
22
|
+
doc.content = doc.content.gsub(Abbreviations::INNER_DOTS_EXPRESSION, Abbreviations::INNER_DOTS_REPLACEMENT)
|
23
|
+
doc.content = doc.content.gsub(Abbreviations::TITLE_EXPRESSION, Abbreviations::TITLE_REPLACEMENT)
|
24
|
+
doc.content = doc.content.gsub(Abbreviations::PREFIX_EXPRESSION, Abbreviations::PREFIX_REPLACEMENT)
|
25
|
+
doc.content = doc.content.gsub(Abbreviations::COLLAPSE_SPACES_EXPRESSION, Abbreviations::COLLAPSE_SPACES_REPLACEMENT)
|
17
26
|
end
|
18
27
|
end
|
19
28
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module WNS
|
2
|
+
module LabelUnicode
|
3
|
+
SYMBOLS = [/(β
)/, /(β
‘)/, /(β
’)/, /(β
£)/, /(β
€)/, /(β
₯)/, /(β
¦)/, /(β
§)/, /(β
¨)/, /(β
©)/]
|
4
|
+
READINGS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
|
5
|
+
|
6
|
+
def self.enabled?(doc)
|
7
|
+
wns = doc.site.config["wns"] || {}
|
8
|
+
wns["label_unicode"] || false
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.label_unicode!(doc)
|
12
|
+
if LabelUnicode::enabled?(doc)
|
13
|
+
for i in (0..(LabelUnicode::SYMBOLS.length()) - 1) do
|
14
|
+
doc.content = doc.content.gsub(Regexp.new("([\\-A-Za-z0-9]*|)#{LabelUnicode::SYMBOLS[i].source}([\\-A-Za-z0-9]*|)"), "<span aria-label='\\1#{LabelUnicode::READINGS[i]}\\3'>\\1\\2\\3</span>")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module WNS
|
2
|
+
class RubyTag < Liquid::Tag
|
3
|
+
def initialize(tag_name, text, tokens)
|
4
|
+
super
|
5
|
+
|
6
|
+
@text = text.strip!.split("|")
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
base = @text[0].split("#")
|
11
|
+
text = @text[1].split("#")
|
12
|
+
output = "<ruby>"
|
13
|
+
i = 0
|
14
|
+
while i < base.length()
|
15
|
+
output += "<span class='rb" + (i == 0 ? " first" : "") + (i == base.length() - 1 ? " last" : "") + "' aria-hidden='true'>#{base[i]}</span><rp>(</rp><rt" + (i == 0 ? " first" : "") + (i == base.length() - 1 ? " last" : "") + ">#{text[i]}</rt><rp>)</rp>"
|
16
|
+
i += 1
|
17
|
+
end
|
18
|
+
output += "</ruby>"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -13,7 +13,7 @@ module WNS
|
|
13
13
|
when "wave"
|
14
14
|
'<p style="text-align:center;letter-spacing:-.13em" data-mce-style="text-align:center;letter-spacing:-.13em">β β‘β β‘β β‘β β‘β β‘β β‘β β‘β β‘β β‘β β‘β β</p>'
|
15
15
|
when "wall"
|
16
|
-
'<p style="text-align:center;letter-spacing:-.2em" data-mce-style="text-align:center;letter-spacing:-.2em"
|
16
|
+
'<p style="text-align:center;letter-spacing:-.2em" data-mce-style="text-align:center;letter-spacing:-.2em">ββββββββββββββββββββ</p>'
|
17
17
|
else
|
18
18
|
'<p style="text-align:center" data-mce-style="text-align:center">πΏπΎπΏπΎπΏπΎπΏπΎπΏπΎπΏπΎπΏπΎπΏ</p>'
|
19
19
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module WNS
|
2
|
+
class YoutubeTag < Liquid::Tag
|
3
|
+
def initialize(tag_name, text, tokens)
|
4
|
+
super
|
5
|
+
@text = text.strip!.split("|")
|
6
|
+
end
|
7
|
+
|
8
|
+
def render(context)
|
9
|
+
"<div class='youtube' data-videoid='youtube-" + @text[0] + "'>
|
10
|
+
<a class='btn btn-lg btn-block btn-primary' href='https://youtu.be/" + @text[0] + "' target='_blank' rel='noopener'>
|
11
|
+
Watch β" + @text[1] + "β on YouTube
|
12
|
+
</a>
|
13
|
+
<a class='btn btn-lg btn-block btn-primary'
|
14
|
+
href='javascript:loadYouTube();'>
|
15
|
+
Load YouTube Video (3rd party script)
|
16
|
+
</a>
|
17
|
+
</div>
|
18
|
+
<script id='youtube-" + @text[0] + "' type='text/html'>
|
19
|
+
<div style='position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;'>
|
20
|
+
<iframe
|
21
|
+
style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'
|
22
|
+
src='https://www.youtube-nocookie.com/embed/" + @text[0] + "?rel=0'
|
23
|
+
frameborder='0'
|
24
|
+
allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
|
25
|
+
allowfullscreen></iframe>
|
26
|
+
</div>
|
27
|
+
</script>"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,14 +1,23 @@
|
|
1
|
-
Jekyll::Hooks.register :
|
2
|
-
|
3
|
-
|
1
|
+
Jekyll::Hooks.register :pages, :pre_render do |document|
|
2
|
+
if document.path =~ /(.md|.html)/
|
3
|
+
WNS::Abbreviations::replace_abbreviations! document
|
4
|
+
WNS::LabelUnicode::label_unicode! document
|
5
|
+
WNS::Quads::insert_quads_into_document! document
|
6
|
+
end
|
4
7
|
end
|
5
8
|
|
6
|
-
Jekyll::Hooks.register :pages, :
|
7
|
-
|
8
|
-
|
9
|
+
Jekyll::Hooks.register :pages, :post_render do |document|
|
10
|
+
if document.path =~ /(.md|.html)/
|
11
|
+
true
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
Jekyll::Hooks.register :posts, :pre_render do |document|
|
12
16
|
WNS::Abbreviations::replace_abbreviations! document
|
17
|
+
WNS::LabelUnicode::label_unicode! document
|
13
18
|
WNS::Quads::insert_quads_into_document! document
|
14
19
|
end
|
20
|
+
|
21
|
+
Jekyll::Hooks.register :posts, :post_render do |document|
|
22
|
+
true
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-wns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thai Chung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -23,14 +23,17 @@ files:
|
|
23
23
|
- LICENSE
|
24
24
|
- README.md
|
25
25
|
- jekyll-wns.gemspec
|
26
|
-
-
|
26
|
+
- js/youtube.js
|
27
27
|
- lib/jekyll-wns.rb
|
28
28
|
- lib/jekyll-wns/assets/abbreviations.rb
|
29
29
|
- lib/jekyll-wns/assets/digest_filters.rb
|
30
30
|
- lib/jekyll-wns/assets/file_properties_filter.rb
|
31
|
+
- lib/jekyll-wns/assets/label_unicode.rb
|
31
32
|
- lib/jekyll-wns/assets/quads.rb
|
32
33
|
- lib/jekyll-wns/assets/quads_filter.rb
|
34
|
+
- lib/jekyll-wns/assets/ruby_tag.rb
|
33
35
|
- lib/jekyll-wns/assets/scene_break_tag.rb
|
36
|
+
- lib/jekyll-wns/assets/youtube_tag.rb
|
34
37
|
- lib/jekyll-wns/register_filters.rb
|
35
38
|
- lib/jekyll-wns/register_hooks.rb
|
36
39
|
- lib/jekyll-wns/register_tags.rb
|
data/lib/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
3.0.1
|