jekyll-uj-powertools 1.6.23 → 1.6.24

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: f8e4f51fc9ea4a48db55c09c67dc157e8ff10a2ac3ec70b0725cd691f22e8eeb
4
- data.tar.gz: bd0025c8a7b871ce18e261c7b7a11d9eec2dfa756769905682eaecc681771d27
3
+ metadata.gz: 8e244425c0a57091b17d74eeb82b585314a5892bc4d2185e6dc50b5d66d7d16c
4
+ data.tar.gz: e999ee1ea01bee859c675e451c3d8323c984b225a7ae2438f3d06f1f43158848
5
5
  SHA512:
6
- metadata.gz: 265cb3b441bf454a72cb0dd80fd7357c8a775e91602969b8ed2f35068825baf3b48571fbbe7841ca801a694f17c2c7f2bb107a7c860af1c965e369448c4f6d2a
7
- data.tar.gz: 60a90ebbfc3a02462063ade9848b1f58ed50596a525a6a1fd9d4547de89cb048dbd712e8b9f6dedfee86e1003365a021fc2a615a4a9938914c94d6901dc9e210
6
+ metadata.gz: 4042544bbfb0c7e818b9d56ab22adb617c0e5ab74f5284e03eaab1c2a5fed114b77e3d7860759cdef9d0ba9d057b542e5e916f690bda237defbf7426056fcff7
7
+ data.tar.gz: cd588783c0bd5b02069eb47363352d6200d03de8b4208004a34a23db7372a123dffc47b2138174e7969f4380cf39f649ac977c06a41e6dfbedd7469592732a5f
@@ -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.23"
8
+ spec.version = "1.6.24"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
data/lib/tags/logo.rb CHANGED
@@ -5,12 +5,15 @@ require_relative '../helpers/variable_resolver'
5
5
  module Jekyll
6
6
  class UJLogoTag < Liquid::Tag
7
7
  include UJPowertools::VariableResolver
8
-
8
+
9
9
  # Default logo to show when requested logo is not found
10
10
  DEFAULT_LOGO = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 64C334.7 64 348.2 72.1 355.2 85L571.2 485C577.9 497.4 577.6 512.4 570.4 524.5C563.2 536.6 550.1 544 536 544L104 544C89.9 544 76.9 536.6 69.6 524.5C62.3 512.4 62.1 497.4 68.8 485L284.8 85C291.8 72.1 305.3 64 320 64zM320 232C306.7 232 296 242.7 296 256L296 368C296 381.3 306.7 392 320 392C333.3 392 344 381.3 344 368L344 256C344 242.7 333.3 232 320 232zM346.7 448C347.3 438.1 342.4 428.7 333.9 423.5C325.4 418.4 314.7 418.4 306.2 423.5C297.7 428.7 292.8 438.1 293.4 448C292.8 457.9 297.7 467.3 306.2 472.5C314.7 477.6 325.4 477.6 333.9 472.5C342.4 467.3 347.3 457.9 346.7 448z"/></svg>'
11
-
12
- # Cache for loaded logos to improve performance
11
+
12
+ # Cache for loaded logos (raw SVG content) to improve performance
13
13
  @@logo_cache = {}
14
+
15
+ # Counter for generating unique prefixes per logo instance
16
+ @@instance_counter = 0
14
17
 
15
18
  def initialize(tag_name, markup, tokens)
16
19
  super
@@ -63,22 +66,27 @@ module Jekyll
63
66
  # Get site from context
64
67
  site = context.registers[:site]
65
68
  return '' unless site
66
-
67
- # Load the logo SVG from file
68
- logo_svg = load_logo_from_file(logo_name.to_s, type, color)
69
- return '' unless logo_svg
70
-
71
- # Return the SVG directly
72
- logo_svg
69
+
70
+ # Load the raw logo SVG from file (cached)
71
+ raw_svg = load_logo_from_file(logo_name.to_s, type, color)
72
+ return '' unless raw_svg
73
+
74
+ # Generate unique prefix for this instance to prevent ID conflicts
75
+ # when the same logo is used multiple times on a page
76
+ @@instance_counter += 1
77
+ unique_prefix = "#{logo_name}-#{@@instance_counter}"
78
+
79
+ # Prefix all IDs with unique prefix
80
+ prefix_svg_ids(raw_svg, unique_prefix)
73
81
  end
74
-
82
+
75
83
  private
76
-
84
+
77
85
  def load_logo_from_file(logo_name, type, color)
78
86
  # Create cache key
79
87
  cache_key = "#{type}/#{color}/#{logo_name}"
80
88
 
81
- # Return cached version if available
89
+ # Return cached version if available (raw SVG without prefixing)
82
90
  return @@logo_cache[cache_key] if @@logo_cache.key?(cache_key)
83
91
 
84
92
  # Build file path
@@ -91,10 +99,7 @@ module Jekyll
91
99
  DEFAULT_LOGO
92
100
  end
93
101
 
94
- # Prefix all IDs to prevent conflicts when multiple SVGs are on the same page
95
- logo_svg = prefix_svg_ids(logo_svg, logo_name)
96
-
97
- # Cache the result
102
+ # Cache the raw result (before prefixing)
98
103
  @@logo_cache[cache_key] = logo_svg
99
104
  return logo_svg
100
105
  end
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.6.23
4
+ version: 1.6.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITW Creative Works