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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb2cbbc69a7c6412f1a4b27a513beb32a3f660f5277d5d5f33703c67581d5add
|
4
|
+
data.tar.gz: dffc3d98ce15f1c6f974bbd66ca547c18ca368ef3caebcd424a7a1a67219a6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f0e2d28dac1294c1349e39c3d3b7def088a24aae1949a64ae9b418bb14deee5b948abc8ca1edf33357fd6e26fea42d5c1764c6b5ee73c144a8d1075934ca214
|
7
|
+
data.tar.gz: 7af4c26d2f71c4fa8566eb44fceaafe0606aac1855f8abc268c178943adb0f17f4261064c63f215f048872640852a03ff0103dbac9c5e3c05411559fb0cef931
|
data/lib/jekyll-kw-shorten.rb
CHANGED
@@ -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
|
-
|
20
|
-
|
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(
|
28
|
-
parser.
|
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
|
34
|
-
@context.registers[:site].config[
|
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
|
-
|
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
|
16
|
+
def parse(text)
|
15
17
|
if text.is_a? String then
|
16
18
|
return text
|
17
19
|
else
|