jekyll-uj-powertools 1.7.9 → 1.8.0

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
  SHA256:
3
- metadata.gz: 8946df06f9ff9ff4de4bbb7566928462e64736badf6a6900d817d2312cd39c85
4
- data.tar.gz: 871c60f06351aad8001c10f93febe0aafb6f5a2b3d488e4a0befc966efe68f32
3
+ metadata.gz: 9b1097837273bf9312cb1843a4ab7d21c2f39e77cb46fe17278e537187169ac8
4
+ data.tar.gz: b8cb6c1887db39036e2bbfda9a8202ae84a3757b274f2d15816f49c2f4876586
5
5
  SHA512:
6
- metadata.gz: caa39030a002f773855dc36f8617188d42d429a7c31ff9bf7ad41a86c60a31b0dc2258581990a9c577aad9521028e7c511db639500554111997ffb7d23f530bf
7
- data.tar.gz: '05308773511835643c641184e7960634e4e9858977161f8e574c8e835a2cccfc213884321c655acf4b66c189a37053fe554d99bd8377d0edccc112eb850cf0c9'
6
+ metadata.gz: 4c1331d50ce020eae288af9f6b44f660c12a993896a23feaf07759a2b5e9a651ad0dd05978fc87822e80451a7b3c26b998b4c206518726ff39532d3cb28513f2
7
+ data.tar.gz: 0e5d3c60d82d22ca51d99c05174a8518c0fd84864a14f279376e629d4a757a9fd4386f646b9d1ffce0dd4828672459ab800a93a17fad338817c9f499aee9154c
data/README.md CHANGED
@@ -106,6 +106,28 @@ Format numbers with commas for better readability (e.g., 10000 becomes 10,000).
106
106
  <!-- Output: 1,234.56 -->
107
107
  ```
108
108
 
109
+ ### `uj_append_param` Filter
110
+ Intelligently append a query parameter to a URL, using `?` or `&` depending on whether the URL already has a query string.
111
+
112
+ ```liquid
113
+ {{ "https://example.com/img.png" | uj_append_param: "cb", "123" }}
114
+ <!-- Output: https://example.com/img.png?cb=123 -->
115
+
116
+ {{ "https://example.com/img.png?w=200" | uj_append_param: "cb", "123" }}
117
+ <!-- Output: https://example.com/img.png?w=200&cb=123 -->
118
+ ```
119
+
120
+ ### `uj_cachebreak` Filter
121
+ Append a cache-busting query parameter (`cb=<timestamp>`) to any URL. Uses the same consistent timestamp as `site.uj.cache_breaker`. Handles URLs with or without existing query strings.
122
+
123
+ ```liquid
124
+ {{ site.brand.images.brandmark | uj_cachebreak }}
125
+ <!-- Output: https://cdn.example.com/logo.svg?cb=1234567890 -->
126
+
127
+ {{ "/assets/css/main.bundle.css" | uj_cachebreak }}
128
+ <!-- Output: /assets/css/main.bundle.css?cb=1234567890 -->
129
+ ```
130
+
109
131
  ### `uj_content_format` Filter
110
132
  Process content with Liquid templating and Markdown conversion, automatically transforming markdown and liquid into HTML intelligently based on the file type.
111
133
 
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  Gem::Specification.new do |spec|
6
6
  # Gem info
7
7
  spec.name = "jekyll-uj-powertools"
8
- spec.version = "1.7.9"
8
+ spec.version = "1.8.0"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
data/lib/filters/main.rb CHANGED
@@ -149,6 +149,25 @@ module Jekyll
149
149
  JSON.pretty_generate(input, indent: indent_string)
150
150
  end
151
151
 
152
+ # Append a query parameter to a URL, handling existing query strings
153
+ # Usage: {{ "https://example.com/img.png" | uj_append_param: "cb", "123" }}
154
+ # => "https://example.com/img.png?cb=123"
155
+ # Usage: {{ "https://example.com/img.png?w=200" | uj_append_param: "cb", "123" }}
156
+ # => "https://example.com/img.png?w=200&cb=123"
157
+ def uj_append_param(input, key, value)
158
+ return input if input.nil? || input.to_s.strip.empty?
159
+ url = input.to_s.strip
160
+ sep = url.include?('?') ? '&' : '?'
161
+ "#{url}#{sep}#{key}=#{value}"
162
+ end
163
+
164
+ # Append a cache-busting query parameter to a URL
165
+ # Usage: {{ "https://example.com/img.png" | uj_cachebreak }}
166
+ # => "https://example.com/img.png?cb=1234567890"
167
+ def uj_cachebreak(input)
168
+ uj_append_param(input, 'cb', UJPowertools.cache_timestamp)
169
+ end
170
+
152
171
  # Pluralize a word based on a count
153
172
  # Usage: {{ count | uj_pluralize: 'singular', 'plural' }}
154
173
  # Example: {{ 5 | uj_pluralize: 'post', 'posts' }} => 'posts'
data/lib/tags/icon.rb CHANGED
@@ -32,6 +32,10 @@ module Jekyll
32
32
  'he' => 'il', # Hebrew -> Israel
33
33
  'th' => 'th', # Thai -> Thailand
34
34
  'vi' => 'vn', # Vietnamese -> Vietnam
35
+ 'ur' => 'pk', # Urdu -> Pakistan
36
+ 'id' => 'id', # Indonesian -> Indonesia
37
+ 'bn' => 'bd', # Bengali -> Bangladesh
38
+ 'tl' => 'ph', # Tagalog/Filipino -> Philippines
35
39
  'uk' => 'ua', # Ukrainian -> Ukraine
36
40
  'cs' => 'cz', # Czech -> Czech Republic
37
41
  'hu' => 'hu', # Hungarian -> Hungary
@@ -37,7 +37,13 @@ module Jekyll
37
37
 
38
38
  # Normalize the URL path
39
39
  normalized_path = normalize_path(url_path)
40
-
40
+
41
+ # If the page is excluded from translation, return the un-prefixed URL
42
+ excludes = translation_config['exclude'] || []
43
+ if page_excluded?(normalized_path, excludes)
44
+ return normalized_path.empty? ? '/' : "/#{normalized_path}"
45
+ end
46
+
41
47
  # Generate the language-specific URL
42
48
  generate_language_url(language_code, normalized_path, default_language)
43
49
  end
@@ -66,6 +72,14 @@ module Jekyll
66
72
  clean_path
67
73
  end
68
74
 
75
+ def page_excluded?(normalized_path, excludes)
76
+ return false if excludes.empty? || normalized_path.empty?
77
+
78
+ excludes.any? do |exclude|
79
+ normalized_path == exclude || normalized_path.start_with?("#{exclude}/")
80
+ end
81
+ end
82
+
69
83
  def generate_language_url(language_code, normalized_path, default_language)
70
84
  # If it's the default language, return the original path
71
85
  if language_code == default_language
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-uj-powertools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.9
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITW Creative Works