jekyll_icon_list 0.4.0 → 0.5.0
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/README.md +17 -10
- data/lib/jekyll_icon_list.rb +10 -21
- data/lib/jekyll_icon_list/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 646c55e10cdc07ca2648f30a38f84283f54a0106ac50caebbfdb672202ae3a03
|
4
|
+
data.tar.gz: dbfb66532092ff44ba10afe9059683d953152989a84e13cddf1489cc0c6a0dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc866f244d2846fcb9c0699591895b305da662a569079b22fdb031cd83756063d2859060b4b9b1bc77bb573eb70fc136c33c022f67e57ad1e815bab666d3c175
|
7
|
+
data.tar.gz: e2e450f350c7644ded463974b2fc0d99833c756626bd4d7f4722fa19245d9bd4092467264503fb4e9210ca8205eeb742341773c0de81e7a49bfbdb048c39687d
|
data/README.md
CHANGED
@@ -110,27 +110,34 @@ If you set a `url:`, it'll wrap the `<li>` contents in an anchor tag.
|
|
110
110
|
|
111
111
|
### Liquid Variables:
|
112
112
|
|
113
|
-
It will parse liquid variables, as
|
114
|
-
double curly braces, like this: `{{ my_context.my_variable }}`. **If given
|
115
|
-
will attempt to build an item for each word.**
|
113
|
+
It will parse liquid variables, as a space-separated-list. Enclose them in
|
114
|
+
double curly braces, like this: `{{ my_context.my_variable }}`. **If given
|
115
|
+
multiword variables, it will attempt to build an item for each word.**
|
116
116
|
|
117
117
|
Example:
|
118
118
|
|
119
119
|
```
|
120
120
|
---
|
121
|
-
|
121
|
+
categories: skydiving spelunking bouldering
|
122
|
+
---
|
123
|
+
|
124
|
+
|
125
|
+
{% icon_list {{ page.categories }} %}
|
126
|
+
```
|
127
|
+
|
128
|
+
If you use yaml arrays, you must join them into a space-separated
|
129
|
+
string using `| join ' '`:
|
130
|
+
|
131
|
+
```
|
132
|
+
---
|
133
|
+
categories:
|
122
134
|
- skydiving
|
123
135
|
- spelunking
|
124
136
|
- bouldering
|
125
|
-
|
126
|
-
category_string: skydiving spelunking bouldering
|
127
137
|
---
|
128
138
|
|
129
|
-
{% icon_list {{ page.
|
130
|
-
|
131
|
-
{% icon_list {{ page.category_string }} %}
|
139
|
+
{% icon_list {{ page.categories | join ' ' }} %}
|
132
140
|
```
|
133
|
-
(Both icon_list tags will return the same output)
|
134
141
|
|
135
142
|
## Configuration
|
136
143
|
|
data/lib/jekyll_icon_list.rb
CHANGED
@@ -42,15 +42,18 @@ module JekyllIconList
|
|
42
42
|
build_html(all_items_data)
|
43
43
|
end
|
44
44
|
|
45
|
+
private
|
46
|
+
|
45
47
|
def build_settings
|
46
48
|
@attributes = @icon_list_settings['defaults'].dup || {}
|
47
49
|
# {'ul' => 'class="awesome" (...)', (...)}
|
48
50
|
|
49
51
|
# raw_input will look something like this:
|
50
52
|
# 'item1 item2 item3 --ul attribute="value" --(...)'
|
51
|
-
raw_input_array =
|
53
|
+
raw_input_array = liquid_parse(@raw_input).split('--').map do |i|
|
52
54
|
i.strip.split(' ')
|
53
55
|
end
|
56
|
+
|
54
57
|
# [['item1', 'item2', 'item3'], ['ul', 'attr="value', 'value2"'],(...)]
|
55
58
|
|
56
59
|
@item_shortnames = raw_input_array.shift
|
@@ -61,18 +64,8 @@ module JekyllIconList
|
|
61
64
|
# {'ul' => 'attribute="value1 value2 value3"'}
|
62
65
|
end
|
63
66
|
|
64
|
-
|
65
|
-
|
66
|
-
# I mostly stole this method from SVG Inliner. There may be a better way,
|
67
|
-
# but this works well enough.
|
68
|
-
input.scan LIQUID_REGEX do |match|
|
69
|
-
value = lookup_variable(@context, match.first)
|
70
|
-
value = value.join(' ') if value.is_a? Array
|
71
|
-
|
72
|
-
input = input.sub(LIQUID_REGEX, value)
|
73
|
-
end
|
74
|
-
|
75
|
-
input
|
67
|
+
def liquid_parse(input)
|
68
|
+
Liquid::Template.parse(input).render(@context)
|
76
69
|
end
|
77
70
|
|
78
71
|
def build_html(all_items_data)
|
@@ -140,14 +133,10 @@ module JekyllIconList
|
|
140
133
|
end
|
141
134
|
|
142
135
|
def build_svg(icon_filename)
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
'svg',
|
148
|
-
params,
|
149
|
-
@tokens
|
150
|
-
).render(@context)
|
136
|
+
tag = "{% svg #{icon_filename}"
|
137
|
+
tag << ' ' + @attributes['svg'] if @attributes['svg']
|
138
|
+
tag << ' %}'
|
139
|
+
liquid_parse(tag)
|
151
140
|
end
|
152
141
|
|
153
142
|
def build_img(icon_filename)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_icon_list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Buchberger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|