jekyll-localization 0.0.4 → 0.0.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  = Revision history for jekyll-localization
2
2
 
3
+ == 0.0.6 [2010-09-29]
4
+
5
+ * Fixed an oversight in the previous version.
6
+
7
+ == 0.0.5 [2010-09-29]
8
+
9
+ * Prevent double posts in pagination.
10
+
3
11
  == 0.0.4 [2010-09-27]
4
12
 
5
13
  * Fixed filter to work with Liquid.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to jekyll-localization version 0.0.4
5
+ This documentation refers to jekyll-localization version 0.0.6
6
6
 
7
7
 
8
8
  == DESCRIPTION
@@ -17,13 +17,14 @@ Then start using Jekyll::Filters#t in your templates, which will extract
17
17
  the target language from the file name (<tt><NAME>.<LANG>.<EXT></tt>,
18
18
  where +LANG+ is supposed to be a two-letter language code). The order
19
19
  of the arguments corresponds to the order of the languages defined in
20
- Localization::LANGUAGES (e.g., +en+, +de+, +fr+):
20
+ Jekyll::Localization::LANGUAGES (e.g., +en+, +de+, +fr+):
21
21
 
22
- Some <%= t 'translated', 'übersetzter' %> text.
22
+ Some <%= t 'translated', 'übersetzter' %> text. (ERb-style)
23
+ Some {{ 'translated' | t: 'übersetzter' }} text. (Liquid-style)
23
24
 
24
- You can modify Jekyll::LANGUAGES to add languages or change their order.
25
- The first one is the default language and will be used when a translation
26
- is missing (+fr+ in this example).
25
+ You can modify Jekyll::Localization::LANGUAGES to add languages or change
26
+ their order. The first one is the default language and will be used when a
27
+ translation is missing (+fr+ in this example).
27
28
 
28
29
 
29
30
  == LINKS
@@ -6,7 +6,7 @@ module Jekyll
6
6
 
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 4
9
+ TINY = 6
10
10
 
11
11
  class << self
12
12
 
@@ -45,6 +45,8 @@ module Jekyll
45
45
 
46
46
  module LocalizedConvertible
47
47
 
48
+ attr_reader :lang
49
+
48
50
  def self.included(base)
49
51
  base.class_eval {
50
52
  alias_method :initialize_without_localization, :initialize
@@ -147,6 +149,22 @@ module Jekyll
147
149
 
148
150
  end
149
151
 
152
+ class Pagination < Generator
153
+
154
+ alias_method :_localization_original_paginate, :paginate
155
+
156
+ # Overwrites the original method to prevent double posts.
157
+ def paginate(site, page)
158
+ all_posts, lang = site.posts.dup, page.lang
159
+ site.posts.delete_if { |post| post.lang != lang } if lang
160
+
161
+ _localization_original_paginate(site, page)
162
+ ensure
163
+ site.posts.replace(all_posts) if all_posts && lang
164
+ end
165
+
166
+ end
167
+
150
168
  module Filters
151
169
 
152
170
  def lang
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-localization
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jens Wille
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-27 00:00:00 +02:00
19
+ date: 2010-09-29 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency