jekyll-socials 0.0.5 → 0.0.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 +4 -4
- data/lib/jekyll-socials/version.rb +1 -1
- data/lib/jekyll-socials.rb +94 -26
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b249a270aa1e5047bf345afb3d5fdde1ec42fdabd733a18f34743460747db54
|
|
4
|
+
data.tar.gz: 18dea3f4f575a4f46d20266987027fc3b7cf124f0fffa534cfa8dbffdf6b0c14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 130dab193050207f6438edf1c27149691c2ad8ca02480af551959bbbcf5966c65eba0334451e7c41b85b13bdd7a38bdb72972539fa0656645e7bb5609e1b73d4
|
|
7
|
+
data.tar.gz: 93d7ca636038e8c514e2687b0854d4b1a271097e40d37d054de84e7cb73a994f245f0d8d699f8cb54ac2a2477c11ff9c9b6aba0198033a685996465afa54a865
|
data/lib/jekyll-socials.rb
CHANGED
|
@@ -36,6 +36,7 @@ module Jekyll
|
|
|
36
36
|
'kaggle_id' => "<i class='fa-brands fa-kaggle'></i>",
|
|
37
37
|
'keybase_username' => "<i class='fa-brands fa-keybase'></i>",
|
|
38
38
|
'lastfm_id' => "<i class='fa-brands fa-lastfm'></i>",
|
|
39
|
+
'letterboxd_id' => "<i class='fa-brands fa-square-letterboxd'></i>",
|
|
39
40
|
'linkedin_username' => "<i class='fa-brands fa-linkedin'></i>",
|
|
40
41
|
'mastodon_username' => "<i class='fa-brands fa-mastodon'></i>",
|
|
41
42
|
'medium_username' => "<i class='fa-brands fa-medium'></i>",
|
|
@@ -87,6 +88,7 @@ module Jekyll
|
|
|
87
88
|
'lastfm_id' => "https://www.last.fm/user/%s",
|
|
88
89
|
'lattes_id' => "http://lattes.cnpq.br/%s",
|
|
89
90
|
'leetcode_id' => "https://leetcode.com/u/%s/",
|
|
91
|
+
'letterboxd_id' => "https://letterboxd.com/%s",
|
|
90
92
|
'linkedin_username' => "https://www.linkedin.com/in/%s",
|
|
91
93
|
'mastodon_username' => "https://%s",
|
|
92
94
|
'medium_username' => "https://medium.com/@%s",
|
|
@@ -127,42 +129,108 @@ module Jekyll
|
|
|
127
129
|
icon = SOCIAL_ICONS[social[0]]
|
|
128
130
|
url_template = SOCIAL_URLS[social[0]]
|
|
129
131
|
if icon && url_template
|
|
130
|
-
if
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
# Check if user provided custom logo override
|
|
133
|
+
if social[1].is_a?(Hash) && social[1]['logo']
|
|
134
|
+
# Use custom logo for this built-in social
|
|
135
|
+
logo_value = social[1]['logo']
|
|
136
|
+
file_ext = logo_value.split('.').last.downcase
|
|
137
|
+
image_extensions = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg']
|
|
138
|
+
|
|
139
|
+
# Build URL - extract value from hash (support 'value' key or social-specific keys)
|
|
140
|
+
if social[0] == 'academia_edu'
|
|
141
|
+
url = url_template % [social[1]['organization'], social[1]['username']]
|
|
142
|
+
elsif social[0] == 'cv_pdf'
|
|
143
|
+
social_value = social[1]['value'] || social[1][social[0]]
|
|
144
|
+
if social_value =~ %r{://}
|
|
145
|
+
url = social_value
|
|
146
|
+
elsif !context.registers[:site].respond_to?(:active_lang) || !context.registers[:site].active_lang || context.registers[:site].active_lang.empty?
|
|
147
|
+
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
148
|
+
url = baseurl + social_value
|
|
149
|
+
else
|
|
150
|
+
# support for jekyll-polyglot
|
|
151
|
+
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
152
|
+
url = baseurl + social_value.gsub('[LANG]', context.registers[:site].active_lang)
|
|
153
|
+
end
|
|
154
|
+
elsif social[0] == 'rss_icon'
|
|
136
155
|
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
137
|
-
url = baseurl +
|
|
156
|
+
url = url_template % (baseurl + '/feed.xml')
|
|
138
157
|
else
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
158
|
+
social_value = social[1]['value'] || social[1][social[0]]
|
|
159
|
+
url = url_template % social_value
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# Render with custom logo
|
|
163
|
+
if image_extensions.include?(file_ext)
|
|
164
|
+
# It's a file path or URL, render as image
|
|
165
|
+
if file_ext == 'svg'
|
|
166
|
+
if logo_value.include?('://')
|
|
167
|
+
img_code = "<svg><image xlink:href='#{logo_value}' /></svg>"
|
|
168
|
+
else
|
|
169
|
+
img_code = "<svg><image xlink:href='#{logo_value | relative_url}' /></svg>"
|
|
170
|
+
end
|
|
171
|
+
else
|
|
172
|
+
if logo_value.include?('://')
|
|
173
|
+
img_code = "<img src='#{logo_value}' alt='#{social[0].gsub('_', ' ').capitalize}'>"
|
|
174
|
+
else
|
|
175
|
+
img_code = "<img src='#{logo_value | relative_url}' alt='#{social[0].gsub('_', ' ').capitalize}'>"
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
"<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{img_code}</a>"
|
|
179
|
+
else
|
|
180
|
+
# It's an icon class string, render as icon (from any font source)
|
|
181
|
+
icon_html = "<i class='#{logo_value}'></i>"
|
|
182
|
+
"<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon_html}</a>"
|
|
142
183
|
end
|
|
143
|
-
elsif social[0] == 'rss_icon'
|
|
144
|
-
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
145
|
-
url = url_template % (baseurl + '/feed.xml')
|
|
146
184
|
else
|
|
147
|
-
|
|
185
|
+
# Use default icon for built-in social
|
|
186
|
+
if social[0] == 'academia_edu'
|
|
187
|
+
url = url_template % [social[1]['organization'], social[1]['username']]
|
|
188
|
+
elsif social[0] == 'cv_pdf'
|
|
189
|
+
if social[1] =~ %r{://}
|
|
190
|
+
url = social[1]
|
|
191
|
+
elsif !context.registers[:site].respond_to?(:active_lang) || !context.registers[:site].active_lang || context.registers[:site].active_lang.empty?
|
|
192
|
+
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
193
|
+
url = baseurl + social[1]
|
|
194
|
+
else
|
|
195
|
+
# support for jekyll-polyglot
|
|
196
|
+
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
197
|
+
url = baseurl + social[1].gsub('[LANG]', context.registers[:site].active_lang)
|
|
198
|
+
end
|
|
199
|
+
elsif social[0] == 'rss_icon'
|
|
200
|
+
baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
|
|
201
|
+
url = url_template % (baseurl + '/feed.xml')
|
|
202
|
+
else
|
|
203
|
+
url = url_template % social[1]
|
|
204
|
+
end
|
|
205
|
+
"<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon}</a>"
|
|
148
206
|
end
|
|
149
|
-
"<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon}</a>"
|
|
150
207
|
else
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
208
|
+
# Check if logo is an icon class or an image
|
|
209
|
+
logo_value = social[1]['logo']
|
|
210
|
+
file_ext = logo_value.split('.').last.downcase
|
|
211
|
+
image_extensions = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg']
|
|
212
|
+
|
|
213
|
+
if image_extensions.include?(file_ext)
|
|
214
|
+
# It's a file path or URL, render as image
|
|
215
|
+
if file_ext == 'svg'
|
|
216
|
+
if logo_value.include?('://')
|
|
217
|
+
img_code = "<svg><image xlink:href='#{logo_value}' /></svg>"
|
|
218
|
+
else
|
|
219
|
+
img_code = "<svg><image xlink:href='#{logo_value | relative_url}' /></svg>"
|
|
220
|
+
end
|
|
155
221
|
else
|
|
156
|
-
|
|
222
|
+
if logo_value.include?('://')
|
|
223
|
+
img_code = "<img src='#{logo_value}' alt='#{social[1]['title']}'>"
|
|
224
|
+
else
|
|
225
|
+
img_code = "<img src='#{logo_value | relative_url}' alt='#{social[1]['title']}'>"
|
|
226
|
+
end
|
|
157
227
|
end
|
|
228
|
+
"<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{img_code}</a>"
|
|
158
229
|
else
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
img_code = "<img src='#{social[1]['logo'] | relative_url}' alt='#{social[1]['title']}'>"
|
|
163
|
-
end
|
|
230
|
+
# It's an icon class string, render as icon (from any font source)
|
|
231
|
+
icon_html = "<i class='#{logo_value}'></i>"
|
|
232
|
+
"<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{icon_html}</a>"
|
|
164
233
|
end
|
|
165
|
-
"<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{img_code}</a>"
|
|
166
234
|
end
|
|
167
235
|
end.join(" ")
|
|
168
236
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-socials
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- George Corrêa de Araújo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jekyll
|