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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38306cb9f707488c12823384ec74b7930cf88213f85c44dc175127e811c481fd
4
- data.tar.gz: 327780f0d819168bc54b9b71869b4b18a4df0b07316403155d2ec0b445bb5015
3
+ metadata.gz: 212a115bb9534e3bd5fceca3a5c001847da18208413168ece8decb2ac9c498e7
4
+ data.tar.gz: c3db8b878818c05bca17e1d6f63a4eb12142edcef9c1c455adf33d40cd93e603
5
5
  SHA512:
6
- metadata.gz: 3aaba0a6bf99ac328b04d46083dcc3205feb010f60fa07eafdac95d7e2ad7d731eff4061ded3e82955f955019f59787f1e615b7b37c02d4f3914f753b225ed76
7
- data.tar.gz: 2869712897b1038a276af2d06e3d19e45f0ba2e606dc5d735b4834f1abc4b321b23bd3226d7ceda4da978fd17e28dd562a005e7f82f0241ef0bd7ac4ab8423c3
6
+ metadata.gz: 9128ba9e5a683b6e33f18ce991f84ce1149ae8fead9b48f8a67e831d775c481384610ea8c4ca10cadaf7df23ae3c5e72676971930becd55a7912cb1b013c6562
7
+ data.tar.gz: 0314b3fb90e2e49db72182bfa09759dc28105fb4b12d76a8c3ab0dabe20425f91050828316733b6c036a71c5e496edad21bbacf364615115315189d445b06d95
@@ -2,7 +2,7 @@ name: Ruby Gem
2
2
 
3
3
  on:
4
4
  push:
5
- tags: "*"
5
+ tags: "v*"
6
6
 
7
7
  jobs:
8
8
  build:
data/jekyll-wns.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "jekyll-wns"
5
- spec.version = "3.4.0"
5
+ spec.version = "3.5.1"
6
6
  spec.authors = ["Thai Chung"]
7
7
  spec.email = ["mail@0xReki.de"]
8
8
  spec.summary = "Collection of Filters, Tags and Hooks I use."
data/lib/jekyll-wns.rb CHANGED
@@ -2,6 +2,7 @@ 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'
@@ -1,11 +1,16 @@
1
1
  module WNS
2
2
  module Abbreviations
3
- THREE_LETTER_EXPRESSION = /([a-zA-Z])\.([a-zA-Z])\.([a-zA-Z])\.(,|) /
4
- THREE_LETTER_REPLACEMENT = "\\1. \\2. \\3.\\4 "
5
- TWO_LETTER_EXPRESSION = /([a-zA-Z])\.([a-zA-Z])\.(,|) /
6
- TWO_LETTER_REPLACEMENT = "\\1. \\2.\\3 "
7
- CLEANUP_EXPRESSION = /, ([a-zA-Z]\.&)/
8
- CLEANUP_REPLACEMENT = ", \\1"
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::CLEANUP_EXPRESSION, Abbreviations::CLEANUP_REPLACEMENT)
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
@@ -16,7 +16,9 @@ module WNS
16
16
  end
17
17
 
18
18
  def self.insert_quads_into_document!(doc)
19
- doc.content = insert_quads doc.content
19
+ if Quads::enabled?(doc)
20
+ doc.content = insert_quads doc.content
21
+ end
20
22
  end
21
23
  end
22
24
  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
- WNS::Abbreviations::replace_abbreviations! document
8
- WNS::Quads::insert_quads_into_document! document
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.0
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 00:00:00.000000000 Z
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