jekyll-uj-powertools 1.6.19 → 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 +4 -4
- data/README.md +14 -0
- data/jekyll-uj-powertools.gemspec +1 -1
- data/lib/filters/main.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b131d25be9e613bbb3dd3d26250d01ad0d8f20b4943da498cd872801011c4259
|
|
4
|
+
data.tar.gz: 492dcd5dee0a8b683aca2943d8f4049a646fcd0a19e055686609d74b45ad6ad3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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.
|
|
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-
|
|
11
|
+
date: 2025-11-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|