jekyll-multiple-languages-plugin 1.5.0 → 1.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adae9df614a152254acf133ff446366b93806ae3
4
- data.tar.gz: ebea05c05297138b66975622c9e1141b410c8310
3
+ metadata.gz: 2f0345608e574787a5648224db9b1384ecce2152
4
+ data.tar.gz: 254fca0b56af9ce8ac43441e1d6bd7927ed4305b
5
5
  SHA512:
6
- metadata.gz: 3cca64fa57399de3656aeb5261c4d6d56500f89483e885b80068876cf53efdc2e540518be3bbe79e2348bc3ccafcd05985fdae6ba39e3c962b9e9c6dd5e6ce64
7
- data.tar.gz: cc3dd268294b7ca2d310d39d954af09e053722bb7a60a06e4dc882896e963b5a6ad5fb36a0afd45c2f2cb652901fe48aed63085e9acfb9188b3bbcf424e2c2dd
6
+ metadata.gz: 2d9a024e2b68882f4ecd9e9d4c1b110e081ed7459ef0ac027e85020e8544576578ecf5347cf9b7a4b1e3458f2820ea7e6dee4c180ec99a137f39de69481ea209
7
+ data.tar.gz: ef680666a151cd316cc0171a2c8e501c466e9b65197dc20f7563fddea7ed21d1cecd37f5b208386cb89f01c550e8f336676d62f010ab81c1cb5769610baba3de
data/README.md CHANGED
@@ -40,7 +40,7 @@ Table of Contents
40
40
 
41
41
  ## 1. Current Release Notice
42
42
 
43
- 1.5.0 is the current stable release.
43
+ 1.5.1 is the current stable release.
44
44
 
45
45
  Users that update from older versions to 1.4.0 or newer must change their `_config.yml` for the plugin to be loaded. Please see the `Installation` section bellow for the new string used to load the plugin.
46
46
 
@@ -325,7 +325,7 @@ Inside each of the language folders, you should create mirror pages to provide t
325
325
  ## 7. Example website
326
326
 
327
327
  This repository has an example website where you can test the plugin.
328
- After downloading the repository, get into the `example` directory and run: `bundle install` to install the newest version of Jekyll (change the Gemfile to install another version), the plugin, and all other dependencies.
328
+ After downloading the repository, get into the `example` directory and run: `bundle install` to install the newest version of Jekyll (edit the Gemfile to install another version) and all other dependencies.
329
329
 
330
330
  Then run `bundle exec jekyll serve` to start the Jekyll server. Using your web browser, access the address `http://localhost:4000`.
331
331
 
@@ -357,6 +357,10 @@ Then, create a file named `about.md` under `_i18n/en` with the English content.
357
357
 
358
358
 
359
359
  ## 8. Changelog
360
+ * 1.5.1
361
+ * Fix a bug (#70) where `site.static_files` would be empty on subsites if `exclude_from_localizations` is used.
362
+ * Some overall project enhancements and minor fixes.
363
+ * A simple Rake task is available to test the plugin, CI services now have something to run.
360
364
  * 1.5.0
361
365
  * Enables Liquid expansions within Liquid Tags.
362
366
  * The example website post language switchers were rewritten in an algorithmic way.
@@ -16,6 +16,41 @@ require_relative "plugin/version"
16
16
 
17
17
  module Jekyll
18
18
 
19
+ #*****************************************************************************
20
+ # :site, :post_render hook
21
+ #*****************************************************************************
22
+ Jekyll::Hooks.register :site, :post_render do |site, payload|
23
+
24
+ # Removes all static files that should not be copied to translated sites.
25
+ #===========================================================================
26
+ default_lang = payload["site"]["default_lang"]
27
+ current_lang = payload["site"][ "lang"]
28
+
29
+ static_files = payload["site"]["static_files"]
30
+ exclude_paths = payload["site"]["exclude_from_localizations"]
31
+
32
+
33
+ if default_lang != current_lang
34
+ static_files.delete_if do |static_file|
35
+
36
+ # Remove "/" from beginning of static file relative path
37
+ static_file_r_path = static_file.instance_variable_get(:@relative_path).dup
38
+ static_file_r_path[0] = ''
39
+
40
+ exclude_paths.any? do |exclude_path|
41
+ Pathname.new(static_file_r_path).descend do |static_file_path|
42
+ break(true) if (Pathname.new(exclude_path) <=> static_file_path) == 0
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ #===========================================================================
49
+
50
+ end
51
+
52
+
53
+
19
54
  ##############################################################################
20
55
  # class Site
21
56
  ##############################################################################
@@ -53,7 +88,6 @@ module Jekyll
53
88
 
54
89
  # Original Jekyll configurations
55
90
  baseurl_org = self.config[ 'baseurl' ] # Baseurl set on _config.yml
56
- exclude_org = self.exclude # List of excluded paths
57
91
  dest_org = self.dest # Destination folder where the website is generated
58
92
 
59
93
  # Site building only variables
@@ -86,10 +120,6 @@ module Jekyll
86
120
  self.config['baseurl'] = baseurl_org + "/" + lang
87
121
  self.config['lang'] = lang
88
122
 
89
- # exclude folders or files from being copied to all the language folders
90
- exclude_from_localizations = self.config['exclude_from_localizations']
91
- self.exclude = exclude_org + exclude_from_localizations
92
-
93
123
  puts "Building site for language: \"#{self.config['lang']}\" to: #{self.dest}"
94
124
 
95
125
  process_org
@@ -97,7 +127,6 @@ module Jekyll
97
127
 
98
128
  # Revert to initial Jekyll configurations (necessary for regeneration)
99
129
  self.config[ 'baseurl' ] = baseurl_org # Baseurl set on _config.yml
100
- self.exclude = exclude_org # List of excluded paths
101
130
  @dest = dest_org # Destination folder where the website is generated
102
131
 
103
132
  puts 'Build complete'
@@ -1,6 +1,6 @@
1
1
  module Jekyll
2
2
  module MultipleLanguagesPlugin
3
- VERSION = "1.5.0"
3
+ VERSION = "1.5.1"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-multiple-languages-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Kurtsson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-14 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler