jekyll-uj-powertools 1.7.5 → 1.7.6
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 +22 -2
- data/jekyll-uj-powertools.gemspec +7 -1
- data/lib/hooks/markdown-images.rb +13 -0
- metadata +57 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 665278bb3420d90577eddcbd46d8668496b8298ab858942ac157791291987c05
|
|
4
|
+
data.tar.gz: 311075ad1659fcebc05d7c6f5947b9dd47829d537f0955b0b0daa994f759223e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fa8da54ce2296131eb6da539ec89fbdd740f9a114cb8431a846fc9b38e79a1cb35ac4adcdbc701fe4456972088b444f27c269219ec7b45ccca0cab69d252fad7
|
|
7
|
+
data.tar.gz: 847002831063fbe6492c03049be695ab4c03c63d5fdf2ead9eb8f731382ae1da6d246f56e587816caaa85e271f52862c8caf788c9ef767f42a4487e917a349cc
|
data/README.md
CHANGED
|
@@ -115,17 +115,37 @@ Process content with Liquid templating and Markdown conversion, automatically tr
|
|
|
115
115
|
|
|
116
116
|
This filter:
|
|
117
117
|
- Transforms markdown images `` to `{% uj_image "url", alt="alt", class="..." %}`
|
|
118
|
-
-
|
|
118
|
+
- Resolves `@post/` prefix to the post's image directory (see below)
|
|
119
|
+
- Automatically pulls image class from `page.resolved.theme.post.image.class`
|
|
119
120
|
- Processes Liquid tags in the content
|
|
120
121
|
- Converts Markdown to HTML (for .md files)
|
|
121
122
|
|
|
122
123
|
If no class is specified in frontmatter, the `uj_image` tag will be rendered without a class attribute.
|
|
123
124
|
|
|
125
|
+
#### `@post/` Image Shortcut
|
|
126
|
+
|
|
127
|
+
Blog posts can reference images in their post directory using the `@post/` prefix instead of writing the full path:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+

|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
This resolves to `/assets/images/blog/post-{id}/my-image.jpg` where `{id}` comes from the post's `post.id` frontmatter value.
|
|
134
|
+
|
|
135
|
+
**Resolution rules:**
|
|
136
|
+
| Syntax | Resolves to |
|
|
137
|
+
|--------|-------------|
|
|
138
|
+
| `@post/file.jpg` | `/assets/images/blog/post-{id}/file.jpg` |
|
|
139
|
+
| `/assets/images/...` | Used as-is (absolute path) |
|
|
140
|
+
| `https://...` | Used as-is (external URL) |
|
|
141
|
+
|
|
142
|
+
If `@post/` is used on a page without a `post.id`, a warning is logged and the path is left unresolved.
|
|
143
|
+
|
|
124
144
|
#### Frontmatter Configuration Example
|
|
125
145
|
```yaml
|
|
126
146
|
---
|
|
127
147
|
theme:
|
|
128
|
-
|
|
148
|
+
post:
|
|
129
149
|
image:
|
|
130
150
|
class: "img-fluid rounded-3 shadow"
|
|
131
151
|
---
|
|
@@ -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.
|
|
8
|
+
spec.version = "1.7.6"
|
|
9
9
|
|
|
10
10
|
# Author info
|
|
11
11
|
spec.authors = ["ITW Creative Works"]
|
|
@@ -33,6 +33,12 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_development_dependency "simplecov"
|
|
34
34
|
spec.add_development_dependency "ostruct"
|
|
35
35
|
|
|
36
|
+
# Ruby 4.0 removed these from default gems; needed by Jekyll 4.3.x
|
|
37
|
+
spec.add_development_dependency "logger"
|
|
38
|
+
spec.add_development_dependency "csv"
|
|
39
|
+
spec.add_development_dependency "base64"
|
|
40
|
+
spec.add_development_dependency "bigdecimal"
|
|
41
|
+
|
|
36
42
|
# Translation and HTML manipulation requires Nokogiri
|
|
37
43
|
spec.add_runtime_dependency 'nokogiri', '>= 1.17'
|
|
38
44
|
|
|
@@ -15,11 +15,24 @@ module Jekyll
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
# Get post ID for @post/ prefix resolution
|
|
19
|
+
post_id = doc.data['post'] && doc.data['post']['id'] ? doc.data['post']['id'] : nil
|
|
20
|
+
|
|
18
21
|
# Transform markdown images by parsing and rendering Liquid template
|
|
19
22
|
doc.content = doc.content.gsub(/!\[([^\]]*)\]\(([^)]+)\)/) do
|
|
20
23
|
alt_text = $1
|
|
21
24
|
image_path = $2
|
|
22
25
|
|
|
26
|
+
# Resolve @post/ prefix to full blog image path
|
|
27
|
+
if image_path.start_with?('@post/')
|
|
28
|
+
if post_id
|
|
29
|
+
filename = image_path.sub('@post/', '')
|
|
30
|
+
image_path = "/assets/images/blog/post-#{post_id}/#{filename}"
|
|
31
|
+
else
|
|
32
|
+
Jekyll.logger.warn "markdown-images", "@post/ used but no post.id found in #{doc.relative_path}"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
23
36
|
# Build the Liquid tag string
|
|
24
37
|
if image_class
|
|
25
38
|
liquid_tag = "{% uj_image \"#{image_path}\", alt=\"#{alt_text}\", class=\"#{image_class}\" %}"
|
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.
|
|
4
|
+
version: 1.7.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ITW Creative Works
|
|
@@ -99,6 +99,62 @@ dependencies:
|
|
|
99
99
|
- - ">="
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
101
|
version: '0'
|
|
102
|
+
- !ruby/object:Gem::Dependency
|
|
103
|
+
name: logger
|
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
106
|
+
- - ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: '0'
|
|
109
|
+
type: :development
|
|
110
|
+
prerelease: false
|
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '0'
|
|
116
|
+
- !ruby/object:Gem::Dependency
|
|
117
|
+
name: csv
|
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
- - ">="
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: '0'
|
|
123
|
+
type: :development
|
|
124
|
+
prerelease: false
|
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
126
|
+
requirements:
|
|
127
|
+
- - ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: '0'
|
|
130
|
+
- !ruby/object:Gem::Dependency
|
|
131
|
+
name: base64
|
|
132
|
+
requirement: !ruby/object:Gem::Requirement
|
|
133
|
+
requirements:
|
|
134
|
+
- - ">="
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: '0'
|
|
137
|
+
type: :development
|
|
138
|
+
prerelease: false
|
|
139
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - ">="
|
|
142
|
+
- !ruby/object:Gem::Version
|
|
143
|
+
version: '0'
|
|
144
|
+
- !ruby/object:Gem::Dependency
|
|
145
|
+
name: bigdecimal
|
|
146
|
+
requirement: !ruby/object:Gem::Requirement
|
|
147
|
+
requirements:
|
|
148
|
+
- - ">="
|
|
149
|
+
- !ruby/object:Gem::Version
|
|
150
|
+
version: '0'
|
|
151
|
+
type: :development
|
|
152
|
+
prerelease: false
|
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
154
|
+
requirements:
|
|
155
|
+
- - ">="
|
|
156
|
+
- !ruby/object:Gem::Version
|
|
157
|
+
version: '0'
|
|
102
158
|
- !ruby/object:Gem::Dependency
|
|
103
159
|
name: nokogiri
|
|
104
160
|
requirement: !ruby/object:Gem::Requirement
|