jekyll-localization 0.1.5 → 0.1.6
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.
- data/ChangeLog +4 -0
- data/README +1 -1
- data/lib/jekyll/localization.rb +13 -4
- data/lib/jekyll/localization/version.rb +1 -1
- metadata +3 -3
data/ChangeLog
CHANGED
data/README
CHANGED
data/lib/jekyll/localization.rb
CHANGED
@@ -209,13 +209,22 @@ module Jekyll
|
|
209
209
|
|
210
210
|
module Helpers
|
211
211
|
|
212
|
+
def localized_posts(posts, page, only = false)
|
213
|
+
lang = page.lang
|
214
|
+
lang ? posts.select { |post| post.lang == lang } : only ? nil : posts
|
215
|
+
end
|
216
|
+
|
212
217
|
def localize_posts(site, page)
|
213
|
-
|
214
|
-
|
218
|
+
s = site.respond_to?(:set_payload)
|
219
|
+
|
220
|
+
o = s ? site.get_payload('posts') : site.posts.dup
|
221
|
+
l = localized_posts(o, page, true)
|
222
|
+
|
223
|
+
s ? site.set_payload('posts' => l) : site.posts.replace(l) if l
|
215
224
|
|
216
225
|
yield
|
217
226
|
ensure
|
218
|
-
site.posts.replace(
|
227
|
+
s ? site.set_payload('posts' => o) : site.posts.replace(o) if l
|
219
228
|
end
|
220
229
|
|
221
230
|
end
|
@@ -264,7 +273,7 @@ module Jekyll
|
|
264
273
|
end
|
265
274
|
|
266
275
|
def local_posts
|
267
|
-
|
276
|
+
localized_posts(@site.posts, @page)
|
268
277
|
end
|
269
278
|
|
270
279
|
# call-seq:
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-localization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-05-
|
13
|
+
date: 2012-05-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: jekyll-rendering
|
@@ -54,7 +54,7 @@ rdoc_options:
|
|
54
54
|
- --line-numbers
|
55
55
|
- --all
|
56
56
|
- --title
|
57
|
-
- jekyll-localization Application documentation (v0.1.
|
57
|
+
- jekyll-localization Application documentation (v0.1.6)
|
58
58
|
- --main
|
59
59
|
- README
|
60
60
|
require_paths:
|