jekyll-wns 3.4.0 → 3.5.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/jekyll-wns.gemspec +1 -1
- data/lib/jekyll-wns.rb +1 -0
- data/lib/jekyll-wns/assets/abbreviations.rb +13 -7
- data/lib/jekyll-wns/assets/label_unicode.rb +19 -0
- data/lib/jekyll-wns/assets/quads.rb +3 -1
- data/lib/jekyll-wns/register_hooks.rb +6 -7
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 212a115bb9534e3bd5fceca3a5c001847da18208413168ece8decb2ac9c498e7
|
4
|
+
data.tar.gz: c3db8b878818c05bca17e1d6f63a4eb12142edcef9c1c455adf33d40cd93e603
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9128ba9e5a683b6e33f18ce991f84ce1149ae8fead9b48f8a67e831d775c481384610ea8c4ca10cadaf7df23ae3c5e72676971930becd55a7912cb1b013c6562
|
7
|
+
data.tar.gz: 0314b3fb90e2e49db72182bfa09759dc28105fb4b12d76a8c3ab0dabe20425f91050828316733b6c036a71c5e496edad21bbacf364615115315189d445b06d95
|
data/jekyll-wns.gemspec
CHANGED
data/lib/jekyll-wns.rb
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
module WNS
|
2
2
|
module Abbreviations
|
3
|
-
THREE_LETTER_EXPRESSION = /([a-zA-Z])
|
4
|
-
THREE_LETTER_REPLACEMENT = "\\1
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
THREE_LETTER_EXPRESSION = /([a-zA-Z]\.)([a-zA-Z]\.)([a-zA-Z]\.)(,|) /
|
4
|
+
THREE_LETTER_REPLACEMENT = "\\1 \\2 \\3\\4 "
|
5
|
+
|
6
|
+
TWO_LETTER_EXPRESSION = /([a-zA-Z]\.)([a-zA-Z]\.)(,|) /
|
7
|
+
TWO_LETTER_REPLACEMENT = "\\1 \\2\\3 "
|
8
|
+
|
9
|
+
TITLE_EXPRESSION = /(Mr|Ms|Mrs|Messrs|Mmes|Msgr|Prof|Rev|Dr|Sr|St|[A-Z][a-z]|[A-Z][a-z][a-z])(\.|)(,|) /
|
10
|
+
TITLE_REPLACEMENT = "\\1\\2\\3 "
|
11
|
+
|
12
|
+
PREFIX_EXPRESSION = /, ([a-zA-Z]\.&)/
|
13
|
+
PREFIX_REPLACEMENT = ", \\1"
|
9
14
|
|
10
15
|
def self.enabled?(doc)
|
11
16
|
wns = doc.site.config["wns"] || {}
|
@@ -16,7 +21,8 @@ module WNS
|
|
16
21
|
if Abbreviations::enabled?(doc)
|
17
22
|
doc.content = doc.content.gsub(Abbreviations::THREE_LETTER_EXPRESSION, Abbreviations::THREE_LETTER_REPLACEMENT)
|
18
23
|
doc.content = doc.content.gsub(Abbreviations::TWO_LETTER_EXPRESSION, Abbreviations::TWO_LETTER_REPLACEMENT)
|
19
|
-
doc.content = doc.content.gsub(Abbreviations::
|
24
|
+
doc.content = doc.content.gsub(Abbreviations::TITLE_EXPRESSION, Abbreviations::TITLE_REPLACEMENT)
|
25
|
+
doc.content = doc.content.gsub(Abbreviations::PREFIX_EXPRESSION, Abbreviations::PREFIX_REPLACEMENT)
|
20
26
|
end
|
21
27
|
end
|
22
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(LabelUnicode::SYMBOLS[i], "<span aria-label='#{LabelUnicode::READINGS[i]}'>\\1</span>")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,14 +1,13 @@
|
|
1
|
-
Jekyll::Hooks.register :documents, :pre_render do |document|
|
2
|
-
WNS::Abbreviations::replace_abbreviations! document
|
3
|
-
WNS::Quads::insert_quads_into_document! document
|
4
|
-
end
|
5
|
-
|
6
1
|
Jekyll::Hooks.register :pages, :pre_render do |document|
|
7
|
-
|
8
|
-
|
2
|
+
if document.page.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
|
9
7
|
end
|
10
8
|
|
11
9
|
Jekyll::Hooks.register :posts, :pre_render do |document|
|
12
10
|
WNS::Abbreviations::replace_abbreviations! document
|
11
|
+
WNS::LabelUnicode::label_unicode! document
|
13
12
|
WNS::Quads::insert_quads_into_document! document
|
14
13
|
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: 3.
|
4
|
+
version: 3.5.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-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- lib/jekyll-wns/assets/abbreviations.rb
|
30
30
|
- lib/jekyll-wns/assets/digest_filters.rb
|
31
31
|
- lib/jekyll-wns/assets/file_properties_filter.rb
|
32
|
+
- lib/jekyll-wns/assets/label_unicode.rb
|
32
33
|
- lib/jekyll-wns/assets/quads.rb
|
33
34
|
- lib/jekyll-wns/assets/quads_filter.rb
|
34
35
|
- lib/jekyll-wns/assets/ruby_tag.rb
|