Sha256: b740423aef1fc7ea7155a9b2157b64aab9062a4f0d500333e5349bea2f0c6f76

Contents?: true

Size: 850 Bytes

Versions: 6

Compression:

Stored size: 850 Bytes

Contents

# Frozen-string-literal: true
# Encoding: utf-8

module Jekyll
  class LanguagePage < Page
    include LanguageProperties

    alias_method :template_orig, :template
    alias_method :url_placeholders_orig, :url_placeholders

    def template
      return "/:language" + template_orig if !language.nil?
      template_orig
    end

    def url_placeholders
      result = url_placeholders_orig.merge!({
        language: language,
        subset: subset
      })

      if !language.nil? && !subset.nil?
        language_data = @site.languageData || LanguagePlugin::LanguageData.new(@site)

        data = language_data.get(subset, language)

        if !data.nil?
          filtered = data.reject{ |k, v| v.is_a?(Enumerable) }
          result.merge!(Hash[filtered.map{ |k, v| ["t.#{k}", v] }])
        end
      end

      result
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-language-plugin-1.3.5 lib/jekyll/language_page.rb
jekyll-language-plugin-1.3.4 lib/jekyll/language_page.rb
jekyll-language-plugin-1.3.3 lib/jekyll/language_page.rb
jekyll-language-plugin-1.3.2 lib/jekyll/language_page.rb
jekyll-language-plugin-1.3.1 lib/jekyll/language_page.rb
jekyll-language-plugin-1.3.0 lib/jekyll/language_page.rb