jekyll-kw-shorten 0.0.3 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab13f3394f9a2ad4069c517486faa22c15d44faa253888b9129c6d39ab763332
4
- data.tar.gz: f693e01e11272c8e09c4091380d05e2ed5f1a5ebddc316f821eed1d3a38382e5
3
+ metadata.gz: bb2cbbc69a7c6412f1a4b27a513beb32a3f660f5277d5d5f33703c67581d5add
4
+ data.tar.gz: dffc3d98ce15f1c6f974bbd66ca547c18ca368ef3caebcd424a7a1a67219a6a9
5
5
  SHA512:
6
- metadata.gz: 276e264b663355a36ce46d4a1a2811bdbc515dc257368fdfd9059b153cb141799b0ae8a229efc801795b6bb579a6ca2de74487a4b6805bed87db851503b1ea6e
7
- data.tar.gz: 46ac47909394ed8c27b9a829c656a9e2986e6f65a3ac8411323a4973ebb0e774d8f76ae3e3bdb07c99b2b31500eeb0ad032511fcba15623378d6964618e0ffd5
6
+ metadata.gz: 4f0e2d28dac1294c1349e39c3d3b7def088a24aae1949a64ae9b418bb14deee5b948abc8ca1edf33357fd6e26fea42d5c1764c6b5ee73c144a8d1075934ca214
7
+ data.tar.gz: 7af4c26d2f71c4fa8566eb44fceaafe0606aac1855f8abc268c178943adb0f17f4261064c63f215f048872640852a03ff0103dbac9c5e3c05411559fb0cef931
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'jekyll/KargWare/Shorten/parser'
4
+ require 'jekyll/KargWare/Shorten/version'
4
5
 
5
6
  module Jekyll
6
7
  module KargWare
@@ -16,22 +17,28 @@ module Jekyll
16
17
  end
17
18
 
18
19
  def render(context)
19
- filter = ShortenFilter.new
20
- filter.shorten(@input)
20
+ parser = Jekyll::KargWare::Shorten::Parser.new(get_plugin_config(context))
21
+ parser.parse(@input)
22
+ end
23
+
24
+ private
25
+
26
+ def get_plugin_config(context)
27
+ context.registers[:site].config[Jekyll::KargWare::Shorten::RUBYGEM_NAME] || {}
21
28
  end
22
29
  end
23
30
 
24
31
  # shorten filter {{ number | shorten }} for Jekyll
25
32
  module ShortenFilter
26
33
  def shorten(number)
27
- parser = Jekyll::KargWare::Shorten::Parser.new(get_site_config)
28
- parser.shorten(number)
34
+ parser = Jekyll::KargWare::Shorten::Parser.new(get_plugin_config)
35
+ parser.parse(number)
29
36
  end
30
37
 
31
38
  private
32
39
 
33
- def get_site_config
34
- @context.registers[:site].config['jekyll-kw-shorten'] || {}
40
+ def get_plugin_config
41
+ @context.registers[:site].config[Jekyll::KargWare::Shorten::RUBYGEM_NAME] || {}
35
42
  end
36
43
  end
37
44
 
@@ -5,7 +5,7 @@ module Jekyll
5
5
  module Shorten
6
6
  # Shorten configuration class
7
7
  class Configuration
8
- attr_accessor :shorten_gt3_digit, :shorten_gt6_digit, :shorten_gt9_digit
8
+ attr_reader :shorten_gt3_digit, :shorten_gt6_digit, :shorten_gt9_digit
9
9
 
10
10
  DEFAULT_CONFIG = {
11
11
  'shorten_gt3_digit' => ' K',
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'jekyll/KargWare/Shorten/configuration'
4
+
3
5
  module Jekyll
4
6
  module KargWare
5
7
  module Shorten
@@ -8,10 +10,10 @@ module Jekyll
8
10
  attr_reader :configuration
9
11
 
10
12
  def initialize(options = {})
11
- @configuration = Configuration.new(options)
13
+ @configuration = Jekyll::KargWare::Shorten::Configuration.new(options)
12
14
  end
13
15
 
14
- def shorten(text)
16
+ def parse(text)
15
17
  if text.is_a? String then
16
18
  return text
17
19
  else
@@ -4,7 +4,7 @@ module Jekyll
4
4
  module KargWare
5
5
  module Shorten
6
6
  RUBYGEM_NAME = 'jekyll-kw-shorten'
7
- VERSION = '0.0.3'
7
+ VERSION = '0.0.8'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-kw-shorten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Karg