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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 070a512f22f4fd8c5972a3f10bfaf6448c48fb1b
4
- data.tar.gz: e2002d20adafd38154f75a6ffe54c7c7dacfea62
3
+ metadata.gz: 9d625b0bc6493f4484374f7efc353a61cdd258e1
4
+ data.tar.gz: 5d67b2fd022a742c91d5e48363b9bf82aaa0ba2c
5
5
  SHA512:
6
- metadata.gz: 387a3b46c0783279b4c6b0a6f2b51dc67a25f39447410cbc4084b894fd87ef93d81e97ba252e9df05b32bf1d926a6190ac3eada9722c8fd57a7bfc2b1437c138
7
- data.tar.gz: e41c6231a883c5031a53af1491bde917fcb98ecee274a350f1f79addadb0f355495f1a84c09ff2d8dd22a914fc6658981609fb78a7250d6f90e993b33113a708
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
- site.config['urls'] = {}
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
- site.config['urls'][page['id']] = page.url
16
+ keys = page.data['id'].split(".")
17
+ deep_set(site.config['urls'], page.url, *keys)
9
18
  end
10
19
  }
11
20
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Urls
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
- end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-urls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkady Zalkowitsch