jekyll-uj-powertools 1.6.18 → 1.6.20

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: d5a95d2533971ede100996d4a58e143ab3ed3979240ef87c8bd77f633427ab8a
4
- data.tar.gz: 296767e306a59dc4453ff79177a33c31ddf0a05b3bf4f39a5a76472072a96d35
3
+ metadata.gz: b131d25be9e613bbb3dd3d26250d01ad0d8f20b4943da498cd872801011c4259
4
+ data.tar.gz: 492dcd5dee0a8b683aca2943d8f4049a646fcd0a19e055686609d74b45ad6ad3
5
5
  SHA512:
6
- metadata.gz: c82375ecc6c963b9893c61b963609d41d8ef4ee58f9583b41fbcfea079b29f710f1a825ba9f24f65b3f76b7fdd6ab258c3507415b7ff0e96f68b318026527803
7
- data.tar.gz: a44445aa47cce16fd5b9f5f203ec58161ed334017acd8fce48c55f17a17e4fe974d8dc8cc7b92907dedaf0f38983fb30605c41859a2db23758b2915fe7533980
6
+ metadata.gz: afc3819babe7990b10b2d9aea510bc0a9d31f69c5e7852bb6d228ab5d4790704b4ca99ffc0269a6b042190c4a91a3def0c8905dc60b32c16c75dfb6b37c93add
7
+ data.tar.gz: c1e43f573e78356b4e1b448afaa5c37ffd26ddbd982f16569076afd45553e07912de915c92941542ea987b95d034205e76088d7b08e7747d200c7f7e06e17dfc
data/README.md CHANGED
@@ -70,6 +70,20 @@ Convert a string to title case.
70
70
  {{ "hello world" | uj_title_case }}
71
71
  ```
72
72
 
73
+ ### `uj_commaify` Filter
74
+ Format numbers with commas for better readability (e.g., 10000 becomes 10,000).
75
+
76
+ ```liquid
77
+ {{ 10000 | uj_commaify }}
78
+ <!-- Output: 10,000 -->
79
+
80
+ {{ 1234567890 | uj_commaify }}
81
+ <!-- Output: 1,234,567,890 -->
82
+
83
+ {{ 1234.56 | uj_commaify }}
84
+ <!-- Output: 1,234.56 -->
85
+ ```
86
+
73
87
  ### `uj_content_format` Filter
74
88
  Process content with Liquid templating and Markdown conversion, automatically transforming markdown and liquid into HTML intelligently based on the file type.
75
89
 
@@ -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.6.18"
8
+ spec.version = "1.6.20"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
data/lib/filters/main.rb CHANGED
@@ -142,6 +142,19 @@ module Jekyll
142
142
  JSON.pretty_generate(input, indent: indent_string)
143
143
  end
144
144
 
145
+ # Format a number with commas (e.g., 10000 becomes 10,000)
146
+ def uj_commaify(input)
147
+ return input unless input
148
+
149
+ str = input.to_s.strip
150
+ return input if str.empty?
151
+
152
+ # Check if the string is a valid number (integer or decimal, possibly negative)
153
+ return input unless str.match?(/^-?\d+(\.\d+)?$/)
154
+
155
+ str.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse
156
+ end
157
+
145
158
  private
146
159
 
147
160
  # Helper method to safely dig through nested hashes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-uj-powertools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.18
4
+ version: 1.6.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITW Creative Works
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-26 00:00:00.000000000 Z
11
+ date: 2025-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll