octopress-multilingual 0.1.1 → 0.1.2

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: e53c8c656e02f71a493c1e79cd8765dfbeafc2ae
4
- data.tar.gz: 1aa1a62b8dce6b50647d1a1a646adf64986a8353
3
+ metadata.gz: 302fae77a236cb4710f11f33a190439faeadffea
4
+ data.tar.gz: be11a982c1bbf2978e2fb96a951400b19e118819
5
5
  SHA512:
6
- metadata.gz: cadc57ee19e7ed3f90e57ecd3497720e5fcf0309c0b136bc119852af329d1fccebe2437c4fcd64b216a48464bafe6924d0730cd9b6b3dcff4997ccedbcb79d5b
7
- data.tar.gz: fa6d4745b493a0060fa8eb5708ae4d75457843bdfc6a9a617df546982764217c90f5aacb46d4db5e28a3de81ce4115ea6c57460067d433405827da70a9106c20
6
+ metadata.gz: 17da4fccb7e37da3d0e0176d9c7f9a8d67768330253f116ca6e24ee2e11c40d5c994005cac6aa0dc6c9651b057556e2ea7d983c78885c3cd696f35b1b796b8cf
7
+ data.tar.gz: b105ea8c82961ee6030b7bff45334e0350ab79c5a474ae0b4963c8b4a327e0872c2023f814d0be9e8c7b629beb90f76ee62030d74a1b5314a45af741588c5793
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.1.2 (2015-01-31)
4
+ - Now pages can use the /:lang/ permalink placeholder.
5
+ - New site methods: `posts_by_language`, `articles_by_language`, `linkposts_by_language`, `languages`.
6
+
3
7
  ### 0.1.1 (2015-01-30)
4
8
  - Fix: On pages, `lang: default` now defaults to `site.lang`.
5
9
 
@@ -103,19 +103,12 @@ module Octopress
103
103
  else
104
104
  return unless main_language
105
105
 
106
- @payload ||= begin
107
- payload = {
108
- 'posts_by_language' => posts_by_language,
109
- 'languages' => languages
110
- }
111
-
112
- if defined? Octopress::Linkblog
113
- payload['linkposts_by_language'] = linkposts_by_language
114
- payload['articles_by_language'] = articles_by_language
115
- end
116
-
117
- payload
118
- end
106
+ @payload ||= {
107
+ 'posts_by_language' => posts_by_language,
108
+ 'linkposts_by_language' => linkposts_by_language,
109
+ 'articles_by_language' => articles_by_language,
110
+ 'languages' => languages
111
+ }
119
112
  end
120
113
  end
121
114
  end
@@ -1,19 +1,13 @@
1
1
  module Octopress
2
2
  module Multilingual
3
- class SiteHookRead < Hooks::Site
3
+ class SiteHook < Hooks::Site
4
4
  priority :high
5
5
  # Generate site_payload so other plugins can access
6
6
  def post_read(site)
7
7
  Octopress::Multilingual.site = site
8
+ site.config['languages'] = site.languages
8
9
  end
9
- end
10
-
11
- class SiteHook < Hooks::Site
12
- # Use a low priority so that other hooks can act on posts
13
- # without having to be designed for mutlilingual sites.
14
- priority :high
15
10
 
16
- #
17
11
  def merge_payload(payload, site)
18
12
  { 'site' => Octopress::Multilingual.site_payload }
19
13
  end
@@ -12,6 +12,24 @@ module Jekyll
12
12
  end
13
13
  end
14
14
 
15
+ class Site
16
+ def languages
17
+ Octopress::Multilingual.languages
18
+ end
19
+
20
+ def posts_by_language
21
+ Octopress::Multilingual.posts_by_language
22
+ end
23
+
24
+ def articles_by_language
25
+ Octopress::Multilingual.articles_by_language
26
+ end
27
+
28
+ def linkposts_by_language
29
+ Octopress::Multilingual.linkposts_by_language
30
+ end
31
+ end
32
+
15
33
  class Document
16
34
  def lang
17
35
  if data['lang']
@@ -21,11 +39,20 @@ module Jekyll
21
39
  end
22
40
 
23
41
  class Page
42
+ alias :permalink_orig :permalink
43
+
24
44
  def lang
25
45
  if data['lang']
26
46
  data['lang'].downcase
27
47
  end
28
48
  end
49
+
50
+ def permalink
51
+ if permalink = permalink_orig
52
+ data['permalink'].sub!(/:lang/, lang)
53
+ permalink.sub(/:lang/, lang)
54
+ end
55
+ end
29
56
  end
30
57
 
31
58
  class Post
@@ -57,7 +84,6 @@ module Jekyll
57
84
  end
58
85
 
59
86
  def url_placeholders
60
-
61
87
  url_placeholders_orig.merge({
62
88
  :lang => lang
63
89
  })
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Multilingual
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-multilingual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress-hooks