jekyll-multiple-languages-plugin 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE.txt +251 -78
- data/README.md +197 -59
- data/lib/jekyll-multiple-languages-plugin.rb +445 -0
- data/lib/plugin/version.rb +6 -0
- metadata +33 -39
- data/.gitignore +0 -21
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/example/Gemfile +0 -4
- data/example/LICENSE +0 -21
- data/example/README.md +0 -11
- data/example/_config.yml +0 -8
- data/example/_i18n/en.yml +0 -10
- data/example/_i18n/en/_posts/2013-12-09-example-post.md +0 -15
- data/example/_i18n/en/footer.md +0 -2
- data/example/_i18n/es.yml +0 -10
- data/example/_i18n/es/_posts/2013-12-09-example-post.md +0 -15
- data/example/_i18n/es/footer.md +0 -2
- data/example/_i18n/it.yml +0 -10
- data/example/_i18n/it/_posts/2013-12-09-example-post.md +0 -16
- data/example/_i18n/it/footer.md +0 -2
- data/example/_includes/post.html +0 -40
- data/example/_layouts/default.html +0 -60
- data/example/_layouts/post.html +0 -5
- data/example/_plugins/jekyll-multiple-languages-plugin.rb +0 -1
- data/example/css/main.css +0 -285
- data/example/css/responsive.css +0 -92
- data/example/css/syntax.css +0 -60
- data/example/favicon.ico +0 -0
- data/example/images/cover.jpg +0 -0
- data/example/images/logo.png +0 -0
- data/example/images/sidebar-button.png +0 -0
- data/example/index.html +0 -8
- data/example/scripts/responsive.js +0 -14
- data/jekyll-multiple-languages-plugin.gemspec +0 -23
- data/lib/jekyll/multiple/languages/plugin.rb +0 -208
- data/lib/jekyll/multiple/languages/plugin/version.rb +0 -9
    
        data/example/css/responsive.css
    DELETED
    
    | @@ -1,92 +0,0 @@ | |
| 1 | 
            -
            @media (max-width:1309px) {
         | 
| 2 | 
            -
              #cover-photo {
         | 
| 3 | 
            -
                max-width: 95%;
         | 
| 4 | 
            -
              }
         | 
| 5 | 
            -
             | 
| 6 | 
            -
              .header {
         | 
| 7 | 
            -
                padding-top: 3.45em;
         | 
| 8 | 
            -
              }
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              .posts {
         | 
| 11 | 
            -
                font-size: 0.9em;
         | 
| 12 | 
            -
              }
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              .footer {
         | 
| 15 | 
            -
                font-size: 0.85em;
         | 
| 16 | 
            -
              }
         | 
| 17 | 
            -
            }
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            @media (max-width:1090px) {
         | 
| 20 | 
            -
              #logo {
         | 
| 21 | 
            -
                max-width: 100px;
         | 
| 22 | 
            -
              }
         | 
| 23 | 
            -
             | 
| 24 | 
            -
              #title {
         | 
| 25 | 
            -
                font-size: 3em;
         | 
| 26 | 
            -
              }
         | 
| 27 | 
            -
             | 
| 28 | 
            -
              .header {
         | 
| 29 | 
            -
                padding-top: 3.85em;
         | 
| 30 | 
            -
              }
         | 
| 31 | 
            -
             | 
| 32 | 
            -
              .posts {
         | 
| 33 | 
            -
                font-size: 0.85em;
         | 
| 34 | 
            -
              }
         | 
| 35 | 
            -
             | 
| 36 | 
            -
              .sidebar {
         | 
| 37 | 
            -
                padding-left: 4em;
         | 
| 38 | 
            -
              }
         | 
| 39 | 
            -
             | 
| 40 | 
            -
              .content {
         | 
| 41 | 
            -
                padding-right: 3em;
         | 
| 42 | 
            -
              }
         | 
| 43 | 
            -
             | 
| 44 | 
            -
              .footer {
         | 
| 45 | 
            -
                font-size: 0.85em;
         | 
| 46 | 
            -
              }
         | 
| 47 | 
            -
            }
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            /**
         | 
| 50 | 
            -
             * iPhone width
         | 
| 51 | 
            -
             **/
         | 
| 52 | 
            -
            @media (max-width:640px) {
         | 
| 53 | 
            -
              #logo {
         | 
| 54 | 
            -
                max-width: 75px;
         | 
| 55 | 
            -
              }
         | 
| 56 | 
            -
             | 
| 57 | 
            -
              #cover-photo-container {
         | 
| 58 | 
            -
                text-align: center;
         | 
| 59 | 
            -
              }
         | 
| 60 | 
            -
             | 
| 61 | 
            -
              #title {
         | 
| 62 | 
            -
                font-size: 2.5em;
         | 
| 63 | 
            -
              }
         | 
| 64 | 
            -
             | 
| 65 | 
            -
              .sidebar {
         | 
| 66 | 
            -
                transition: 1s;
         | 
| 67 | 
            -
                margin-left: -100%;
         | 
| 68 | 
            -
                z-index: 3;
         | 
| 69 | 
            -
                width: 35%;
         | 
| 70 | 
            -
                padding-left: 1.75em;
         | 
| 71 | 
            -
              }
         | 
| 72 | 
            -
             | 
| 73 | 
            -
              .content {
         | 
| 74 | 
            -
                z-index: 1;
         | 
| 75 | 
            -
                padding-right: 2em;
         | 
| 76 | 
            -
              }
         | 
| 77 | 
            -
             | 
| 78 | 
            -
              #sidebar-button {
         | 
| 79 | 
            -
                display: block;
         | 
| 80 | 
            -
                z-index: 2;
         | 
| 81 | 
            -
              }
         | 
| 82 | 
            -
            }
         | 
| 83 | 
            -
             | 
| 84 | 
            -
            /*****************************************************************************/
         | 
| 85 | 
            -
            /*
         | 
| 86 | 
            -
            /* Sidebar responsive animations
         | 
| 87 | 
            -
            /*
         | 
| 88 | 
            -
            /*****************************************************************************/
         | 
| 89 | 
            -
             | 
| 90 | 
            -
            .slideIn {
         | 
| 91 | 
            -
              margin-left: 0%;
         | 
| 92 | 
            -
            }
         | 
    
        data/example/css/syntax.css
    DELETED
    
    | @@ -1,60 +0,0 @@ | |
| 1 | 
            -
            .highlight  { background: #ffffff; }
         | 
| 2 | 
            -
            .highlight .c { color: #999988; font-style: italic } /* Comment */
         | 
| 3 | 
            -
            .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
         | 
| 4 | 
            -
            .highlight .k { font-weight: bold } /* Keyword */
         | 
| 5 | 
            -
            .highlight .o { font-weight: bold } /* Operator */
         | 
| 6 | 
            -
            .highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
         | 
| 7 | 
            -
            .highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
         | 
| 8 | 
            -
            .highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
         | 
| 9 | 
            -
            .highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
         | 
| 10 | 
            -
            .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
         | 
| 11 | 
            -
            .highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
         | 
| 12 | 
            -
            .highlight .ge { font-style: italic } /* Generic.Emph */
         | 
| 13 | 
            -
            .highlight .gr { color: #aa0000 } /* Generic.Error */
         | 
| 14 | 
            -
            .highlight .gh { color: #999999 } /* Generic.Heading */
         | 
| 15 | 
            -
            .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
         | 
| 16 | 
            -
            .highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
         | 
| 17 | 
            -
            .highlight .go { color: #888888 } /* Generic.Output */
         | 
| 18 | 
            -
            .highlight .gp { color: #555555 } /* Generic.Prompt */
         | 
| 19 | 
            -
            .highlight .gs { font-weight: bold } /* Generic.Strong */
         | 
| 20 | 
            -
            .highlight .gu { color: #aaaaaa } /* Generic.Subheading */
         | 
| 21 | 
            -
            .highlight .gt { color: #aa0000 } /* Generic.Traceback */
         | 
| 22 | 
            -
            .highlight .kc { font-weight: bold } /* Keyword.Constant */
         | 
| 23 | 
            -
            .highlight .kd { font-weight: bold } /* Keyword.Declaration */
         | 
| 24 | 
            -
            .highlight .kp { font-weight: bold } /* Keyword.Pseudo */
         | 
| 25 | 
            -
            .highlight .kr { font-weight: bold } /* Keyword.Reserved */
         | 
| 26 | 
            -
            .highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
         | 
| 27 | 
            -
            .highlight .m { color: #009999 } /* Literal.Number */
         | 
| 28 | 
            -
            .highlight .s { color: #d14 } /* Literal.String */
         | 
| 29 | 
            -
            .highlight .na { color: #008080 } /* Name.Attribute */
         | 
| 30 | 
            -
            .highlight .nb { color: #0086B3 } /* Name.Builtin */
         | 
| 31 | 
            -
            .highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
         | 
| 32 | 
            -
            .highlight .no { color: #008080 } /* Name.Constant */
         | 
| 33 | 
            -
            .highlight .ni { color: #800080 } /* Name.Entity */
         | 
| 34 | 
            -
            .highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
         | 
| 35 | 
            -
            .highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
         | 
| 36 | 
            -
            .highlight .nn { color: #555555 } /* Name.Namespace */
         | 
| 37 | 
            -
            .highlight .nt { color: #000080 } /* Name.Tag */
         | 
| 38 | 
            -
            .highlight .nv { color: #008080 } /* Name.Variable */
         | 
| 39 | 
            -
            .highlight .ow { font-weight: bold } /* Operator.Word */
         | 
| 40 | 
            -
            .highlight .w { color: #bbbbbb } /* Text.Whitespace */
         | 
| 41 | 
            -
            .highlight .mf { color: #009999 } /* Literal.Number.Float */
         | 
| 42 | 
            -
            .highlight .mh { color: #009999 } /* Literal.Number.Hex */
         | 
| 43 | 
            -
            .highlight .mi { color: #009999 } /* Literal.Number.Integer */
         | 
| 44 | 
            -
            .highlight .mo { color: #009999 } /* Literal.Number.Oct */
         | 
| 45 | 
            -
            .highlight .sb { color: #d14 } /* Literal.String.Backtick */
         | 
| 46 | 
            -
            .highlight .sc { color: #d14 } /* Literal.String.Char */
         | 
| 47 | 
            -
            .highlight .sd { color: #d14 } /* Literal.String.Doc */
         | 
| 48 | 
            -
            .highlight .s2 { color: #d14 } /* Literal.String.Double */
         | 
| 49 | 
            -
            .highlight .se { color: #d14 } /* Literal.String.Escape */
         | 
| 50 | 
            -
            .highlight .sh { color: #d14 } /* Literal.String.Heredoc */
         | 
| 51 | 
            -
            .highlight .si { color: #d14 } /* Literal.String.Interpol */
         | 
| 52 | 
            -
            .highlight .sx { color: #d14 } /* Literal.String.Other */
         | 
| 53 | 
            -
            .highlight .sr { color: #009926 } /* Literal.String.Regex */
         | 
| 54 | 
            -
            .highlight .s1 { color: #d14 } /* Literal.String.Single */
         | 
| 55 | 
            -
            .highlight .ss { color: #990073 } /* Literal.String.Symbol */
         | 
| 56 | 
            -
            .highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
         | 
| 57 | 
            -
            .highlight .vc { color: #008080 } /* Name.Variable.Class */
         | 
| 58 | 
            -
            .highlight .vg { color: #008080 } /* Name.Variable.Global */
         | 
| 59 | 
            -
            .highlight .vi { color: #008080 } /* Name.Variable.Instance */
         | 
| 60 | 
            -
            .highlight .il { color: #009999 } /* Literal.Number.Integer.Long */
         | 
    
        data/example/favicon.ico
    DELETED
    
    | Binary file | 
    
        data/example/images/cover.jpg
    DELETED
    
    | Binary file | 
    
        data/example/images/logo.png
    DELETED
    
    | Binary file | 
| Binary file | 
    
        data/example/index.html
    DELETED
    
    
| @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            window.onload = function() {
         | 
| 2 | 
            -
              var sidebar = document.getElementById("sidebar");
         | 
| 3 | 
            -
              var sidebarButton = document.getElementById("sidebar-button");
         | 
| 4 | 
            -
             | 
| 5 | 
            -
              function openSidebar(e) {
         | 
| 6 | 
            -
                if (sidebar.className.indexOf("slideIn") != -1) {
         | 
| 7 | 
            -
                  sidebar.className = sidebar.className.replace(" slideIn", "");
         | 
| 8 | 
            -
                } else {
         | 
| 9 | 
            -
                 sidebar.className = sidebar.className + " slideIn"; 
         | 
| 10 | 
            -
                }
         | 
| 11 | 
            -
              }
         | 
| 12 | 
            -
             | 
| 13 | 
            -
              sidebarButton.addEventListener("click", openSidebar, false);
         | 
| 14 | 
            -
            };
         | 
| @@ -1,23 +0,0 @@ | |
| 1 | 
            -
            # coding: utf-8
         | 
| 2 | 
            -
            lib = File.expand_path('../lib', __FILE__)
         | 
| 3 | 
            -
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 4 | 
            -
            require 'jekyll/multiple/languages/plugin/version'
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Gem::Specification.new do |spec|
         | 
| 7 | 
            -
              spec.name          = "jekyll-multiple-languages-plugin"
         | 
| 8 | 
            -
              spec.version       = Jekyll::Multiple::Languages::Plugin::VERSION
         | 
| 9 | 
            -
              spec.authors       = ["Martin Kurtsson"]
         | 
| 10 | 
            -
              spec.email         = ["martin.kurtsson@screeninteraction.com"]
         | 
| 11 | 
            -
              spec.description   = %q{Plugin for Jekyll and Octopress that adds support for translated keys, templates and posts.}
         | 
| 12 | 
            -
              spec.summary       = %q{I18n plugin for Jekyll and Octopress}
         | 
| 13 | 
            -
              spec.homepage      = "https://github.com/screeninteraction/jekyll-multiple-languages-plugin/"
         | 
| 14 | 
            -
              spec.license       = "MPL2"
         | 
| 15 | 
            -
             | 
| 16 | 
            -
              spec.files         = `git ls-files`.split($/)
         | 
| 17 | 
            -
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         | 
| 18 | 
            -
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| 19 | 
            -
              spec.require_paths = ["lib"]
         | 
| 20 | 
            -
             | 
| 21 | 
            -
              spec.add_development_dependency "bundler", "~> 1.3"
         | 
| 22 | 
            -
              spec.add_development_dependency "rake", "~> 0"
         | 
| 23 | 
            -
            end
         | 
| @@ -1,208 +0,0 @@ | |
| 1 | 
            -
            require "jekyll/multiple/languages/plugin/version"
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Jekyll
         | 
| 4 | 
            -
              @parsedlangs = {}
         | 
| 5 | 
            -
              def self.langs
         | 
| 6 | 
            -
                @parsedlangs
         | 
| 7 | 
            -
              end
         | 
| 8 | 
            -
              def self.setlangs(l)
         | 
| 9 | 
            -
                @parsedlangs = l
         | 
| 10 | 
            -
              end
         | 
| 11 | 
            -
              class Site
         | 
| 12 | 
            -
                alias :process_org :process
         | 
| 13 | 
            -
                def process
         | 
| 14 | 
            -
                  if !self.config['baseurl']
         | 
| 15 | 
            -
                    self.config['baseurl'] = ""
         | 
| 16 | 
            -
                  end
         | 
| 17 | 
            -
                  #Variables
         | 
| 18 | 
            -
                  config['baseurl_root'] = self.config['baseurl']
         | 
| 19 | 
            -
                  baseurl_org = self.config['baseurl']
         | 
| 20 | 
            -
                  languages = self.config['languages']
         | 
| 21 | 
            -
                  exclude_org = self.exclude
         | 
| 22 | 
            -
                  dest_org = self.dest
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                  #Loop
         | 
| 25 | 
            -
                  self.config['lang'] = self.config['default_lang'] = languages.first
         | 
| 26 | 
            -
                  puts
         | 
| 27 | 
            -
                  puts "Building site for default language: \"#{self.config['lang']}\" to: #{self.dest}"
         | 
| 28 | 
            -
                  process_org
         | 
| 29 | 
            -
                  languages.drop(1).each do |lang|
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                    # Build site for language lang
         | 
| 32 | 
            -
                    @dest = @dest + "/" + lang
         | 
| 33 | 
            -
                    self.config['baseurl'] = self.config['baseurl'] + "/" + lang
         | 
| 34 | 
            -
                    self.config['lang'] = lang
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                    # exclude folders or files from being copied to all the language folders
         | 
| 37 | 
            -
                    exclude_from_localizations = self.config['exclude_from_localizations'] || []
         | 
| 38 | 
            -
                    @exclude = @exclude + exclude_from_localizations
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                    puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}"
         | 
| 41 | 
            -
                    process_org
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                    #Reset variables for next language
         | 
| 44 | 
            -
                    @dest = dest_org
         | 
| 45 | 
            -
                    @exclude = exclude_org
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                    self.config['baseurl'] = baseurl_org
         | 
| 48 | 
            -
                  end
         | 
| 49 | 
            -
                  Jekyll.setlangs({})
         | 
| 50 | 
            -
                  puts 'Build complete'
         | 
| 51 | 
            -
                end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                alias :read_posts_org :read_posts
         | 
| 54 | 
            -
                def read_posts(dir)
         | 
| 55 | 
            -
                  translate_posts = !self.config['exclude_from_localizations'].include?("_posts")
         | 
| 56 | 
            -
                  if dir == '' && translate_posts
         | 
| 57 | 
            -
                    read_posts("_i18n/#{self.config['lang']}/")
         | 
| 58 | 
            -
                  else
         | 
| 59 | 
            -
                    read_posts_org(dir)
         | 
| 60 | 
            -
                  end
         | 
| 61 | 
            -
                end
         | 
| 62 | 
            -
              end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
              class Page
         | 
| 65 | 
            -
                def permalink
         | 
| 66 | 
            -
                  return nil if data.nil? || data['permalink'].nil?
         | 
| 67 | 
            -
                  if site.config['relative_permalinks']
         | 
| 68 | 
            -
                    File.join(@dir, data['permalink'])
         | 
| 69 | 
            -
                  else
         | 
| 70 | 
            -
                    # Look if there's a permalink overwrite specified for this lang
         | 
| 71 | 
            -
                    data['permalink_'+site.config['lang']] || data['permalink']
         | 
| 72 | 
            -
                  end
         | 
| 73 | 
            -
                end
         | 
| 74 | 
            -
              end
         | 
| 75 | 
            -
             | 
| 76 | 
            -
              class LocalizeTag < Liquid::Tag
         | 
| 77 | 
            -
             | 
| 78 | 
            -
                def initialize(tag_name, key, tokens)
         | 
| 79 | 
            -
                  super
         | 
| 80 | 
            -
                  @key = key.strip
         | 
| 81 | 
            -
                end
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                def render(context)
         | 
| 84 | 
            -
                  if "#{context[@key]}" != "" #Check for page variable
         | 
| 85 | 
            -
                    key = "#{context[@key]}"
         | 
| 86 | 
            -
                  else
         | 
| 87 | 
            -
                    key = @key
         | 
| 88 | 
            -
                  end
         | 
| 89 | 
            -
                  lang = context.registers[:site].config['lang']
         | 
| 90 | 
            -
                  unless Jekyll.langs.has_key?(lang)
         | 
| 91 | 
            -
                    puts "Loading translation from file #{context.registers[:site].source}/_i18n/#{lang}.yml"
         | 
| 92 | 
            -
                    Jekyll.langs[lang] = YAML.load_file("#{context.registers[:site].source}/_i18n/#{lang}.yml")
         | 
| 93 | 
            -
                  end
         | 
| 94 | 
            -
                  translation = Jekyll.langs[lang].access(key) if key.is_a?(String)
         | 
| 95 | 
            -
                  if translation.nil? or translation.empty?
         | 
| 96 | 
            -
                    translation = Jekyll.langs[context.registers[:site].config['default_lang']].access(key)
         | 
| 97 | 
            -
                    puts "Missing i18n key: #{lang}:#{key}"
         | 
| 98 | 
            -
                    puts "Using translation '%s' from default language: %s" %[translation, context.registers[:site].config['default_lang']]
         | 
| 99 | 
            -
                  end
         | 
| 100 | 
            -
                  translation
         | 
| 101 | 
            -
                end
         | 
| 102 | 
            -
              end
         | 
| 103 | 
            -
             | 
| 104 | 
            -
              module Tags
         | 
| 105 | 
            -
                class LocalizeInclude < IncludeTag
         | 
| 106 | 
            -
                  def render(context)
         | 
| 107 | 
            -
                    if "#{context[@file]}" != "" #Check for page variable
         | 
| 108 | 
            -
                      file = "#{context[@file]}"
         | 
| 109 | 
            -
                    else
         | 
| 110 | 
            -
                      file = @file
         | 
| 111 | 
            -
                    end
         | 
| 112 | 
            -
             | 
| 113 | 
            -
                    includes_dir = File.join(context.registers[:site].source, '_i18n/' + context.registers[:site].config['lang'])
         | 
| 114 | 
            -
             | 
| 115 | 
            -
                    if File.symlink?(includes_dir)
         | 
| 116 | 
            -
                      return "Includes directory '#{includes_dir}' cannot be a symlink"
         | 
| 117 | 
            -
                    end
         | 
| 118 | 
            -
                    if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
         | 
| 119 | 
            -
                      return "Include file '#{file}' contains invalid characters or sequences"
         | 
| 120 | 
            -
                    end
         | 
| 121 | 
            -
             | 
| 122 | 
            -
                    Dir.chdir(includes_dir) do
         | 
| 123 | 
            -
                      choices = Dir['**/*'].reject { |x| File.symlink?(x) }
         | 
| 124 | 
            -
                      if choices.include?(file)
         | 
| 125 | 
            -
                        source = File.read(file)
         | 
| 126 | 
            -
                        partial = Liquid::Template.parse(source)
         | 
| 127 | 
            -
             | 
| 128 | 
            -
                        context.stack do
         | 
| 129 | 
            -
                          context['include'] = parse_params(context) if @params
         | 
| 130 | 
            -
                          contents = partial.render(context)
         | 
| 131 | 
            -
                          site = context.registers[:site]
         | 
| 132 | 
            -
                          ext = File.extname(file)
         | 
| 133 | 
            -
             | 
| 134 | 
            -
                          converter = site.converters.find { |c| c.matches(ext) }
         | 
| 135 | 
            -
                          contents = converter.convert(contents) unless converter.nil?
         | 
| 136 | 
            -
             | 
| 137 | 
            -
                          contents
         | 
| 138 | 
            -
                        end
         | 
| 139 | 
            -
                      else
         | 
| 140 | 
            -
                        "Included file '#{file}' not found in #{includes_dir} directory"
         | 
| 141 | 
            -
                      end
         | 
| 142 | 
            -
                    end
         | 
| 143 | 
            -
                  end
         | 
| 144 | 
            -
                end
         | 
| 145 | 
            -
              end
         | 
| 146 | 
            -
             | 
| 147 | 
            -
              class LocalizeLink < Liquid::Tag
         | 
| 148 | 
            -
             | 
| 149 | 
            -
                def initialize(tag_name, key, tokens)
         | 
| 150 | 
            -
                  super
         | 
| 151 | 
            -
                  @key = key
         | 
| 152 | 
            -
                end
         | 
| 153 | 
            -
             | 
| 154 | 
            -
                def render(context)
         | 
| 155 | 
            -
                  if "#{context[@key]}" != "" #Check for page variable
         | 
| 156 | 
            -
                    key = "#{context[@key]}"
         | 
| 157 | 
            -
                  else
         | 
| 158 | 
            -
                    key = @key
         | 
| 159 | 
            -
                  end
         | 
| 160 | 
            -
                  key = key.split
         | 
| 161 | 
            -
                  namespace = key[0]
         | 
| 162 | 
            -
                  lang = key[1] || context.registers[:site].config['lang']
         | 
| 163 | 
            -
                  default_lang = context.registers[:site].config['default_lang']
         | 
| 164 | 
            -
                  baseurl = context.registers[:site].baseurl
         | 
| 165 | 
            -
                  pages = context.registers[:site].pages
         | 
| 166 | 
            -
                  url = "";
         | 
| 167 | 
            -
             | 
| 168 | 
            -
                  if default_lang != lang
         | 
| 169 | 
            -
                    baseurl = baseurl + "/" + lang
         | 
| 170 | 
            -
                  end
         | 
| 171 | 
            -
             | 
| 172 | 
            -
                  for p in pages
         | 
| 173 | 
            -
                    unless p['namespace'].nil?
         | 
| 174 | 
            -
                      page_namespace = p['namespace']
         | 
| 175 | 
            -
                      if namespace == page_namespace
         | 
| 176 | 
            -
                        permalink = p['permalink_'+lang] || p['permalink']
         | 
| 177 | 
            -
                        url = baseurl + permalink
         | 
| 178 | 
            -
                      end
         | 
| 179 | 
            -
                    end
         | 
| 180 | 
            -
                  end
         | 
| 181 | 
            -
                  url
         | 
| 182 | 
            -
                end
         | 
| 183 | 
            -
              end
         | 
| 184 | 
            -
            end
         | 
| 185 | 
            -
             | 
| 186 | 
            -
            unless Hash.method_defined? :access
         | 
| 187 | 
            -
              class Hash
         | 
| 188 | 
            -
                def access(path)
         | 
| 189 | 
            -
                  ret = self
         | 
| 190 | 
            -
                  path.split('.').each do |p|
         | 
| 191 | 
            -
                    if p.to_i.to_s == p
         | 
| 192 | 
            -
                      ret = ret[p.to_i]
         | 
| 193 | 
            -
                    else
         | 
| 194 | 
            -
                      ret = ret[p.to_s] || ret[p.to_sym]
         | 
| 195 | 
            -
                    end
         | 
| 196 | 
            -
                    break unless ret
         | 
| 197 | 
            -
                  end
         | 
| 198 | 
            -
                  ret
         | 
| 199 | 
            -
                end
         | 
| 200 | 
            -
              end
         | 
| 201 | 
            -
            end
         | 
| 202 | 
            -
             | 
| 203 | 
            -
            Liquid::Template.register_tag('t', Jekyll::LocalizeTag)
         | 
| 204 | 
            -
            Liquid::Template.register_tag('translate', Jekyll::LocalizeTag)
         | 
| 205 | 
            -
            Liquid::Template.register_tag('tf', Jekyll::Tags::LocalizeInclude)
         | 
| 206 | 
            -
            Liquid::Template.register_tag('translate_file', Jekyll::Tags::LocalizeInclude)
         | 
| 207 | 
            -
            Liquid::Template.register_tag('tl', Jekyll::LocalizeLink)
         | 
| 208 | 
            -
            Liquid::Template.register_tag('translate_link', Jekyll::LocalizeLink)
         |