jekyll-uj-powertools 1.6.1 → 1.6.2
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/jekyll-uj-powertools.gemspec +1 -1
- data/lib/jekyll-uj-powertools.rb +8 -7
- data/lib/tags/iffile.rb +70 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 035a3dbc797be68fa2e9dd84f80417b63672994e25362ce47897a254da7faa12
|
4
|
+
data.tar.gz: b7e4edc28279b80e0aadcae6435dd1283517d6f3aa68b9f65dfe99edfe0ae94a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7c040655729bec85fc2c08b36bc84a759b518884c5f408bd75b0b735d05fdfee891b182f24b4b1f53004fe002bc7e23e31ff20fa6722871c82b83fe12964e1
|
7
|
+
data.tar.gz: 8ebda7bd0080113e1496fa8092889b79f80573a2c8241df1e07708b95e581dd1c143769561c295254070edcf40709cf3a5b48ba3e6965e5a3db524774e33ca0e
|
data/lib/jekyll-uj-powertools.rb
CHANGED
@@ -13,15 +13,16 @@ module Jekyll
|
|
13
13
|
require_relative "hooks/markdown-images"
|
14
14
|
|
15
15
|
# Load Tags
|
16
|
-
require_relative "tags/iftruthy"
|
17
|
-
require_relative "tags/iffalsy"
|
18
|
-
require_relative "tags/icon"
|
19
|
-
require_relative "tags/social"
|
20
|
-
require_relative "tags/readtime"
|
21
16
|
require_relative "tags/fake_comments"
|
22
|
-
require_relative "tags/
|
17
|
+
require_relative "tags/icon"
|
18
|
+
require_relative "tags/iffalsy"
|
19
|
+
require_relative "tags/iffile"
|
20
|
+
require_relative "tags/iftruthy"
|
23
21
|
require_relative "tags/image"
|
24
|
-
require_relative "tags/post"
|
25
22
|
require_relative "tags/language"
|
23
|
+
require_relative "tags/member"
|
24
|
+
require_relative "tags/post"
|
25
|
+
require_relative "tags/readtime"
|
26
|
+
require_relative "tags/social"
|
26
27
|
require_relative "tags/translation_url"
|
27
28
|
end
|
data/lib/tags/iffile.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# Libraries
|
2
|
+
# ...
|
3
|
+
|
4
|
+
# Tag
|
5
|
+
module Jekyll
|
6
|
+
module UJPowertools
|
7
|
+
class IfFileTag < Liquid::Block
|
8
|
+
def initialize(tag_name, markup, tokens)
|
9
|
+
super
|
10
|
+
@path = markup.strip
|
11
|
+
end
|
12
|
+
|
13
|
+
def render(context)
|
14
|
+
# Get the site object
|
15
|
+
site = context.registers[:site]
|
16
|
+
|
17
|
+
puts "[iffile] Input markup: #{@path}"
|
18
|
+
|
19
|
+
# Resolve the path variable if it's a variable name
|
20
|
+
path = context[@path] || @path
|
21
|
+
puts "[iffile] After context lookup: #{path}"
|
22
|
+
|
23
|
+
# Handle nested variables like page.css_path
|
24
|
+
if @path.include?('.')
|
25
|
+
parts = @path.split('.')
|
26
|
+
path = context[parts.first]
|
27
|
+
parts[1..-1].each do |part|
|
28
|
+
path = path.is_a?(Hash) ? path[part] : nil
|
29
|
+
break if path.nil?
|
30
|
+
end
|
31
|
+
puts "[iffile] After nested lookup: #{path}"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Ensure path starts with /
|
35
|
+
path = "/#{path}" unless path.to_s.start_with?('/')
|
36
|
+
puts "[iffile] Final path to check: #{path}"
|
37
|
+
|
38
|
+
# Check if file exists in static_files
|
39
|
+
puts "[iffile] Path to check: #{path}"
|
40
|
+
|
41
|
+
# Debug: show first few static files
|
42
|
+
puts "[iffile] Sample static files (first 5 CSS files):"
|
43
|
+
site.static_files.select { |f| f.relative_path.end_with?('.css') }.first(5).each do |file|
|
44
|
+
puts " - #{file.relative_path}"
|
45
|
+
end
|
46
|
+
|
47
|
+
file_exists = site.static_files.any? { |file|
|
48
|
+
# Compare both with and without leading slash
|
49
|
+
matches = file.relative_path == path ||
|
50
|
+
file.relative_path == path[1..-1] ||
|
51
|
+
"/#{file.relative_path}" == path
|
52
|
+
if matches
|
53
|
+
puts "[iffile] FOUND MATCH: #{file.relative_path}"
|
54
|
+
end
|
55
|
+
matches
|
56
|
+
}
|
57
|
+
|
58
|
+
puts "[iffile] File exists: #{file_exists}"
|
59
|
+
|
60
|
+
if file_exists
|
61
|
+
super
|
62
|
+
else
|
63
|
+
""
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
Liquid::Template.register_tag('iffile', Jekyll::UJPowertools::IfFileTag)
|
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.2
|
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-08-
|
11
|
+
date: 2025-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/tags/fake_comments.rb
|
122
122
|
- lib/tags/icon.rb
|
123
123
|
- lib/tags/iffalsy.rb
|
124
|
+
- lib/tags/iffile.rb
|
124
125
|
- lib/tags/iftruthy.rb
|
125
126
|
- lib/tags/image.rb
|
126
127
|
- lib/tags/language.rb
|