jekyll_icon_list 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -8
- data/lib/jekyll_icon_list.rb +6 -4
- 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: 294f5dc753151d6747ad2bcef2a8f22093778670afa2e22f79694eef6e0cf5cd
|
4
|
+
data.tar.gz: 7e7581912633dcd57786f1cf8154c7b02d99ce84b72ee569d6991777dfc65de9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e79caf7c62ec1785166e32564cebac56de016d72552420b73fb44f0f4e02537efe79f7a5412b38b327d8122fa683824637c47d0301b0a6311a93ce0537342cf
|
7
|
+
data.tar.gz: 755ab786b160630bf38271396d9ea0bafb8abc207b785ed62ebf81130ae71e05179de815a06da04c651d7911022dda56e2fe898f9bf8ff843fa616597de24109
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# Jekyll Icon List
|
2
2
|
|
3
|
-
**This plugin, though simple, is not thoroughly tested. Use with caution, and please report bugs if
|
4
|
-
you find them.**
|
5
|
-
|
6
3
|
## What is it?
|
7
4
|
|
8
5
|
It's a jekyll tag that lets you build unordered lists of items that follow the "Icon + label"
|
@@ -55,7 +52,8 @@ plugins:
|
|
55
52
|
|
56
53
|
By default, with no configuration:
|
57
54
|
|
58
|
-
* It will look for icons in images/icons/ with the same name as your shortname, grabbing the first
|
55
|
+
* It will look for icons in images/icons/ with the same name as your shortname, grabbing the first
|
56
|
+
result which matches (shortname).*
|
59
57
|
|
60
58
|
* It will take your shortname, swap dashes and underscores for spaces, and titleize it for the label.
|
61
59
|
|
@@ -80,7 +78,9 @@ Which will generate markup like this:
|
|
80
78
|
|
81
79
|
Available arguments:
|
82
80
|
`--ul, --li, --img, --svg, --a`
|
83
|
-
|
81
|
+
|
82
|
+
**These will overwrite any global defaults you have set.** You can use this to prevent application
|
83
|
+
of the defaults, just pass an empty argument.
|
84
84
|
|
85
85
|
## Less Basic Usage
|
86
86
|
If the default filenames and labels don't work for you, create:
|
@@ -107,7 +107,7 @@ If you set a `url:`, it'll wrap the `<li>` contents in an anchor tag.
|
|
107
107
|
## Configuration
|
108
108
|
|
109
109
|
* All of icon_list's configuration is under the `icon_list:` key in \_config.yml
|
110
|
-
* `default_path:` - Where to find your icons
|
110
|
+
* `default_path:` - Where to find your icons.
|
111
111
|
* `defaults:` - Optional HTML attributes to include with your markup. They will be ignored if
|
112
112
|
a corresponding --(element) argument is passed in the tag.
|
113
113
|
|
@@ -117,7 +117,7 @@ Here's an example configuration:
|
|
117
117
|
# _config.yml
|
118
118
|
|
119
119
|
icon_list:
|
120
|
-
default_path: images/here/
|
120
|
+
default_path: /images/here/
|
121
121
|
defaults:
|
122
122
|
ul: class="icon-list"
|
123
123
|
li: class="icon-list-item"
|
@@ -141,7 +141,7 @@ It tries to be smart about finding your icons. Here's the decision matrix:
|
|
141
141
|
item icon set | default_path + icon | icon
|
142
142
|
item icon not set | search default_path | search /images/icons
|
143
143
|
|
144
|
-
When it searches a path, it just
|
144
|
+
When it searches a path, it just uses the first match and raises an exception if there aren't
|
145
145
|
any.
|
146
146
|
|
147
147
|
### Accessibility
|
data/lib/jekyll_icon_list.rb
CHANGED
@@ -31,12 +31,12 @@ module JekyllIconList
|
|
31
31
|
|
32
32
|
all_items_data = site_settings.data['icon_list'] || {}
|
33
33
|
|
34
|
-
|
34
|
+
build_settings
|
35
35
|
|
36
36
|
build_html(all_items_data)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def build_settings
|
40
40
|
# raw_input will look something like this:
|
41
41
|
# 'item1 item2 item3 --ul attribute="value" --(...)'
|
42
42
|
|
@@ -82,8 +82,10 @@ module JekyllIconList
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def search_path(path, item)
|
85
|
-
#
|
86
|
-
|
85
|
+
# If there is a leading slash, we have to strip it for Dir to know it's
|
86
|
+
# relative:
|
87
|
+
search_path = path[0] == '/' ? path[1..-1] : path
|
88
|
+
search_results = Dir.glob(search_path + item + '.*')
|
87
89
|
raise "No icon found at #{path + item} .*" unless search_results.any?
|
88
90
|
|
89
91
|
# And put it back so that pages outside of the root directory keep working
|
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.3.
|
4
|
+
version: 0.3.1
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|