octopress-multilingual 0.1.3 → 0.1.4

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: 3417d3f633e1f848fa11d4c11bd5f6d034d7ada0
4
- data.tar.gz: 0e3a0f92834a9e1b416dd732912c3759a592ce87
3
+ metadata.gz: b3ae15ba4e42285ca409a3e01dad012bbb35df62
4
+ data.tar.gz: 6bbbd3561ad7f931c11ab9d7020af47e33ac4329
5
5
  SHA512:
6
- metadata.gz: 7c7f1293cb33d3e9fb1b4cc9f9cf6e7614fc9c2d7d3941375b77e529703d7370f50511bd8ad697e8e31f9ae471b73bcc09fefecba0112d9b9bd3be4af5de3f63
7
- data.tar.gz: f93757aee7c7053017d60979024ea141f9d69ec9ed058206857015d80e5534e958ae08649d1845c5a59de5ca0e1d71fe67863445e65888185279895625639034
6
+ metadata.gz: ee9d5706021be85b0cb543dec60807388759ffb7394b74884d73c8e4065f139faff613f0f1d4cca24cc824b2980ecaf6e5b1b7f8856da440abf924f50b8bef40
7
+ data.tar.gz: 21863f42abef3df62dfd7992f9cefb46734cc294e425b92c98004a80a5e076280748a45bae2f93ec354957d5ac3348b05e0cebf75c5f47da086ce005f4af3858
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Changelog
2
2
 
3
- ### 0.1.2 (2015-01-31)
3
+ ### 0.1.4 (2015-02-01)
4
+ - Cross-post languages with `lang_crosspost: true` in a post's YAML front-matter.
5
+
6
+ ### 0.1.3 (2015-01-31)
4
7
  - Fix: 'default' language maps to site.lang.
5
8
  - Fix: Issue with access to site instance.
6
9
 
data/README.md CHANGED
@@ -127,16 +127,16 @@ If you have [octopress-linkblog](https://github.com/octopress/linkblog) installe
127
127
 
128
128
  ### Cross-posting languages
129
129
 
130
- If you would like to write a post which shows up in indexes and feeds for every language, set `lang: all` in your post's YAML
131
- front-matter.
130
+ If you would like to write a post which shows up in indexes and feeds for every language, set `lang_crosspost: true` in your post's YAML front-matter.
132
131
 
133
132
  ```
134
133
  title: "Ein nachdenklicher Beitrag"
135
- lang: all
134
+ lang: de
135
+ lang_crosspost: true
136
136
  ```
137
137
 
138
- This post will show up with every language. However, it will be treated exactly like a post written in your
139
- site's default language and will have one canonical URL. Even `{{ post.lang }}` will return your default language instead of `all`.
138
+ This post will show up with every language. However, it will be treated exactly like a post written in German
139
+ and will have one canonical URL.
140
140
 
141
141
  ### Language in permalinks
142
142
 
@@ -46,7 +46,7 @@ module Octopress
46
46
  end
47
47
 
48
48
  def crossposts
49
- site.posts.select(&:language_crosspost)
49
+ site.posts.select(&:crosspost_languages)
50
50
  end
51
51
 
52
52
  def main_language_posts
@@ -88,16 +88,11 @@ module Octopress
88
88
  end
89
89
 
90
90
  def page_payload(lang)
91
- payload = { 'posts' => posts_by_language[lang] }
92
-
93
- # If the octopress-linkblog plugin is installed swap out articles and linkposts
94
- #
95
- if defined? Octopress::Linkblog
96
- payload['linkposts'] = linkposts_by_language[lang]
97
- payload['articles'] = articles_by_language[lang]
98
- end
99
-
100
- payload
91
+ {
92
+ 'posts' => posts_by_language[lang],
93
+ 'linkposts' => linkposts_by_language[lang],
94
+ 'articles' => articles_by_language[lang]
95
+ }
101
96
  end
102
97
 
103
98
  def site_payload
@@ -72,16 +72,12 @@ module Jekyll
72
72
 
73
73
  def lang
74
74
  if data['lang']
75
- if data['lang'].downcase == 'all'
76
- @language_crosspost = true
77
- data['lang'] = site.config['lang']
78
- end
79
75
  data['lang'].downcase
80
76
  end
81
77
  end
82
78
 
83
- def language_crosspost
84
- @language_crosspost if lang
79
+ def crosspost_languages
80
+ data['lang_crosspost']
85
81
  end
86
82
 
87
83
  def url_placeholders
@@ -34,34 +34,19 @@ module Octopress
34
34
  #
35
35
  def set_lang(lang)
36
36
  @context.environments.first['page']['lang'] = lang
37
- site = @context.environments.first['site']
38
- site['posts'] = site['posts_by_language'][lang]
39
-
40
- if defined? Octopress::Linkblog
41
- site['linkposts'] = site['linkposts_by_language'][lang]
42
- site['articles'] = site['articles_by_language'][lang]
37
+ Multilingual.page_payload(lang).each do |key,value|
38
+ @context.environments.first['site'][key] = value
43
39
  end
44
40
  end
45
41
 
46
42
  def store_state
47
43
  @current_lang = @context['page.lang']
48
- @posts = @context['site.posts']
49
-
50
- if defined? Octopress::Linkblog
51
- @articles = @context['site.articles']
52
- @links = @context['site.linkposts']
53
- end
44
+ @site = @context['site'].clone
54
45
  end
55
46
 
56
47
  def restore_state
57
48
  @context.environments.first['page']['lang'] = @current_lang
58
- site = @context.environments.first['site']
59
- site['posts'] = @posts
60
-
61
- if defined? Octopress::Linkblog
62
- site['linkposts'] = @links
63
- site['articles'] = @articles
64
- end
49
+ @context.environments.first['site'] = @site
65
50
  end
66
51
 
67
52
  def lang
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Multilingual
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-multilingual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis