jekyll-urls 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll/generators/urls.rb +11 -2
- data/lib/jekyll-urls/version.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d625b0bc6493f4484374f7efc353a61cdd258e1
|
4
|
+
data.tar.gz: 5d67b2fd022a742c91d5e48363b9bf82aaa0ba2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7d0ec917257b0165f3ed6d48714ec27d52bd912def0169fd6baebf45aff49feaad40c0beef4954ca685f3514b2442afb6bf7a885de12ecbb63083c5e4a8fc42
|
7
|
+
data.tar.gz: 17d8a00da0063f92968e64c8db1c3ccb682f0664447c6ac0fdb1adca9deb3df3be7d778e5eed84136566e044c90c8789bd97cc0575d09fbd4e914b12dd6ff8bf
|
@@ -2,10 +2,19 @@ module Jekyll
|
|
2
2
|
module Converters
|
3
3
|
class UrlsGenerator < Generator
|
4
4
|
def generate(site)
|
5
|
-
|
5
|
+
lazy = lambda { |h,k| h[k] = Hash.new(&lazy) }
|
6
|
+
|
7
|
+
def deep_set(hash, value, *keys)
|
8
|
+
keys[0...-1].inject(hash) do |acc, h|
|
9
|
+
acc.public_send(:[], h)
|
10
|
+
end.public_send(:[]=, keys.last, value)
|
11
|
+
end
|
12
|
+
|
13
|
+
site.config['urls'] = Hash.new(&lazy)
|
6
14
|
site.pages.each { |page|
|
7
15
|
if page.data['id']
|
8
|
-
|
16
|
+
keys = page.data['id'].split(".")
|
17
|
+
deep_set(site.config['urls'], page.url, *keys)
|
9
18
|
end
|
10
19
|
}
|
11
20
|
end
|
data/lib/jekyll-urls/version.rb
CHANGED