Class: Jekyll::Post
- Inherits:
-
Object
- Object
- Jekyll::Post
- Defined in:
- lib/octopress-multilingual/jekyll.rb
Instance Method Summary collapse
- #crosspost_languages ⇒ Object
- #lang ⇒ Object
- #next ⇒ Object
- #previous ⇒ Object
- #template ⇒ Object
- #template_orig ⇒ Object
- #translated ⇒ Object
- #translations ⇒ Object
- #url_placeholders ⇒ Object
- #url_placeholders_orig ⇒ Object
Instance Method Details
#crosspost_languages ⇒ Object
116 117 118 |
# File 'lib/octopress-multilingual/jekyll.rb', line 116 def crosspost_languages data['lang_crosspost'] end |
#lang ⇒ Object
110 111 112 113 114 |
# File 'lib/octopress-multilingual/jekyll.rb', line 110 def lang if data['lang'] data['lang'].downcase end end |
#next ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/octopress-multilingual/jekyll.rb', line 126 def next language = lang || site.config['lang'] posts = Octopress::Multilingual.posts_by_language(language) pos = posts.index {|post| post.equal?(self) } if pos && pos < posts.length - 1 posts[pos + 1] else nil end end |
#previous ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/octopress-multilingual/jekyll.rb', line 138 def previous language = lang || site.config['lang'] posts = Octopress::Multilingual.posts_by_language(language) pos = posts.index {|post| post.equal?(self) } if pos && pos > 0 posts[pos - 1] else nil end end |
#template ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/octopress-multilingual/jekyll.rb', line 88 def template template = template_orig if self.site.config['lang'] if [:pretty, :none, :date, :ordinal].include? site.permalink_style template = File.join('/:lang', template) end end template end |
#template_orig ⇒ Object
85 |
# File 'lib/octopress-multilingual/jekyll.rb', line 85 alias :template_orig :template |
#translated ⇒ Object
100 101 102 |
# File 'lib/octopress-multilingual/jekyll.rb', line 100 def translated data['translation_id'] && !translations.empty? end |
#translations ⇒ Object
104 105 106 107 108 |
# File 'lib/octopress-multilingual/jekyll.rb', line 104 def translations if data['translation_id'] @translations ||= Octopress::Multilingual.translated_posts[data['translation_id']].reject {|p| p == self} end end |
#url_placeholders ⇒ Object
120 121 122 123 124 |
# File 'lib/octopress-multilingual/jekyll.rb', line 120 def url_placeholders url_placeholders_orig.merge({ :lang => lang }) end |
#url_placeholders_orig ⇒ Object
86 |
# File 'lib/octopress-multilingual/jekyll.rb', line 86 alias :url_placeholders_orig :url_placeholders |