jekyll-uj-powertools 1.6.4 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e74f6d968d196904d9306b2b3c15479dafb8adbec2ce42dd1b9e4d2b42660646
4
- data.tar.gz: ac464d3b6a8df83604094e1c5b817af659c32bc58ce76adc3e9b315aa85c85e8
3
+ metadata.gz: 608cc68c81696c6099554e6d4d54ab585c04e4add723321b974e90f2788c2b32
4
+ data.tar.gz: 67e68ad2c9a807409ca6a0af0fe8cdd85582fc478a31d0714c9eaccdd97b0317
5
5
  SHA512:
6
- metadata.gz: 0dd1feb9617342c7a21f15c7f313f11be4d2c2956a592b5ea20289687267514390c0141133eeaaaa4c42b8f959c405ae31d2819613beecd7d6d1eeefc30337cd
7
- data.tar.gz: 81a12879162cc3616076ab55ddf642fef351098986967e1ae55f0efaf79da1aaa7878243fdf263ddff13acb85e41205459d2b2b574c42e8cb82880fac039d06b
6
+ metadata.gz: b6ccd2a2a777435e42d65527f60be6828052e89e041bde5bf35f3c228295908a578b51bd364c29f6bf0dd51223989e6a91ab4081a29b880e29ef7aded1869c41
7
+ data.tar.gz: 4110821b512057be2ec78d1bce933b6d06bab45ea0558e3c33c8de0c403b7ddb33efa548884c78500cd24d52783338acef9f71ce0c1dd887f12bb30b0ca776d6
@@ -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.4"
8
+ spec.version = "1.6.6"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
@@ -26,4 +26,5 @@ module Jekyll
26
26
  require_relative "tags/readtime"
27
27
  require_relative "tags/social"
28
28
  require_relative "tags/translation_url"
29
+ require_relative "tags/urlmatch"
29
30
  end
@@ -0,0 +1,61 @@
1
+ # Libraries
2
+ require_relative '../helpers/variable_resolver'
3
+
4
+ # Tag
5
+ module Jekyll
6
+ module UJPowertools
7
+ class UrlMatchTag < Liquid::Tag
8
+ include VariableResolver
9
+
10
+ def initialize(tag_name, markup, tokens)
11
+ super
12
+ # Parse arguments: url, output_if_active
13
+ args = parse_arguments(markup)
14
+ @url = args[0] || ''
15
+ @output = args[1] || 'active'
16
+ end
17
+
18
+ def render(context)
19
+ # Get the current page URL
20
+ page_url = context['page']['url']
21
+
22
+ # Resolve the URL to check (handles both literals and variables)
23
+ check_url = resolve_input(context, @url, true)
24
+
25
+ # Resolve the output (handles both literals and variables)
26
+ output = resolve_input(context, @output, true)
27
+
28
+ # Normalize URLs to handle index pages
29
+ # /about/index.html becomes /about/
30
+ # / stays as /
31
+ normalized_page_url = normalize_url(page_url)
32
+ normalized_check_url = normalize_url(check_url)
33
+
34
+ # Return output if URLs match, empty string otherwise
35
+ if normalized_page_url == normalized_check_url
36
+ output
37
+ else
38
+ ""
39
+ end
40
+ end
41
+
42
+ private
43
+
44
+ def normalize_url(url)
45
+ return nil if url.nil?
46
+
47
+ # Remove index.html from the end
48
+ normalized = url.sub(/index\.html?$/, '')
49
+
50
+ # Ensure trailing slash for non-root paths
51
+ if normalized != '/' && !normalized.end_with?('/')
52
+ normalized += '/'
53
+ end
54
+
55
+ normalized
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ Liquid::Template.register_tag('urlmatch', Jekyll::UJPowertools::UrlMatchTag)
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
4
+ version: 1.6.6
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-29 00:00:00.000000000 Z
11
+ date: 2025-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -132,6 +132,7 @@ files:
132
132
  - lib/tags/readtime.rb
133
133
  - lib/tags/social.rb
134
134
  - lib/tags/translation_url.rb
135
+ - lib/tags/urlmatch.rb
135
136
  homepage: https://github.com/itw-creative-works/jekyll-uj-powertools
136
137
  licenses:
137
138
  - MIT