jekyll-mahjong 2.0.0 → 2.0.1
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 +4 -4
- data/lib/jekyll-mahjong.rb +5 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be745538403f17b27a1a938774020f8f738792a9e88b4c5cc1c6094f83dc1706
|
4
|
+
data.tar.gz: 95e7ffe8abd43b84a9e4cd26ccae2732fb7b166b6614cd75ee00568d5ac4aeac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12af92282ab7ad553224916d8806d268b901fe930e9a63c119ad09195912c9c6527206c0d6a77393c7769cbd54f9e52c822e82c33cdee92cffbfc1f54b8dda10
|
7
|
+
data.tar.gz: bf41478ad16d8dcdd3c4f2a4e11120639fcf75aaa12fee33ff095637d0f09246a3e68719cb4d0de817dbca35345ab7492e6182558688dbb96d0251110a31e024
|
data/lib/jekyll-mahjong.rb
CHANGED
@@ -5,21 +5,6 @@ module JekyllMahjong
|
|
5
5
|
def initialize(tag_name, input, tokens)
|
6
6
|
super
|
7
7
|
@input = input.strip
|
8
|
-
|
9
|
-
@tile_size = 2
|
10
|
-
@tile_margin_right = -@tile_size * 0.03
|
11
|
-
@group_margin = @tile_size * 0.6
|
12
|
-
end
|
13
|
-
|
14
|
-
def read_config(context)
|
15
|
-
config = context.registers[:site].config
|
16
|
-
|
17
|
-
tile_size = config.dig('jekyll-mahjong', 'tile-size')
|
18
|
-
if !tile_size.nil?
|
19
|
-
@tile_size = tile_size
|
20
|
-
@tile_margin_right = -@tile_size * 0.03
|
21
|
-
@group_margin = @tile_size * 0.5
|
22
|
-
end
|
23
8
|
end
|
24
9
|
|
25
10
|
def render(context)
|
@@ -27,8 +12,6 @@ module JekyllMahjong
|
|
27
12
|
if @input.empty?
|
28
13
|
return ""
|
29
14
|
end
|
30
|
-
# overwrite the defaults with `_config.yml` definitions if they exist
|
31
|
-
read_config(context)
|
32
15
|
|
33
16
|
# get the tile groups: "123p789s 1Z11z" => ["123p789s", "1Z11z"]
|
34
17
|
tile_groups = @input.split(' ')
|
@@ -40,9 +23,12 @@ module JekyllMahjong
|
|
40
23
|
for tile_group in tile_groups[1..-1]
|
41
24
|
svg_group = svg_for_tile_group(tile_group)
|
42
25
|
|
43
|
-
#
|
26
|
+
# add group to the output unless the group is empty
|
44
27
|
unless svg_group.empty?
|
45
|
-
|
28
|
+
# add space between groups unless there is no previous group
|
29
|
+
unless output.empty?
|
30
|
+
output += "<span class='space-between-tile-groups' />"
|
31
|
+
end
|
46
32
|
output += svg_group
|
47
33
|
end
|
48
34
|
end
|