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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7001f707bc9b90e87e3e3cf0bf9df320d9caf192a4dd3a3b8a521663fb7d673
4
- data.tar.gz: 4df383de252c0609faace3eaf018f54652bb262b5238ed71e2b78d393cdde521
3
+ metadata.gz: e7e6fdd0bef170f9bc080d6ed57e256e3d1ace2c0faa9c33fad9073490dd0703
4
+ data.tar.gz: 4637537e057a944190caaff98070168a24a30cd866da6bd1596d072f42429724
5
5
  SHA512:
6
- metadata.gz: 3fb401347ed58d7172981c1a403472047065c8a9992c84478f6202c4701c05676c3e6989077a5e2344530b5e7e1113eb800c3bc7a22fefa2da0a2e02a105fde9
7
- data.tar.gz: f8086dae05728e41d661611a89e50fb26319c98a96bb8f72922b94f355c78408dbe863d4fec3c72f14d213967e6a5760f536b8f3f13c75fed40db1488bdab01a
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-locales (0.1.7)
4
+ jekyll-locales (0.1.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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']
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Locales
5
- VERSION = '0.1.7'
5
+ VERSION = '0.1.9'
6
6
  end
7
7
  end
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.7
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-01-28 00:00:00.000000000 Z
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler