jekyll-polyglot 1.5.0 → 1.6.0

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: b1df66cac375456100227a3f62c2771280b12b20523650adf5aed2b0f71537a3
4
- data.tar.gz: dd7c651028a836017807fdeda58600e576132b950c9b4dca17dcbeb4ab7d2af3
3
+ metadata.gz: 52fcf4f09a9d96c2255ca7226c0a26d5dc7cf5e337fc03805e3e3d18ff00d7d9
4
+ data.tar.gz: 6a136ac3a5459c28c39ec71876e01ebee0582154f448ead285169bede86acb9f
5
5
  SHA512:
6
- metadata.gz: 12562b7c0f8ab337c4195d1b664a8cfc1e93e2f53d2571dacfffc67d58958f2c262bbc74ec9aa8dc63f670f10b2381e8b1ddec07b0fe1edb88d9d532f6c4c916
7
- data.tar.gz: 0c5152c2d45eead027c8a0cef88b8482f87841def83d56924d6118cb7bc157a3b6bea14a5a32f18273688a18e6cc5bf54de3b5dd078ae551c8dc6478f5dcfd41
6
+ metadata.gz: 9fe64a2a499c51edd8e3a861d8b2805f4283dc89301be66c942d297f44923a3a1203b58ffd5183615fa34a4d01b1a30df01c76bb29626f57258e8b5e7396cbb3
7
+ data.tar.gz: f22f0727628cfed097dc18845fbd44de02629909d1a4db22767b1b9d52538a1a1287103bab7e8cc85e4e611f74365a7e789515b9b807d7c85751e8a660ef6a1e
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 - 2020 Samuel Volin
1
+ Copyright (c) 2015 - 2023 Samuel Volin
2
2
 
3
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
4
 
data/README.md CHANGED
@@ -50,6 +50,8 @@ or whatever appropriate [I18n language code](https://developer.chrome.com/websto
50
50
  the page should build for. And you're done. Ideally, when designing your site, you should
51
51
  organize files by their relative urls.
52
52
 
53
+ You can see how the live polyglot website [configures and supports multiple languages](https://github.com/untra/polyglot/blob/master/site/_config.yml#L28-L37), and examples of [community](https://github.com/untra/polyglot/pull/155) [language](https://github.com/untra/polyglot/pull/167) [contributions](https://github.com/untra/polyglot/pull/177).
54
+
53
55
  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:
54
56
  ```
55
57
  _posts/2010-03-01-salad-recipes-en.md
@@ -112,7 +114,11 @@ becomes
112
114
 
113
115
  #### Disabling Url Relativizing
114
116
  _New in 1.4.0_
115
- If you dont want a href attribute to be relativized (such as for making [a language switcher](https://github.com/untra/polyglot/blob/master/site/_includes/sidebar.html#L40)), you can use the `{% static_href %}href="..."{% endstatic_href %}` block tag.
117
+ If you dont want a href attribute to be relativized (such as for making [a language switcher](https://github.com/untra/polyglot/blob/master/site/_includes/sidebar.html#L40)), you can use the block tag:
118
+
119
+ ```html
120
+ {% static_href %}href="..."{% endstatic_href %}
121
+ ```
116
122
 
117
123
  ```html
118
124
  <a {% static_href %}href="/about"{% endstatic_href %}>click this static link</a>
@@ -138,7 +144,7 @@ lang-exclusive: ['en', 'fr']
138
144
  #### Machine-aware site building
139
145
  _New in 1.5.0_
140
146
 
141
- Polyglot will only start builds after it confirms there is a cpu core ready to accept the build thread. This ensures that jekll will build large sites efficiently streamlining build processes instead of overloading machines with process thrash.
147
+ Polyglot will only start builds after it confirms there is a cpu core ready to accept the build thread. This ensures that jekyll will build large sites efficiently, streamlining build processes instead of overloading machines with process thrash.
142
148
 
143
149
  #### Localized site.data
144
150
 
@@ -151,6 +157,13 @@ This plugin makes modifications to existing Jekyll classes and modules, namely `
151
157
 
152
158
  `Jekyll::Site.process` is the entry point for the Jekyll build process. Take care whatever other plugins you use do not also attempt to overwrite this method. You may have problems.
153
159
 
160
+
161
+ ### Writing Tests and Debugging
162
+ _:wave: I need assistance with modern ruby best practices for test maintenance with rake and rspec. If you got the advice I have the ears._
163
+
164
+ Tests are run with `bundle exec rake`. Tests are in the `/spec` directory, and test failure output detail can be examined in the `rspec.xml` file.
165
+
166
+
154
167
  ## Features
155
168
  This plugin stands out from other I18n Jekyll plugins.
156
169
  - automatically corrects your relative links, keeping your *french* visitors on your *french* website, even when content has to fallback to the `default_lang`.
@@ -159,7 +172,7 @@ This plugin stands out from other I18n Jekyll plugins.
159
172
  - provides the liquid tag `{{ site.default_lang }}` to get the default_lang I18n string.
160
173
  - provides the liquid tag `{{ site.active_lang }}` to get the I18n language string the website was built for. Alternative names for `active_lang` can be configured via `config.lang_vars`.
161
174
  - provides the liquid tag `{{ I18n_Headers https://yourwebsite.com/ }}` to append SEO bonuses to your website.
162
- - provides the liquid tag `{{ Unrelativized_Link href="/hello" }}` to make urls that do not get influenced by url correction regexs.
175
+ - provides the liquid tag `{{ Unrelativized_Link href="/hello" }}` to make urls that do not get influenced by url correction regexes.
163
176
  - provides `site.data` localization for efficient rich text replacement.
164
177
  - a creator that will answer all of your questions and issues.
165
178
 
@@ -175,10 +188,12 @@ Feel free to open a PR and list your multilingual blog here you may want to shar
175
188
  * [Hanare Cafe in Toshijima, Japan](https://hanarecafe.com)
176
189
  * [F-Droid](https://f-droid.org)
177
190
  * [Ubuntu MATE](https://ubuntu-mate.org)
191
+ * [Leo3418 blog](https://leo3418.github.io/)
192
+ * [Gaphor](https://gaphor.org)
193
+ * [Yi Yunseok's personal blog website](https://Yi-Yunseok.GitHub.io)
178
194
 
179
195
  ## Compatibility
180
196
  Currently supports Jekyll 3.0 , and Jekyll 4.0
181
-
182
197
  * Windows users will need to disable parallel_localization on their machines by setting `parallel_localization: false` in the `_config.yml`
183
198
  * In Jekyll 4.0 , SCSS source maps will generate improperly due to how Polyglot operates. The workaround is to disable the CSS sourcemaps. Adding the following to your `config.yml` will disable sourcemap generation:
184
199
  ```yaml
@@ -189,19 +204,23 @@ sass:
189
204
  ## Contributions
190
205
  Please! I need all the support I can get! 🙏
191
206
 
192
- But for real I would appreciate any contributions and support. This started as an open-source side-project and has gotten bigger than I'd ever imagine!
207
+ But for real I would appreciate any code contributions and support. This started as an open-source side-project and has gotten bigger than I'd ever imagine!
193
208
  If you have something you'd like to contribute to jekyll-polyglot, please open a PR!
194
209
 
195
210
 
196
211
  ## 2.0 Roadmap
197
- * [ ] - **site language**: portuguese `pt_BR` `pt_PT`
212
+ * [ ] - **site language**: portuguese Brazil `pt-BR` `pt-PT`
213
+ * [ ] - **site language**: portuguese Portugal `pt-BR` `pt-PT`
198
214
  * [ ] - **site language**: arabic `ar`
199
215
  * [ ] - **site language**: japanese `ja`
200
216
  * [x] - **site language**: russian `ru`
201
- * [ ] - **site language**: korean `ko`
202
- * [ ] - **site language**: hebrew `he`
217
+ * [x] - **site language**: dutch `nl`
218
+ * [x] - **site language**: korean `ko`
219
+ * [x] - **site language**: hebrew `he`
220
+ * [x] - **site language**: chinese China `zh-CN`
221
+ * [ ] - **site language**: chinese Taiwan `zh_TW`
203
222
  * [ ] - get whitelisted as an official github-pages jekyll plugin
204
223
  * [x] - update CI provider
205
224
 
206
225
  ## Copyright
207
- Copyright (c) Samuel Volin 2021. License: MIT
226
+ Copyright (c) Samuel Volin 2023. License: MIT
@@ -190,7 +190,7 @@ module Jekyll
190
190
  end
191
191
  end
192
192
  start = disabled ? 'ferh' : 'href'
193
- %r{#{start}=\"?#{@baseurl}\/((?:#{regex}[^,'\"\s\/?\.#]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
193
+ %r{#{start}=\"?#{@baseurl}\/((?:#{regex}[^,'\"\s\/?\.]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
194
194
  end
195
195
 
196
196
  # a regex that matches absolute urls in a html document
@@ -208,31 +208,35 @@ module Jekyll
208
208
  end
209
209
  end
210
210
  start = disabled ? 'ferh' : 'href'
211
- %r{(?<!hreflang="#{@default_lang}" )#{start}=\"?#{url}#{@baseurl}\/((?:#{regex}[^,'\"\s\/?\.#]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
211
+ %r{(?<!hreflang="#{@default_lang}" )#{start}=\"?#{url}#{@baseurl}\/((?:#{regex}[^,'\"\s\/?\.]+\.?)*(?:\/[^\]\[\)\(\"\'\s]*)?)\"}
212
212
  end
213
213
 
214
214
  def relativize_urls(doc, regex)
215
215
  return if doc.output.nil?
216
-
217
- doc.output.gsub!(regex, "href=\"#{@baseurl}/#{@active_lang}/" + '\1"')
216
+ modified_output = doc.output.dup
217
+ modified_output.gsub!(regex, "href=\"#{@baseurl}/#{@active_lang}/" + '\1"')
218
+ doc.output = modified_output
218
219
  end
219
220
 
220
221
  def relativize_absolute_urls(doc, regex, url)
221
222
  return if doc.output.nil?
222
-
223
- doc.output.gsub!(regex, "href=\"#{url}#{@baseurl}/#{@active_lang}/" + '\1"')
223
+ modified_output = doc.output.dup
224
+ modified_output.gsub!(regex, "href=\"#{url}#{@baseurl}/#{@active_lang}/" + '\1"')
225
+ doc.output = modified_output
224
226
  end
225
227
 
226
228
  def correct_nonrelativized_absolute_urls(doc, regex, url)
227
229
  return if doc.output.nil?
228
-
229
- doc.output.gsub!(regex, "href=\"#{url}#{@baseurl}/" + '\1"')
230
+ modified_output = doc.output.dup
231
+ modified_output.gsub!(regex, "href=\"#{url}#{@baseurl}/" + '\1"')
232
+ doc.output = modified_output
230
233
  end
231
234
 
232
235
  def correct_nonrelativized_urls(doc, regex)
233
236
  return if doc.output.nil?
234
-
235
- doc.output.gsub!(regex, "href=\"#{@baseurl}/" + '\1"')
237
+ modified_output = doc.output.dup
238
+ modified_output.gsub!(regex, "href=\"#{@baseurl}/" + '\1"')
239
+ doc.output = modified_output
236
240
  end
237
241
  end
238
242
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-polyglot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Volin
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-17 00:00:00.000000000 Z
11
+ date: 2023-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: '4.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '3.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '4.0'
27
33
  description: Fast open source i18n plugin for Jekyll blogs.
28
34
  email: untra.sam@gmail.com
29
35
  executables: []
@@ -49,7 +55,7 @@ homepage: https://polyglot.untra.io/
49
55
  licenses:
50
56
  - MIT
51
57
  metadata: {}
52
- post_install_message:
58
+ post_install_message:
53
59
  rdoc_options: []
54
60
  require_paths:
55
61
  - lib
@@ -64,9 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
70
  - !ruby/object:Gem::Version
65
71
  version: 2.7.0
66
72
  requirements: []
67
- rubyforge_project:
68
- rubygems_version: 2.7.6
69
- signing_key:
73
+ rubygems_version: 3.3.7
74
+ signing_key:
70
75
  specification_version: 4
71
76
  summary: I18n plugin for Jekyll Blogs
72
77
  test_files: []