jekyll-uj-powertools 1.6.8 → 1.6.10

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: d818935d84b35baf61dd1723e9dc8e5ec2368749cf69d739a62f4bc30dc12373
4
- data.tar.gz: 1287d22473fa932605dfa5c9f3aff56186a68804dc2918b5b1c1ea6aba808183
3
+ metadata.gz: 35b84beec0a95ec93970628a610e4544bd05222f56cc506182004b92ab385a2a
4
+ data.tar.gz: ad6b772e401fbb29e1a84c0318cf8ee3140849ebf669d9dd4ae431ca10c692aa
5
5
  SHA512:
6
- metadata.gz: 86125c0ab8e83e97d56dbac117a390cfc96a75a29c503b2477cd878ea40d7c8934a7311308a81041edbc6632bfb0b8e73cb7e54eb9751533f55c108568801b56
7
- data.tar.gz: 9d93407b502539084a03d3b35c1f2ebbc9254644fb4a022aa27c243377b5aced5d44ec0ca097d5dccee3a5282499bd2fccf94f034e041b61f6411481c635243e
6
+ metadata.gz: 0c3e1446d8a13f702a3a8ba18b83b37722639c60c7a4deaf29ec8428872dab68569dd4b3cd4848b24bd1e514ac740be8d6ebe82005767b0e06434b81782b88ea
7
+ data.tar.gz: 14fc27afef757637bfb264fdb34421d134812d2fc14078e3fa7039024659d38662449adb331a42ce15abe0aaad7c047fe51198ddacd0166303c1cfcd19aa01d2
data/README.md CHANGED
@@ -176,6 +176,27 @@ A custom Liquid tag that renders a Font Awesome icon with the specified style an
176
176
  {% uj_icon "rocket", "fa-lg me-2" %}
177
177
  ```
178
178
 
179
+ ### `uj_logo` Tag
180
+ A custom Liquid tag that renders company logos from the Ultimate Jekyll Manager assets. It supports brandmarks and combomarks in various colors.
181
+
182
+ Parameters:
183
+ - `name` (required): The logo name (e.g., "jira", "fitbit", "github")
184
+ - `type` (optional): "brandmarks" (default) or "combomarks"
185
+ - `color` (optional): "original" (default) or any other color variant (e.g., "white", "black")
186
+
187
+ ```liquid
188
+ {% uj_logo "jira" %}
189
+ {% uj_logo "fitbit", "combomarks" %}
190
+ {% uj_logo "slack", "brandmarks", "white" %}
191
+ {% uj_logo site.company.logo, "combomarks", "black" %}
192
+ ```
193
+
194
+ The tag supports dynamic variables and will resolve them from the context:
195
+ ```liquid
196
+ {% uj_logo page.sponsor.logo %}
197
+ {% uj_logo site.partner.name, site.partner.type, site.partner.color %}
198
+ ```
199
+
179
200
  ### `uj_fake_comments` Tag
180
201
  Generates a fake comment count based on content word count for demonstration purposes.
181
202
  ```liquid
@@ -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.8"
8
+ spec.version = "1.6.10"
9
9
 
10
10
  # Author info
11
11
  spec.authors = ["ITW Creative Works"]
@@ -15,4 +15,8 @@ Jekyll::Hooks.register :site, :pre_render do |site|
15
15
  site.config['uj']['date']['year'] = now.year
16
16
  site.config['uj']['date']['month'] = now.month
17
17
  site.config['uj']['date']['day'] = now.day
18
+
19
+ # Add placeholder
20
+ site.config['uj']['placeholder'] ||= {}
21
+ site.config['uj']['placeholder']['src'] = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
18
22
  end
@@ -21,6 +21,7 @@ module Jekyll
21
21
  require_relative "tags/iftruthy"
22
22
  require_relative "tags/image"
23
23
  require_relative "tags/language"
24
+ require_relative "tags/logo"
24
25
  require_relative "tags/member"
25
26
  require_relative "tags/post"
26
27
  require_relative "tags/readtime"
data/lib/tags/image.rb CHANGED
@@ -5,6 +5,8 @@ require_relative '../helpers/variable_resolver'
5
5
  module Jekyll
6
6
  class UJImageTag < Liquid::Tag
7
7
  include UJPowertools::VariableResolver
8
+
9
+ PLACEHOLDER = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
8
10
  def initialize(tag_name, markup, tokens)
9
11
  super
10
12
  @markup = markup.strip
@@ -46,6 +48,7 @@ module Jekyll
46
48
 
47
49
  # parse_arguments and parse_options methods are now provided by VariableResolver module
48
50
 
51
+
49
52
  def build_picture_element(src, src_path, extension, max_width, options)
50
53
  html = "<picture>\n"
51
54
 
@@ -65,7 +68,7 @@ module Jekyll
65
68
  height = options['height'] || ''
66
69
 
67
70
  html += "<img\n"
68
- html += "src=\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"\n"
71
+ html += "src=\"#{PLACEHOLDER}\"\n"
69
72
  html += "data-lazy=\"@src #{src}\"\n"
70
73
  html += "class=\"#{css_class}\"\n" unless css_class.empty?
71
74
  html += "alt=\"#{alt}\"\n"
@@ -135,7 +138,7 @@ module Jekyll
135
138
 
136
139
  # Build img tag on a single line to prevent markdown parsing issues
137
140
  html = "<img"
138
- html += " src=\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\""
141
+ html += " src=\"#{PLACEHOLDER}\""
139
142
  html += " data-lazy=\"@src #{src}\""
140
143
  html += " class=\"#{css_class}\"" unless css_class.empty?
141
144
  html += " alt=\"#{alt}\""
data/lib/tags/logo.rb ADDED
@@ -0,0 +1,101 @@
1
+ # Libraries
2
+ require "jekyll"
3
+ require_relative '../helpers/variable_resolver'
4
+
5
+ module Jekyll
6
+ class UJLogoTag < Liquid::Tag
7
+ include UJPowertools::VariableResolver
8
+
9
+ # Default logo to show when requested logo is not found
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
13
+ @@logo_cache = {}
14
+
15
+ def initialize(tag_name, markup, tokens)
16
+ super
17
+ @markup = markup.strip
18
+ end
19
+
20
+ def render(context)
21
+ # Parse arguments using helper
22
+ parts = parse_arguments(@markup)
23
+
24
+ # Resolve logo name (required)
25
+ logo_name = parts[0]
26
+ if logo_name
27
+ resolved = resolve_input(context, logo_name, true)
28
+ # If resolved value is not a string, treat the input as literal
29
+ if resolved.is_a?(String)
30
+ # Strip any quotes from the resolved string value
31
+ logo_name = resolved.gsub(/^['"]|['"]$/, '')
32
+ else
33
+ # Strip quotes if present and use as literal
34
+ logo_name = logo_name.gsub(/^['"]|['"]$/, '')
35
+ end
36
+ end
37
+
38
+ # Return empty if no logo name provided
39
+ return '' unless logo_name
40
+
41
+ # Resolve type (brandmarks or combomarks) - defaults to brandmarks
42
+ type = 'brandmarks'
43
+ if parts[1] && !parts[1].empty?
44
+ resolved_type = resolve_input(context, parts[1], true)
45
+ if resolved_type.is_a?(String) && !resolved_type.empty?
46
+ type = resolved_type.gsub(/^['"]|['"]$/, '')
47
+ elsif !parts[1].gsub(/^['"]|['"]$/, '').empty?
48
+ type = parts[1].gsub(/^['"]|['"]$/, '')
49
+ end
50
+ end
51
+
52
+ # Resolve color - defaults to original
53
+ color = 'original'
54
+ if parts[2] && !parts[2].empty?
55
+ resolved_color = resolve_input(context, parts[2], true)
56
+ if resolved_color.is_a?(String) && !resolved_color.empty?
57
+ color = resolved_color.gsub(/^['"]|['"]$/, '')
58
+ elsif !parts[2].gsub(/^['"]|['"]$/, '').empty?
59
+ color = parts[2].gsub(/^['"]|['"]$/, '')
60
+ end
61
+ end
62
+
63
+ # Get site from context
64
+ site = context.registers[:site]
65
+ 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
73
+ end
74
+
75
+ private
76
+
77
+ def load_logo_from_file(logo_name, type, color)
78
+ # Create cache key
79
+ cache_key = "#{type}/#{color}/#{logo_name}"
80
+
81
+ # Return cached version if available
82
+ return @@logo_cache[cache_key] if @@logo_cache.key?(cache_key)
83
+
84
+ # Build file path
85
+ logo_path = File.join(Dir.pwd, 'node_modules', 'ultimate-jekyll-manager', 'assets', 'logos', type, color, "#{logo_name}.svg")
86
+
87
+ # Try to load the logo
88
+ logo_svg = if File.exist?(logo_path)
89
+ File.read(logo_path)
90
+ else
91
+ DEFAULT_LOGO
92
+ end
93
+
94
+ # Cache the result
95
+ @@logo_cache[cache_key] = logo_svg
96
+ return logo_svg
97
+ end
98
+ end
99
+ end
100
+
101
+ Liquid::Template.register_tag('uj_logo', Jekyll::UJLogoTag)
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.8
4
+ version: 1.6.10
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-09-05 00:00:00.000000000 Z
11
+ date: 2025-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -127,6 +127,7 @@ files:
127
127
  - lib/tags/iftruthy.rb
128
128
  - lib/tags/image.rb
129
129
  - lib/tags/language.rb
130
+ - lib/tags/logo.rb
130
131
  - lib/tags/member.rb
131
132
  - lib/tags/post.rb
132
133
  - lib/tags/readtime.rb