jekyll-uj-powertools 1.6.9 → 1.6.11
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/README.md +21 -0
- data/jekyll-uj-powertools.gemspec +1 -1
- data/lib/jekyll-uj-powertools.rb +1 -0
- data/lib/tags/logo.rb +101 -0
- data/lib/tags/translation_url.rb +8 -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: 11df894ba3e6ec90b19f3cfce9ee7696dc1ae2a399dd709ebc3894ed75292fa8
|
4
|
+
data.tar.gz: 3ad318e32bd86a8718a2c4a20daaa201a0a555c776b4ae37d084000831f53fc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83364951d73755ddaf57a0ffde41e0e917945366f9aaed67f238ea967d8ee89600ef140b39b32e04b80cc926a694a3e5f2d9ad905202fbbf3db82c62801eef14
|
7
|
+
data.tar.gz: 42543e04159f00a31c7316b620a6d5cc426a4ebd0a2739cdc3fcda96615a57fa1d7a106a045fee49f96ee95a17e84b24c537ad8b00e11d49b9fd077130685fcc
|
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
|
data/lib/jekyll-uj-powertools.rb
CHANGED
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)
|
data/lib/tags/translation_url.rb
CHANGED
@@ -55,6 +55,14 @@ module Jekyll
|
|
55
55
|
# Handle empty path (home page)
|
56
56
|
return '' if clean_path.empty?
|
57
57
|
|
58
|
+
# Special case: remove index.html from blog paths
|
59
|
+
# This converts "blog/index.html" to "blog"
|
60
|
+
clean_path = clean_path.sub(/^blog\/index\.html$/, 'blog')
|
61
|
+
|
62
|
+
# Special case: remove .html from blog pagination paths
|
63
|
+
# This converts "blog/page/2.html" to "blog/page/2"
|
64
|
+
clean_path = clean_path.sub(/^blog\/page\/(\d+)\.html$/, 'blog/page/\1')
|
65
|
+
|
58
66
|
clean_path
|
59
67
|
end
|
60
68
|
|
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.11
|
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-
|
11
|
+
date: 2025-09-29 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
|