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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/octopress-multilingual.rb +6 -13
- data/lib/octopress-multilingual/hooks.rb +2 -8
- data/lib/octopress-multilingual/jekyll.rb +27 -1
- data/lib/octopress-multilingual/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 302fae77a236cb4710f11f33a190439faeadffea
|
4
|
+
data.tar.gz: be11a982c1bbf2978e2fb96a951400b19e118819
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 ||=
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
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
|
})
|
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.
|
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
|
11
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-hooks
|