jekyll-uj-powertools 1.6.22 → 1.6.23

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: f5e12576d7e500881fe56b9a6fdf6963b458635435ae7f27ef03df1562410c7a
4
- data.tar.gz: 2418ef5a2771bb1383be22a27830beb6d9d513652f48eb2741204315eb2ec442
3
+ metadata.gz: f8e4f51fc9ea4a48db55c09c67dc157e8ff10a2ac3ec70b0725cd691f22e8eeb
4
+ data.tar.gz: bd0025c8a7b871ce18e261c7b7a11d9eec2dfa756769905682eaecc681771d27
5
5
  SHA512:
6
- metadata.gz: bde8bed7311f9b164d05608c4eef60984cb995598367f44ec05d8e46f21a6569692066a615e7f239f0f48dcdd92c693f660e508ab6e4b6b7dfdca945ffe67f45
7
- data.tar.gz: 6b4ac3a7cb149197bad09eabacd25a8c2d05c899fede95e564464d37aa6e97e37de880e419269030419b8b44a46085bc88cecd0add0186e3125c1bb0d0ecee55
6
+ metadata.gz: 265cb3b441bf454a72cb0dd80fd7357c8a775e91602969b8ed2f35068825baf3b48571fbbe7841ca801a694f17c2c7f2bb107a7c860af1c965e369448c4f6d2a
7
+ data.tar.gz: 60a90ebbfc3a02462063ade9848b1f58ed50596a525a6a1fd9d4547de89cb048dbd712e8b9f6dedfee86e1003365a021fc2a615a4a9938914c94d6901dc9e210
@@ -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.22"
8
+ spec.version = "1.6.23"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
data/lib/tags/logo.rb CHANGED
@@ -77,24 +77,60 @@ module Jekyll
77
77
  def load_logo_from_file(logo_name, type, color)
78
78
  # Create cache key
79
79
  cache_key = "#{type}/#{color}/#{logo_name}"
80
-
80
+
81
81
  # Return cached version if available
82
82
  return @@logo_cache[cache_key] if @@logo_cache.key?(cache_key)
83
-
83
+
84
84
  # Build file path
85
85
  logo_path = File.join(Dir.pwd, 'node_modules', 'ultimate-jekyll-manager', 'assets', 'logos', type, color, "#{logo_name}.svg")
86
-
86
+
87
87
  # Try to load the logo
88
88
  logo_svg = if File.exist?(logo_path)
89
89
  File.read(logo_path)
90
90
  else
91
91
  DEFAULT_LOGO
92
92
  end
93
-
93
+
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
+
94
97
  # Cache the result
95
98
  @@logo_cache[cache_key] = logo_svg
96
99
  return logo_svg
97
100
  end
101
+
102
+ # Prefix all IDs in an SVG with the logo name to prevent conflicts
103
+ # when multiple SVGs are inlined on the same page
104
+ def prefix_svg_ids(svg_content, prefix)
105
+ # Find all id attributes in the SVG
106
+ ids = svg_content.scan(/\bid=["']([^"']+)["']/).flatten.uniq
107
+
108
+ return svg_content if ids.empty?
109
+
110
+ result = svg_content.dup
111
+
112
+ ids.each do |id|
113
+ new_id = "#{prefix}-#{id}"
114
+
115
+ # Replace id definitions: id="X" and id='X'
116
+ result.gsub!(/\bid=(["'])#{Regexp.escape(id)}\1/, "id=\"#{new_id}\"")
117
+
118
+ # Replace url() references: url(#X) and url('#X') and url("#X")
119
+ result.gsub!(/url\(\s*##{Regexp.escape(id)}\s*\)/, "url(##{new_id})")
120
+ result.gsub!(/url\(\s*["']##{Regexp.escape(id)}["']\s*\)/, "url(##{new_id})")
121
+
122
+ # Replace xlink:href references: xlink:href="#X"
123
+ result.gsub!(/xlink:href=["']##{Regexp.escape(id)}["']/, "xlink:href=\"##{new_id}\"")
124
+
125
+ # Replace x:href references (custom namespace, convert to standard href): x:href="#X"
126
+ result.gsub!(/x:href=["']##{Regexp.escape(id)}["']/, "href=\"##{new_id}\"")
127
+
128
+ # Replace href references (modern SVG): href="#X"
129
+ result.gsub!(/\bhref=["']##{Regexp.escape(id)}["']/, "href=\"##{new_id}\"")
130
+ end
131
+
132
+ result
133
+ end
98
134
  end
99
135
  end
100
136
 
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.22
4
+ version: 1.6.23
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-12-10 00:00:00.000000000 Z
11
+ date: 2025-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll