forked from jglovier/gifs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.gifwit
27 lines (26 loc) · 1016 Bytes
/
library.gifwit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
---
{
"version":1,
"images": [
{% assign delimiter = ' ' %}
{% for image in site.data.static_files %}
{% assign parts_str = '' %}{% assign parts = image.path | split:'/' %}
{% for part in parts %}
{% assign keywords = part | replace:image.extname, '' | downcase | replace:'-', delimiter | replace:'_', delimiter | split:delimiter %}
{% for k in keywords %}
{% assign parts_arr = parts_str | split:delimiter %}
{% unless parts_arr contains k %}
{% assign parts_str = parts_str | append:delimiter | append:k %}
{% endunless %}
{% endfor %}
{% endfor %}
{% assign parts = parts_str | remove_first:delimiter | split:delimiter | sort %}
{% assign path = image.path | uri_escape %}
{
"url": "{{ site.github.url | append: "/" | append: path | json }}",
"keywords": "{% for part in parts %}{{ part }}{% unless forloop.last %} {% endunless %}{% endfor %}"
}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}