jekyll-uj-powertools 1.6.15 → 1.6.17
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 +1 -1
- data/jekyll-uj-powertools.gemspec +1 -1
- data/lib/filters/main.rb +44 -12
- data/lib/tags/post.rb +2 -2
- 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: 86b383fbc3a2748b24de6dfe43cbc15390f87dce1135420a93474452462d6452
|
|
4
|
+
data.tar.gz: ef2f2c561dc2d3a7a3ce2079cde3f096de20487eaa0b2a5906f234ef5baaf9c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6dbf38eac9453fc077455f250cd74df53bb747309051ba5e4bd862a73970d341c050921b4a69c3296609b97a65050ff9e8c55fad29f99184cf924469f2474b0d
|
|
7
|
+
data.tar.gz: 506682bee8f0e2e14dc6044580f38c5d17237ea33d425d02df1d959e8d84f595c84dbe3072ddc6f95177d4633b71f67ed66eea49aec0f9feed7bf43d0bc82e1f
|
data/README.md
CHANGED
|
@@ -71,7 +71,7 @@ Convert a string to title case.
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
### `uj_content_format` Filter
|
|
74
|
-
Process content with Liquid templating and Markdown conversion, automatically transforming markdown
|
|
74
|
+
Process content with Liquid templating and Markdown conversion, automatically transforming markdown and liquid into HTML intelligently based on the file type.
|
|
75
75
|
|
|
76
76
|
```liquid
|
|
77
77
|
{{ post.content | uj_content_format }}
|
data/lib/filters/main.rb
CHANGED
|
@@ -77,21 +77,17 @@ module Jekyll
|
|
|
77
77
|
def uj_content_format(input)
|
|
78
78
|
# Return empty string if input is nil
|
|
79
79
|
return '' unless input
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
# Get the current page from context
|
|
82
82
|
page = @context.registers[:page] if @context.respond_to?(:registers)
|
|
83
83
|
page ||= @context[:registers][:page] if @context.is_a?(Hash)
|
|
84
|
-
|
|
84
|
+
|
|
85
85
|
# Get site from context
|
|
86
86
|
site = @context.registers[:site] if @context.respond_to?(:registers)
|
|
87
87
|
site ||= @context[:registers][:site] if @context.is_a?(Hash)
|
|
88
88
|
|
|
89
|
-
#
|
|
90
|
-
liquified =
|
|
91
|
-
Liquid::Template.parse(input).render(@context)
|
|
92
|
-
else
|
|
93
|
-
Liquid::Template.parse(input).render(@context[:registers] || {})
|
|
94
|
-
end
|
|
89
|
+
# Apply recursive liquify (markdown images are already converted to uj_image tags by the hook)
|
|
90
|
+
liquified = uj_liquify(input)
|
|
95
91
|
|
|
96
92
|
# Check if the page extension is .md
|
|
97
93
|
if page && page['extension'] == '.md' && site
|
|
@@ -104,25 +100,61 @@ module Jekyll
|
|
|
104
100
|
end
|
|
105
101
|
end
|
|
106
102
|
|
|
103
|
+
# # Process Liquid template syntax within a string
|
|
104
|
+
# def liquify(input)
|
|
105
|
+
# return '' unless input
|
|
106
|
+
|
|
107
|
+
# if @context.respond_to?(:registers)
|
|
108
|
+
# Liquid::Template.parse(input).render(@context)
|
|
109
|
+
# else
|
|
110
|
+
# Liquid::Template.parse(input).render(@context[:registers] || {})
|
|
111
|
+
# end
|
|
112
|
+
# end
|
|
113
|
+
|
|
114
|
+
# Process Liquid template syntax within a string, recursively handling nested Liquid variables
|
|
115
|
+
def uj_liquify(input, max_depth = 10)
|
|
116
|
+
return '' unless input
|
|
117
|
+
|
|
118
|
+
depth = 0
|
|
119
|
+
result = input.to_s
|
|
120
|
+
|
|
121
|
+
# Keep processing while we detect Liquid syntax and haven't exceeded max depth
|
|
122
|
+
while (result.include?('{{') || result.include?('{%')) && depth < max_depth
|
|
123
|
+
new_result = if @context.respond_to?(:registers)
|
|
124
|
+
Liquid::Template.parse(result).render(@context)
|
|
125
|
+
else
|
|
126
|
+
Liquid::Template.parse(result).render(@context[:registers] || {})
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# If nothing changed, we're done (prevents infinite loops)
|
|
130
|
+
break if new_result == result
|
|
131
|
+
|
|
132
|
+
result = new_result
|
|
133
|
+
depth += 1
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
result
|
|
137
|
+
end
|
|
138
|
+
|
|
107
139
|
# Pretty print JSON with configurable indentation (default 2 spaces)
|
|
108
140
|
def uj_jsonify(input, indent_size = 2)
|
|
109
141
|
indent_string = ' ' * indent_size.to_i
|
|
110
142
|
JSON.pretty_generate(input, indent: indent_string)
|
|
111
143
|
end
|
|
112
|
-
|
|
144
|
+
|
|
113
145
|
private
|
|
114
|
-
|
|
146
|
+
|
|
115
147
|
# Helper method to safely dig through nested hashes
|
|
116
148
|
def dig_value(hash, *keys)
|
|
117
149
|
return nil unless hash
|
|
118
|
-
|
|
150
|
+
|
|
119
151
|
value = hash
|
|
120
152
|
keys.each do |key|
|
|
121
153
|
return nil unless value.is_a?(Hash)
|
|
122
154
|
value = value[key]
|
|
123
155
|
return nil if value.nil?
|
|
124
156
|
end
|
|
125
|
-
|
|
157
|
+
|
|
126
158
|
value
|
|
127
159
|
end
|
|
128
160
|
end
|
data/lib/tags/post.rb
CHANGED
|
@@ -59,7 +59,7 @@ module Jekyll
|
|
|
59
59
|
# Extract the slug from the Jekyll post ID
|
|
60
60
|
post_id_clean = post.id.gsub(/^\/(\w+)\//, '')
|
|
61
61
|
slug = post_id_clean.gsub(/^\d{4}-\d{2}-\d{2}-/, '')
|
|
62
|
-
"/assets/images/blog/
|
|
62
|
+
"/assets/images/blog/post-#{custom_id}/#{slug}.jpg"
|
|
63
63
|
when 'image-tag'
|
|
64
64
|
# Generate image path
|
|
65
65
|
# Use the custom post.post.id if available, otherwise fall back to extracting from post.id
|
|
@@ -67,7 +67,7 @@ module Jekyll
|
|
|
67
67
|
# Extract the slug from the Jekyll post ID
|
|
68
68
|
post_id_clean = post.id.gsub(/^\/(\w+)\//, '')
|
|
69
69
|
slug = post_id_clean.gsub(/^\d{4}-\d{2}-\d{2}-/, '')
|
|
70
|
-
image_path = "/assets/images/blog/
|
|
70
|
+
image_path = "/assets/images/blog/post-#{custom_id}/#{slug}.jpg"
|
|
71
71
|
|
|
72
72
|
# Parse additional options for the image tag
|
|
73
73
|
image_options = parse_image_options(args[2..-1], context)
|
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.17
|
|
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-
|
|
11
|
+
date: 2025-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|