jekyll-locales 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/lib/jekyll/locales/site.rb +34 -0
- data/lib/jekyll/locales/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7e6fdd0bef170f9bc080d6ed57e256e3d1ace2c0faa9c33fad9073490dd0703
|
4
|
+
data.tar.gz: 4637537e057a944190caaff98070168a24a30cd866da6bd1596d072f42429724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0768e9186dae694e308d7e4b9471543a32de53bd1f3bb45668901241245b75b4ffb38c9134133fec6884effa2b6c164ff109f1682471856e525dc37dd271c63b'
|
7
|
+
data.tar.gz: 367a38099307c74170cd19a88e95a70a6823c73c03a77dbb3bddad1fd8a24442b9dd2ade786670d002c4f63efe58a2d5d6b3b286da1a16f007ce81d687ae4870
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.9
|
4
|
+
|
5
|
+
- Loading locales as collection makes Jekyll render them even when
|
6
|
+
they're not part of output. This version prevents that. A site with
|
7
|
+
three languages was taking 160 seconds before and 60 after patching!
|
8
|
+
|
9
|
+
## 0.1.8
|
10
|
+
|
11
|
+
- Load other locales as collections to make them available in templates.
|
12
|
+
Compatible with
|
13
|
+
[jekyll-linked-posts](https://rubygems.org/gems/jekyll-linked-posts).
|
14
|
+
|
3
15
|
## 0.1.0
|
4
16
|
|
5
17
|
- Localized Jekyll sites
|
data/Gemfile.lock
CHANGED
data/lib/jekyll/locales/site.rb
CHANGED
@@ -45,6 +45,21 @@ module Jekyll
|
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
+
# Redefine #render_docs so it doesn't render the locale collections
|
49
|
+
# for each independent locale.
|
50
|
+
#
|
51
|
+
# XXX: Jekyll should render on demand instead of rendering and
|
52
|
+
# writing separately.
|
53
|
+
def render_docs(payload)
|
54
|
+
collections.each do |name, collection|
|
55
|
+
next if locales.include? name
|
56
|
+
|
57
|
+
collection.docs.each do |document|
|
58
|
+
render_regenerated(document, payload)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
48
63
|
def locales?
|
49
64
|
locales.size > 1
|
50
65
|
end
|
@@ -57,6 +72,8 @@ module Jekyll
|
|
57
72
|
# Don't touch the config unless there's more than one locale or we
|
58
73
|
# aren't using a redirector
|
59
74
|
return unless locales?
|
75
|
+
|
76
|
+
other_locales_as_collections
|
60
77
|
return if default_locale? && !redirect?
|
61
78
|
|
62
79
|
@dest = config['destination'] = locale_destination
|
@@ -76,6 +93,23 @@ module Jekyll
|
|
76
93
|
default_locale == locale
|
77
94
|
end
|
78
95
|
|
96
|
+
# Read the other locales as collections but don't render them, only
|
97
|
+
# make them available to templates.
|
98
|
+
#
|
99
|
+
# The URL will be the permalink with the language prepended.
|
100
|
+
#
|
101
|
+
# {https://rubygems.org/gems/jekyll-linked-posts}
|
102
|
+
def other_locales_as_collections
|
103
|
+
locales.each do |l|
|
104
|
+
next if l == locale
|
105
|
+
|
106
|
+
config['collections'][l] = {
|
107
|
+
'output' => false,
|
108
|
+
'permalink' => [nil, l, config['permalink']].join('/')
|
109
|
+
}
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
79
113
|
# Cache original destination
|
80
114
|
def root_destination
|
81
115
|
@root_destination ||= config['destination']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-locales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|