jekyll-uj-powertools 1.6.1 → 1.6.3
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 +51 -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: 0bb2525b4822d44d79b90f95dd50e2f4231fc1696825edeaafd13273e42834c4
|
4
|
+
data.tar.gz: eb8b0c45df97fd704a7cda6d2d532606ebf260b10d32edc14588728b3de23684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08a2ff66c6ba2f03ff2b4e694401c65b09b07a57015b2852e55cae268ab50dd68b2714d7cb5c5b29f755d3a8ab2bca089c63d938587dbdeb94904a3abe2421a
|
7
|
+
data.tar.gz: c2248351129af1c9494262f9ec1d99746f495cc3f124d6b875ab0c1bb765b845d38bf3e16ac35e9e9db119f1f7bc5b22ff407f08b2b8c52ce79103274d49fcfa
|
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,51 @@
|
|
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
|
+
# Resolve the path variable if it's a variable name
|
18
|
+
path = context[@path] || @path
|
19
|
+
|
20
|
+
# Handle nested variables like page.css_path
|
21
|
+
if @path.include?('.')
|
22
|
+
parts = @path.split('.')
|
23
|
+
path = context[parts.first]
|
24
|
+
parts[1..-1].each do |part|
|
25
|
+
path = path.is_a?(Hash) ? path[part] : nil
|
26
|
+
break if path.nil?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Ensure path starts with /
|
31
|
+
path = "/#{path}" unless path.to_s.start_with?('/')
|
32
|
+
|
33
|
+
# Check if file exists in static_files
|
34
|
+
file_exists = site.static_files.any? { |file|
|
35
|
+
# Compare both with and without leading slash
|
36
|
+
file.relative_path == path ||
|
37
|
+
file.relative_path == path[1..-1] ||
|
38
|
+
"/#{file.relative_path}" == path
|
39
|
+
}
|
40
|
+
|
41
|
+
if file_exists
|
42
|
+
super
|
43
|
+
else
|
44
|
+
""
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
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.3
|
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
|