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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4457cc2876947bfe080aa15d492f502208e3dd64573c71e11eb3735cf6a6a6b7
4
- data.tar.gz: d8cbd12fcdccc5aedad51ded42d41d03a86cbc92610b722705b16ceafffc50c9
3
+ metadata.gz: 035a3dbc797be68fa2e9dd84f80417b63672994e25362ce47897a254da7faa12
4
+ data.tar.gz: b7e4edc28279b80e0aadcae6435dd1283517d6f3aa68b9f65dfe99edfe0ae94a
5
5
  SHA512:
6
- metadata.gz: 9e6058f9e42984ad01939d759cc706daaf1af6a88bea81d33fd30815ca34ba05a48e2491f5b40abb8548990f11122f60bf190b1cdc6daae8b2a2a0d4d9d526b3
7
- data.tar.gz: 80348c6d1d507ae4301cf48e4b862e8687d404260edd9c0fbeb34633c7c23993a18dbde89d54e5d3dcf83052fd88563cec6b76a7e1637bb6573c5647f469f48a
6
+ metadata.gz: 9c7c040655729bec85fc2c08b36bc84a759b518884c5f408bd75b0b735d05fdfee891b182f24b4b1f53004fe002bc7e23e31ff20fa6722871c82b83fe12964e1
7
+ data.tar.gz: 8ebda7bd0080113e1496fa8092889b79f80573a2c8241df1e07708b95e581dd1c143769561c295254070edcf40709cf3a5b48ba3e6965e5a3db524774e33ca0e
@@ -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.1"
8
+ spec.version = "1.6.2"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
@@ -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/member"
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
@@ -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.1
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-22 00:00:00.000000000 Z
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