jekyll-polyglot 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +7 -0
- data/README.md +118 -0
- data/lib/jekyll-polyglot.rb +1 -0
- data/lib/jekyll/polyglot.rb +6 -0
- data/lib/jekyll/polyglot/hooks.rb +3 -0
- data/lib/jekyll/polyglot/hooks/assets-toggle.rb +7 -0
- data/lib/jekyll/polyglot/hooks/coordinate.rb +6 -0
- data/lib/jekyll/polyglot/hooks/process.rb +5 -0
- data/lib/jekyll/polyglot/liquid.rb +7 -0
- data/lib/jekyll/polyglot/liquid/tags/i18n-headers.rb +30 -0
- data/lib/jekyll/polyglot/patches.rb +2 -0
- data/lib/jekyll/polyglot/patches/jekyll/site.rb +118 -0
- data/lib/jekyll/polyglot/patches/jekyll/static_file.rb +21 -0
- data/lib/jekyll/polyglot/version.rb +5 -0
- data/lib/polyglot.rb +48 -63
- metadata +38 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02c8a3bf16dd0455f8c5bd7f59d6af52497841ca
|
4
|
+
data.tar.gz: 0cf51394151e5a6a1652891530a645bffbd43a77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb846b3bac1a1cdaac5f82693e39d5c4a76ff620ef2c88129bdf7762a076951914e67ba63b658654085e33c511b385579bc981bdc2e23078bfd33299a058185
|
7
|
+
data.tar.gz: f81bbd4f9bfd0400a2c2f9b488538b8faca334d68aac9b8536a10700558d69b7236a849dc906f7a1bc708d54153642fc4ce2d56ce49d7992f543792d7692e6ab
|
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2015 - 2016 Samuel Volin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
:abc: Polyglot
|
2
|
+
---
|
3
|
+
version 1.2.0 [![Build Status](https://travis-ci.org/untra/polyglot.svg?branch=master)](https://travis-ci.org/untra/polyglot)
|
4
|
+
|
5
|
+
__Polyglot__ is a fast, painless, open-source internationalization plugin for [Jekyll](http://jekyllrb.com) blogs. Polyglot is easy to setup and use with any Jekyll project, and it scales to the languages you want to support. With fallback support for missing content, automatic url relativization, and powerful SEO tools, Polyglot allows any multi-language jekyll blog to focus on content without the cruft.
|
6
|
+
|
7
|
+
## Why?
|
8
|
+
Jekyll doesn't provide native support for multi-language blogs. This plugin was modeled after the [jekyll-multiple-languages-plugin](https://github.com/screeninteraction/jekyll-multiple-languages-plugin), whose implementation I liked, but execution I didn't.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
`gem install jekyll-polyglot` and add jekyll-polyglot to your `_config.yml` like the following:
|
12
|
+
```yml
|
13
|
+
gems:
|
14
|
+
- jekyll-assets
|
15
|
+
```
|
16
|
+
|
17
|
+
## Configuration
|
18
|
+
In your `_config.yml` file, add the following preferences
|
19
|
+
```
|
20
|
+
languages: ["en", "sv", "de", "fr"]
|
21
|
+
default_lang: "en"
|
22
|
+
exclude_from_localization: ["javascript", "images", "css"]
|
23
|
+
parallel_localization: true
|
24
|
+
```
|
25
|
+
These configuration preferences indicate
|
26
|
+
- what i18n languages you wish to support
|
27
|
+
- what is your default "fallback" language for your content
|
28
|
+
- what root level folders are you excluding from localization
|
29
|
+
- whether to run language processing in parallel or serial
|
30
|
+
|
31
|
+
## How To Use It
|
32
|
+
When adding new posts and pages, add to the YAML front matter:
|
33
|
+
```
|
34
|
+
lang: sv
|
35
|
+
```
|
36
|
+
or whatever appropriate [I18n language code](https://developer.chrome.com/webstore/i18n)
|
37
|
+
the page should build for. And you're done. Ideally, when designing your site, you should
|
38
|
+
organize files by their relative urls.
|
39
|
+
|
40
|
+
Polyglot works by associating documents with similar permalinks to the `lang` specified in their frontmatter. Files that correspond to similar routes should have identical permalinks. If you don't provide a permalink for a post, ___make sure you are consistent___ with how you place and name corresponding files:
|
41
|
+
```
|
42
|
+
_posts/2010-03-01-salad-recipes-en.md
|
43
|
+
_posts/2010-03-01-salad-recipes-sv.md
|
44
|
+
_posts/2010-03-01-salad-recipes-fr.md
|
45
|
+
```
|
46
|
+
|
47
|
+
Organized names will generate consistent permalinks when the post is rendered, and polyglot will know to build seperate language versions of
|
48
|
+
the website using only the files with the correct `lang` variable in the front matter.
|
49
|
+
|
50
|
+
In short:
|
51
|
+
* Be consistent with how you name and place your *posts* files
|
52
|
+
* Always give your *pages* permalinks in the frontmatter
|
53
|
+
* Don't overthink it, :wink:
|
54
|
+
|
55
|
+
|
56
|
+
#### Fallback Language Support
|
57
|
+
Lets say you are building your website. You have an `/about/` page written in *english*, *german* and
|
58
|
+
*swedish*. You are also supporting a *french* website, but you never designed a *french* version of your `/about/` page!
|
59
|
+
|
60
|
+
No worries. Polyglot ensures the sitemap of your *english* site matches your *french* site, matches your *swedish* and *german* sites too. In this case, because you specified a `default_lang` variable in your `_config.yml`, all sites missing their languages' counterparts will fallback to your `default_lang`, so content is preserved across different languages of your site.
|
61
|
+
|
62
|
+
#### Relativized Local Urls
|
63
|
+
No need to meticulously manage anchor tags to link to your correct language. Polyglot modifies how pages get written to the site so your *french* links keep vistors on your *french* blog.
|
64
|
+
```md
|
65
|
+
---
|
66
|
+
title: au sujet de notre entreprise
|
67
|
+
permalink: /about/
|
68
|
+
lang: fr
|
69
|
+
---
|
70
|
+
Nous sommes un restaurant situé à Paris . [Ceci est notre menu.](/menu/)
|
71
|
+
```
|
72
|
+
becomes
|
73
|
+
```html
|
74
|
+
<header class="post-header">
|
75
|
+
<h1 class="post-title">au sujet de notre entreprise</h1>
|
76
|
+
</header>
|
77
|
+
|
78
|
+
<article class="post-content">
|
79
|
+
<p>Nous sommes un restaurant situé à Paris . <a href="/fr/menu/">Ceci est notre menu.</a></p>
|
80
|
+
</article>
|
81
|
+
```
|
82
|
+
Voila!
|
83
|
+
|
84
|
+
Even if you are falling back to `default_lang` page, relative links built on the *french* site will
|
85
|
+
still link to *french* pages.
|
86
|
+
|
87
|
+
## How It Works
|
88
|
+
This plugin makes modifications to existing Jekyll classes and modules, namely `Jekyll::StaticFile` and `Jekyll::Site`. These changes are as lightweight and slim as possible. The biggest change is in `Jekyll::Site.process`. Polyglot overwrites this method to instead spawn a seperate thread for each language you intend to process the site for. Each of those threads calls the original `Jekyll::Site.process` method with its language in mind, ensuring your website scales to support any number of languages, while building all of your site languages simultaneously.
|
89
|
+
|
90
|
+
`Jekyll::Site.process` is the entrypoint for the Jekyll build process. Take care whatever other plugins you use do not also attempt to overwrite this method. You may have problems.
|
91
|
+
|
92
|
+
## Features
|
93
|
+
This plugin stands out from other I18n Jekyll plugins.
|
94
|
+
- automatically corrects your relative links, keeping your *french* vistors on your *french* website, even when content has to fallback to the `default_lang`.
|
95
|
+
- builds all versions of your website *simultaneously*, allowing big websites to scale efficiently.
|
96
|
+
- provides the liquid tag `{{ site.languages }}` to get an array of your I18n strings.
|
97
|
+
- provides the liquid tag `{{ site.default_lang }}` to get the default_lang I18n string.
|
98
|
+
- provides the liquid tag `{{ site.active_lang }}` to get the I18n language string the website was built for.
|
99
|
+
- provides the liquid tag `{{ I18n-Headers https://yourwebsite.com/ }}` to append SEO bonuses to your website.
|
100
|
+
- A creator that will answer all of your questions and issues.
|
101
|
+
|
102
|
+
## SEO Recipes
|
103
|
+
Jekyll-polyglot has a few spectacular [Search Engine Optimization technique](https://untra.github.io/polyglot/seo) to ensure your jekyll blog gets the most out of it's multilingual audience. Check them out!
|
104
|
+
|
105
|
+
## Examples
|
106
|
+
Check out the example project website [here](https://untra.github.io/polyglot)
|
107
|
+
(Jekyll resources are on the project's [site](https://github.com/untra/polyglot/tree/site) branch)
|
108
|
+
|
109
|
+
### Other Websites Built with Polyglot
|
110
|
+
|
111
|
+
* [LogRhythm Corporate Website](http://logrhythm.com)
|
112
|
+
|
113
|
+
## Compatibility
|
114
|
+
Currently supports Jekyll 3.0 .
|
115
|
+
Windows users will need to disable parallel_localization on their machines by setting `parallel_localization: false` in the `_config.yml`
|
116
|
+
|
117
|
+
## Copyright
|
118
|
+
Copyright (c) Samuel Volin 2015. License: MIT
|
@@ -0,0 +1 @@
|
|
1
|
+
require "jekyll/polyglot"
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# hook to coordinate blog posts and pages into distinct urls,
|
2
|
+
# and remove duplicate multilanguage posts and pages
|
3
|
+
Jekyll::Hooks.register :site, :post_read do |site|
|
4
|
+
site.posts.docs = site.coordinate_documents(site.posts.docs)
|
5
|
+
site.pages = site.coordinate_documents(site.pages)
|
6
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Polyglot
|
3
|
+
module Liquid
|
4
|
+
class I18nHeadersTag < ::Liquid::Tag
|
5
|
+
def initialize(tag_name, text, tokens)
|
6
|
+
super
|
7
|
+
@url = text
|
8
|
+
@url.strip!
|
9
|
+
@url.chomp! '/'
|
10
|
+
end
|
11
|
+
|
12
|
+
def render(context)
|
13
|
+
site = context.registers[:site]
|
14
|
+
permalink = context.registers[:page]['permalink']
|
15
|
+
i18n = "<meta http-equiv=\"Content-Language\" content=\"#{site.active_lang}\">"
|
16
|
+
i18n += "<link rel=\"alternate\" i18n=\"#{site.default_lang}\""\
|
17
|
+
" href=\"#{@url}#{permalink}\" />\n"
|
18
|
+
site.languages.each do |lang|
|
19
|
+
next if lang == site.default_lang
|
20
|
+
i18n += "<link rel=\"alternate\" i18n=\"#{lang}\""\
|
21
|
+
" href=\"#{@url}/#{lang}#{permalink}\" />\n"
|
22
|
+
end
|
23
|
+
i18n
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Liquid::Template.register_tag('I18n_Headers', Jekyll::Polyglot::Liquid::I18nHeadersTag)
|
@@ -0,0 +1,118 @@
|
|
1
|
+
include Process
|
2
|
+
module Jekyll
|
3
|
+
class Site
|
4
|
+
attr_reader :default_lang, :languages, :exclude_from_localization
|
5
|
+
attr_accessor :file_langs, :active_lang
|
6
|
+
|
7
|
+
def prepare
|
8
|
+
@file_langs = {}
|
9
|
+
@default_lang = config['default_lang'] || 'en'
|
10
|
+
@languages = config['languages'] || ['en']
|
11
|
+
@parallel_localization = config['parallel_localization'] || true
|
12
|
+
(@keep_files << @languages - [@default_lang]).flatten!
|
13
|
+
@exclude_from_localization = config['exclude_from_localization'] || []
|
14
|
+
@active_lang = @default_lang
|
15
|
+
end
|
16
|
+
|
17
|
+
alias_method :process_orig, :process
|
18
|
+
def process
|
19
|
+
prepare
|
20
|
+
if @parallel_localization
|
21
|
+
pids = {}
|
22
|
+
@languages.each do |lang|
|
23
|
+
pids[lang] = fork do
|
24
|
+
process_language lang
|
25
|
+
end
|
26
|
+
end
|
27
|
+
Signal.trap('INT') do
|
28
|
+
@languages.each do |lang|
|
29
|
+
puts "Killing #{pids[lang]} : #{lang}"
|
30
|
+
kill('INT', pids[lang])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
@languages.each do |lang|
|
34
|
+
waitpid pids[lang]
|
35
|
+
detach pids[lang]
|
36
|
+
end
|
37
|
+
else
|
38
|
+
@languages.each do |lang|
|
39
|
+
process_language lang
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
alias_method :site_payload_orig, :site_payload
|
45
|
+
def site_payload
|
46
|
+
payload = site_payload_orig
|
47
|
+
payload['site']['default_lang'] = default_lang
|
48
|
+
payload['site']['languages'] = languages
|
49
|
+
payload['site']['active_lang'] = active_lang
|
50
|
+
payload
|
51
|
+
end
|
52
|
+
|
53
|
+
def process_language(lang)
|
54
|
+
@active_lang = lang
|
55
|
+
config['active_lang'] = @active_lang
|
56
|
+
return process_orig if @active_lang == @default_lang
|
57
|
+
process_active_language
|
58
|
+
end
|
59
|
+
|
60
|
+
def process_active_language
|
61
|
+
@dest = @dest + '/' + @active_lang
|
62
|
+
@exclude += @exclude_from_localization
|
63
|
+
process_orig
|
64
|
+
end
|
65
|
+
|
66
|
+
# assigns natural permalinks to documents and prioritizes documents with
|
67
|
+
# active_lang languages over others
|
68
|
+
def coordinate_documents(docs)
|
69
|
+
regex = document_url_regex
|
70
|
+
approved = {}
|
71
|
+
docs.each do |doc|
|
72
|
+
lang = doc.data['lang'] || @default_lang
|
73
|
+
url = doc.url.gsub(regex, '/')
|
74
|
+
doc.data['permalink'] = url
|
75
|
+
next if @file_langs[url] == @active_lang
|
76
|
+
next if @file_langs[url] == @default_lang && lang != @active_lang
|
77
|
+
approved[url] = doc
|
78
|
+
@file_langs[url] = lang
|
79
|
+
end
|
80
|
+
approved.values
|
81
|
+
end
|
82
|
+
|
83
|
+
# performs any necesarry operations on the documents before rendering them
|
84
|
+
def process_documents(docs)
|
85
|
+
docs.each do |doc|
|
86
|
+
relativize_urls doc
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# a regex that matches urls or permalinks with i18n prefixes or suffixes
|
91
|
+
# matches /en/foo , .en/foo , foo.en/ and other simmilar default urls
|
92
|
+
# made by jekyll when parsing documents without explicitly set permalinks
|
93
|
+
def document_url_regex
|
94
|
+
regex = ''
|
95
|
+
@languages.each do |lang|
|
96
|
+
regex += "([\/\.]#{lang}[\/\.])|"
|
97
|
+
end
|
98
|
+
regex.chomp! '|'
|
99
|
+
%r{#{regex}}
|
100
|
+
end
|
101
|
+
|
102
|
+
# a regex that matches relative urls in a html document
|
103
|
+
# matches href="baseurl/foo/bar-baz" and others like it
|
104
|
+
# avoids matching excluded files
|
105
|
+
def relative_url_regex
|
106
|
+
regex = ''
|
107
|
+
@exclude.each do |x|
|
108
|
+
regex += "(?!#{x}\/)"
|
109
|
+
end
|
110
|
+
%r{href=\"#{@baseurl}\/((?:#{regex}[^,'\"\s\/?\.#-]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
|
111
|
+
end
|
112
|
+
|
113
|
+
def relativize_urls(doc)
|
114
|
+
return if @active_lang == @default_lang
|
115
|
+
doc.output.gsub!(relative_url_regex, "href=\"#{@baseurl}/#{@active_lang}/" + '\1"')
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
module Jekyll
|
3
|
+
# Alteration to Jekyll StaticFile
|
4
|
+
# provides aliased methods to direct write to skip files
|
5
|
+
# excluded from localization
|
6
|
+
class StaticFile
|
7
|
+
alias_method :write_orig, :write
|
8
|
+
def write(dest)
|
9
|
+
return false if exclude_from_localization?
|
10
|
+
write_orig(dest)
|
11
|
+
end
|
12
|
+
|
13
|
+
def exclude_from_localization?
|
14
|
+
return false if @site.active_lang == @site.default_lang
|
15
|
+
@site.exclude_from_localization.each do |e|
|
16
|
+
return true if relative_path[1..-1].start_with?(e)
|
17
|
+
end
|
18
|
+
false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/polyglot.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Jekyll Polyglot v1.
|
1
|
+
# Jekyll Polyglot v1.2.0
|
2
2
|
# Fast, painless, open source i18n plugin for Jekyll 3.0 Blogs.
|
3
3
|
# author: Samuel Volin (@untra)
|
4
4
|
# github: https://github.com/untra/polyglot
|
@@ -67,88 +67,73 @@ module Jekyll
|
|
67
67
|
|
68
68
|
def process_active_language
|
69
69
|
@dest = @dest + '/' + @active_lang
|
70
|
-
@exclude +=
|
70
|
+
@exclude += @exclude_from_localization
|
71
71
|
process_orig
|
72
72
|
end
|
73
73
|
|
74
|
-
#
|
75
|
-
#
|
76
|
-
|
77
|
-
|
74
|
+
# assigns natural permalinks to documents and prioritizes documents with
|
75
|
+
# active_lang languages over others
|
76
|
+
def coordinate_documents(docs)
|
77
|
+
regex = document_url_regex
|
78
78
|
approved = {}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
83
|
-
n.chomp! '|'
|
84
|
-
site.posts.docs.each do |doc|
|
85
|
-
language = doc.data['lang'] || site.default_lang
|
86
|
-
url = doc.url.gsub(%r{#{n}}, '/')
|
79
|
+
docs.each do |doc|
|
80
|
+
lang = doc.data['lang'] || @default_lang
|
81
|
+
url = doc.url.gsub(regex, '/')
|
87
82
|
doc.data['permalink'] = url
|
88
|
-
next if
|
89
|
-
if
|
90
|
-
next if language != site.active_lang
|
91
|
-
end
|
83
|
+
next if @file_langs[url] == @active_lang
|
84
|
+
next if @file_langs[url] == @default_lang && lang != @active_lang
|
92
85
|
approved[url] = doc
|
93
|
-
|
86
|
+
@file_langs[url] = lang
|
94
87
|
end
|
95
|
-
|
88
|
+
approved.values
|
96
89
|
end
|
97
|
-
end
|
98
90
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
data['lang'] || site.config['default_lang']
|
105
|
-
end
|
106
|
-
|
107
|
-
def lang=(str)
|
108
|
-
data['lang'] = str
|
91
|
+
# performs any necesarry operations on the documents before rendering them
|
92
|
+
def process_documents(docs)
|
93
|
+
docs.each do |doc|
|
94
|
+
relativize_urls doc
|
95
|
+
end
|
109
96
|
end
|
110
97
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
98
|
+
# a regex that matches urls or permalinks with i18n prefixes or suffixes
|
99
|
+
# matches /en/foo , .en/foo , foo.en/ and other simmilar default urls
|
100
|
+
# made by jekyll when parsing documents without explicitly set permalinks
|
101
|
+
def document_url_regex
|
102
|
+
regex = ''
|
103
|
+
@languages.each do |lang|
|
104
|
+
regex += "([\/\.]#{lang}[\/\.])|"
|
105
|
+
end
|
106
|
+
regex.chomp! '|'
|
107
|
+
%r{#{regex}}
|
120
108
|
end
|
121
109
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
110
|
+
# a regex that matches relative urls in a html document
|
111
|
+
# matches href="baseurl/foo/bar-baz" and others like it
|
112
|
+
def relative_url_regex
|
113
|
+
regex = ''
|
114
|
+
@exclude.each do |x|
|
115
|
+
regex += "(?!#{x}\/)"
|
126
116
|
end
|
127
|
-
|
128
|
-
|
117
|
+
# regex that looks for all relative urls except for excluded files
|
118
|
+
%r{href=\"#{@baseurl}\/((?:#{regex}[^,'\"\s\/?\.#-]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
|
129
119
|
end
|
130
120
|
|
131
|
-
def
|
132
|
-
return
|
133
|
-
|
134
|
-
if lang == site.default_lang
|
135
|
-
return site.file_langs[path] == site.active_lang
|
136
|
-
end
|
137
|
-
true
|
121
|
+
def relativize_urls(doc)
|
122
|
+
return if @active_lang == @default_lang
|
123
|
+
doc.output.gsub!(relative_url_regex, "href=\"#{@baseurl}/#{@active_lang}/" + '\1"')
|
138
124
|
end
|
139
125
|
|
140
|
-
|
141
|
-
|
142
|
-
|
126
|
+
# hook to coordinate blog posts and pages into distinct urls,
|
127
|
+
# and remove duplicate multilanguage posts and pages
|
128
|
+
Jekyll::Hooks.register :site, :post_read do |site|
|
129
|
+
site.posts.docs = site.coordinate_documents(site.posts.docs)
|
130
|
+
site.pages = site.coordinate_documents(site.pages)
|
143
131
|
end
|
144
132
|
|
145
|
-
|
146
|
-
|
147
|
-
site.
|
148
|
-
|
149
|
-
end
|
150
|
-
# regex that looks for all relative urls except for excluded files
|
151
|
-
%r{href=\"#{site.baseurl}\/((?:#{n}[^,'\"\s\/?\.#-]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
|
133
|
+
# hook to make a call to process rendered documents,
|
134
|
+
Jekyll::Hooks.register :site, :post_render do |site|
|
135
|
+
site.process_documents(site.posts.docs)
|
136
|
+
site.process_documents(site.pages)
|
152
137
|
end
|
153
138
|
end
|
154
139
|
|
metadata
CHANGED
@@ -1,21 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-polyglot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Volin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
12
|
-
dependencies:
|
13
|
-
|
11
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.1'
|
33
|
+
description: Fast open source i18n plugin for Jekyll blogs.
|
14
34
|
email: untra.sam@gmail.com
|
15
35
|
executables: []
|
16
36
|
extensions: []
|
17
37
|
extra_rdoc_files: []
|
18
38
|
files:
|
39
|
+
- LICENSE
|
40
|
+
- README.md
|
41
|
+
- lib/jekyll-polyglot.rb
|
42
|
+
- lib/jekyll/polyglot.rb
|
43
|
+
- lib/jekyll/polyglot/hooks.rb
|
44
|
+
- lib/jekyll/polyglot/hooks/assets-toggle.rb
|
45
|
+
- lib/jekyll/polyglot/hooks/coordinate.rb
|
46
|
+
- lib/jekyll/polyglot/hooks/process.rb
|
47
|
+
- lib/jekyll/polyglot/liquid.rb
|
48
|
+
- lib/jekyll/polyglot/liquid/tags/i18n-headers.rb
|
49
|
+
- lib/jekyll/polyglot/patches.rb
|
50
|
+
- lib/jekyll/polyglot/patches/jekyll/site.rb
|
51
|
+
- lib/jekyll/polyglot/patches/jekyll/static_file.rb
|
52
|
+
- lib/jekyll/polyglot/version.rb
|
19
53
|
- lib/polyglot.rb
|
20
54
|
homepage: http://untra.github.io/polyglot
|
21
55
|
licenses:
|