Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Issues #41, #52, #60, #62: Adds support for Jekyll 3.1.3, while maint…
Browse files Browse the repository at this point in the history
…aining backwards compatibility with 2.5.3.
  • Loading branch information
Anthony-Gaudino committed May 3, 2016
1 parent d05e6cd commit 1f53982
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions lib/jekyll/multiple/languages/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,30 @@ def read_posts(dir)



##############################################################################
# class PostReader
##############################################################################
class PostReader

if Gem::Version.new(Jekyll::VERSION) >= Gem::Version.new("3.0.0")
alias :read_posts_org :read_posts

#======================================
# read_posts
#======================================
def read_posts(dir)
translate_posts = !site.config['exclude_from_localizations'].include?("_posts")
if dir == '' && translate_posts
read_posts("_i18n/#{site.config['lang']}/")
else
read_posts_org(dir)
end
end
end
end



##############################################################################
# class Page
##############################################################################
Expand Down Expand Up @@ -196,6 +220,36 @@ def populate_categories



##############################################################################
# class Document
##############################################################################
class Document

if Gem::Version.new(Jekyll::VERSION) >= Gem::Version.new("3.0.0")
alias :populate_categories_org :populate_categories

#======================================
# populate_categories
#
# Monkey patched this method to remove unwanted strings
# ("_i18n" and language code) that are prepended to posts categories
# because of how the multilingual posts are arranged in subfolders.
#======================================
def populate_categories
data['categories'].delete("_i18n")
data['categories'].delete(site.config['lang'])

merge_data!({
'categories' => (
Array(data['categories']) + Utils.pluralized_array_from_hash(data, 'category', 'categories')
).map(&:to_s).flatten.uniq
})
end
end
end



#-----------------------------------------------------------------------------
#
# The next classes implements the plugin Liquid Tags and/or Filters
Expand Down

0 comments on commit 1f53982

Please sign in to comment.