jekyll-wns 4.1.3 → 4.2.2

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: f642384eee2481fe29a4e457158baef1269233ad002977eb901905a6de935bb6
4
- data.tar.gz: 768b7e9e1d03418e8ce29db6170ddff5d87d20908716a535a171a7790751a0ea
3
+ metadata.gz: '09a1f012682314531e7d5cd5661958b625185da3a6588fe07ef82af93c975c0d'
4
+ data.tar.gz: 841863d7aa27f0aba8334396cdb8484a395fd3ac8831a4662a485bc38f9b7b29
5
5
  SHA512:
6
- metadata.gz: 250d2367ac3714527f597eab8b3e6e85580276d437d501dbdfc8a43e28a604c590a28d31075d8315379fec41bae72b5a549ce811998765a0d97d2d429e54edcf
7
- data.tar.gz: a71808669a1e27218dc52f354120a93477c0ba0b4215a04d975ecf8b67196ccd7182c82514703cae1d8d2b2b3d1fa8f3b3bdee1b8edf58492bcbb6aab703338d
6
+ metadata.gz: 5cb7c3e18ae6e2d4d84f1accd64d20d79a07ac4e304150f361935c1fbc2fcb85dc1fe95e725a680ca3e6bf198bfcd87e7e49a91d07ab074fa2c24b21cccf4f7e
7
+ data.tar.gz: 42ab60840ecd481be7ffcf52301d85b815bc287ada3c7bd104939027bc7578de041da01a1326a5ad5731a49e303dcdbed97b58d35a2c1d5ca9cd2020bd279774
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 = "4.1.3"
5
+ spec.version = "4.2.2"
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."
@@ -0,0 +1,20 @@
1
+ module WNS
2
+ module LabelPronounciation
3
+
4
+ def self.enabled?(doc)
5
+ wns = doc.site.config["wns"] || {}
6
+ labels = wns["label_pronounciation"] || []
7
+ labels.length > 0
8
+ end
9
+
10
+ def self.label_unicode!(doc)
11
+ if LabelUnicode::enabled?(doc)
12
+ wns = doc.site.config["wns"] || {}
13
+ labels = wns["label_pronounciation"] || false
14
+ for i in (0..(labels.length()) - 1) do
15
+ doc.content = doc.content.gsub(Regexp.new("\b(#{labels[i]["term"]})\b"), "<span aria-label='#{labels[i]["pronounciation"]}'>\\1</span>")
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -11,7 +11,7 @@ module WNS
11
11
  def self.label_unicode!(doc)
12
12
  if LabelUnicode::enabled?(doc)
13
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>")
14
+ doc.content = doc.content.gsub(Regexp.new("(\\S*)#{LabelUnicode::SYMBOLS[i].source}(\\S*)"), "<span aria-label='\\1#{LabelUnicode::READINGS[i]}\\3'>\\1\\2\\3</span>")
15
15
  end
16
16
  end
17
17
  end
@@ -2,6 +2,7 @@ Jekyll::Hooks.register :pages, :pre_render do |document|
2
2
  if document.path =~ /(.md|.html)/
3
3
  WNS::Abbreviations::replace_abbreviations! document
4
4
  WNS::LabelUnicode::label_unicode! document
5
+ WNS::LabelPronounciation::label_unicode! document
5
6
  WNS::Quads::insert_quads_into_document! document
6
7
  end
7
8
  end
@@ -15,6 +16,7 @@ end
15
16
  Jekyll::Hooks.register :posts, :pre_render do |document|
16
17
  WNS::Abbreviations::replace_abbreviations! document
17
18
  WNS::LabelUnicode::label_unicode! document
19
+ WNS::LabelPronounciation::label_unicode! document
18
20
  WNS::Quads::insert_quads_into_document! document
19
21
  end
20
22
 
data/lib/jekyll-wns.rb CHANGED
@@ -3,6 +3,7 @@ require 'jekyll'
3
3
 
4
4
  require_relative 'jekyll-wns/assets/abbreviations'
5
5
  require_relative 'jekyll-wns/assets/label_unicode'
6
+ require_relative 'jekyll-wns/assets/label_pronounciation'
6
7
  require_relative 'jekyll-wns/assets/quads'
7
8
 
8
9
  require_relative 'jekyll-wns/assets/digest_filters'
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.1.3
4
+ version: 4.2.2
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-11-12 00:00:00.000000000 Z
11
+ date: 2022-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-mp3info
@@ -42,6 +42,7 @@ files:
42
42
  - lib/jekyll-wns/assets/abbreviations.rb
43
43
  - lib/jekyll-wns/assets/digest_filters.rb
44
44
  - lib/jekyll-wns/assets/file_property_filters.rb
45
+ - lib/jekyll-wns/assets/label_pronounciation.rb
45
46
  - lib/jekyll-wns/assets/label_unicode.rb
46
47
  - lib/jekyll-wns/assets/quads.rb
47
48
  - lib/jekyll-wns/assets/quads_filter.rb