jekyll-locales 0.1.6 → 0.1.7

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: aa3a9eda7415b229d8e3e3a70c79a9b4df8ea967e3c5c24d71a98f41d5ffcecc
4
- data.tar.gz: a62f6a4b330051558a4b93f7aa87e00700eb10469fdfbe07349cd510f9507454
3
+ metadata.gz: a7001f707bc9b90e87e3e3cf0bf9df320d9caf192a4dd3a3b8a521663fb7d673
4
+ data.tar.gz: 4df383de252c0609faace3eaf018f54652bb262b5238ed71e2b78d393cdde521
5
5
  SHA512:
6
- metadata.gz: c3b2d4214a63d1c7da7b472edb2c997b808749e759e308bdb5704862b3705fa3bee0bcc242c7ef296da6e64133ef6b995e01ec436cec4499cde78c41f3eb8edb
7
- data.tar.gz: faf5e2bf08714ae0c4b5c615f849600b747821238cb3c58d1020f85f4b17a28c3d61293d5b3b287ae5a0c40ebfa4c3b052377b52ac2c19ef0dbda6b87144f2c4
6
+ metadata.gz: 3fb401347ed58d7172981c1a403472047065c8a9992c84478f6202c4701c05676c3e6989077a5e2344530b5e7e1113eb800c3bc7a22fefa2da0a2e02a105fde9
7
+ data.tar.gz: f8086dae05728e41d661611a89e50fb26319c98a96bb8f72922b94f355c78408dbe863d4fec3c72f14d213967e6a5760f536b8f3f13c75fed40db1488bdab01a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-locales (0.1.6)
4
+ jekyll-locales (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -35,4 +35,4 @@ DEPENDENCIES
35
35
  rubocop (~> 0.74)
36
36
 
37
37
  BUNDLED WITH
38
- 2.0.2
38
+ 2.1.4
data/README.md CHANGED
@@ -33,10 +33,13 @@ locales:
33
33
  - en
34
34
  - ahr
35
35
  - brasileiro
36
+ redirect: true
36
37
  ```
37
38
 
38
- **The first locale is going to be your default locale**. It doesn't do
39
- much, but still have it in mind.
39
+ **The first locale is going to be your default locale**. If you use
40
+ a redirector.html, it will be the locale it will redirector to. If you
41
+ don't use a redirector, the default locale will be at the root of the
42
+ site.
40
43
 
41
44
  ## Posts
42
45
 
@@ -28,15 +28,19 @@ module Jekyll
28
28
 
29
29
  symlink
30
30
  process_single
31
+ # The default locale is placed at the root of the
32
+ # site and everything else is under a subdirectory, but we symlink
33
+ # root to default_locale for compatibility
34
+ self_symlink if default_locale? && !redirect?
31
35
  end
32
36
 
33
- if locales?
34
- copy_redirector
35
- default_delete
36
- default_symlink
37
- else
38
- self_symlink
39
- end
37
+ # XXX: Default is expected by Sutty so we always create it
38
+ default_delete
39
+ default_symlink
40
+
41
+ # If we enable the redirector, the root of the site will consist
42
+ # of an index.html that allows visitors to select their locale.
43
+ copy_redirector if redirect?
40
44
  end
41
45
 
42
46
  private
@@ -50,7 +54,10 @@ module Jekyll
50
54
  config['locale'] = config['lang'] = locale
51
55
  config['default_locale'] = default_locale
52
56
 
57
+ # Don't touch the config unless there's more than one locale or we
58
+ # aren't using a redirector
53
59
  return unless locales?
60
+ return if default_locale? && !redirect?
54
61
 
55
62
  @dest = config['destination'] = locale_destination
56
63
  config['baseurl'] = locale_baseurl
@@ -62,7 +69,11 @@ module Jekyll
62
69
  end
63
70
 
64
71
  def default_locale
65
- locales.first
72
+ @default_locale ||= locales.first
73
+ end
74
+
75
+ def default_locale?
76
+ default_locale == locale
66
77
  end
67
78
 
68
79
  # Cache original destination
@@ -92,6 +103,10 @@ module Jekyll
92
103
  FileUtils.ln_s("_#{locale}", '_posts')
93
104
  end
94
105
 
106
+ def redirect?
107
+ config.fetch('redirect', false)
108
+ end
109
+
95
110
  # TODO: Make configurable
96
111
  def redirector
97
112
  @redirector ||= File.join(locale_destination, 'redirector.html')
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Locales
5
- VERSION = '0.1.6'
5
+ VERSION = '0.1.7'
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.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - f
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-25 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -116,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
- rubyforge_project:
120
- rubygems_version: 2.7.6.2
119
+ rubygems_version: 3.0.3
121
120
  signing_key:
122
121
  specification_version: 4
123
122
  summary: Jekyll plugin for localized sites