jekyll-socials 0.0.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a742993f44ada76c22b1c7b540c7e3059db917b1ea25b90027a477ab81b387d
4
- data.tar.gz: b8772ebf831fefed23c832aa721e56090e6d459d3923ba2b9a562d31b831e8f4
3
+ metadata.gz: 7b249a270aa1e5047bf345afb3d5fdde1ec42fdabd733a18f34743460747db54
4
+ data.tar.gz: 18dea3f4f575a4f46d20266987027fc3b7cf124f0fffa534cfa8dbffdf6b0c14
5
5
  SHA512:
6
- metadata.gz: ae5d2970301cb012e787112ad11222e2f354800983a14bece728c75aa13ba343112e5f25c1fd31ea3cf545fe8c1c6a88182c5e8c9240c85521d9cf3ece695942
7
- data.tar.gz: 20216b6a270e896c57bd01cc7b0c56d08fd8ac76fda021529d7c604a6ff1ac9a2dc590de49676693b0b8f830901a5331125a783b42029bc67d7db4b272deccf9
6
+ metadata.gz: 130dab193050207f6438edf1c27149691c2ad8ca02480af551959bbbcf5966c65eba0334451e7c41b85b13bdd7a38bdb72972539fa0656645e7bb5609e1b73d4
7
+ data.tar.gz: 93d7ca636038e8c514e2687b0854d4b1a271097e40d37d054de84e7cb73a994f245f0d8d699f8cb54ac2a2477c11ff9c9b6aba0198033a685996465afa54a865
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Socials
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.6"
6
6
  end
7
7
  end
@@ -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,39 +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 social[0] == 'academia_edu'
131
- url = url_template % [social[1]['organization'], social[1]['username']]
132
- elsif social[0] == 'cv_pdf'
133
- if social[1] =~ %r{://}
134
- url = social[1]
135
- elsif !context.registers[:site].respond_to?(:active_lang) || !context.registers[:site].active_lang || context.registers[:site].active_lang.empty?
136
- url = context.registers[:site].baseurl + social[1]
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'
155
+ baseurl = context.registers[:site].baseurl.to_s.empty? ? '' : context.registers[:site].baseurl
156
+ url = url_template % (baseurl + '/feed.xml')
137
157
  else
138
- # support for jekyll-polyglot
139
- url = context.registers[:site].baseurl + social[1].gsub('[LANG]', context.registers[:site].active_lang)
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>"
140
183
  end
141
- elsif social[0] == 'rss_icon'
142
- url = url_template % context.registers[:site].baseurl + '/feed.xml'
143
184
  else
144
- url = url_template % social[1]
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>"
145
206
  end
146
- "<a href='#{url}' title='#{social[0].gsub('_', ' ').capitalize}'>#{icon}</a>"
147
207
  else
148
- file_ext = social[1]['logo'].split('.').last
149
- if file_ext == 'svg'
150
- if social[1]['logo'].include?('://')
151
- img_code = "<svg><image xlink:href='#{social[1]['logo']}' /></svg>"
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
152
221
  else
153
- img_code = "<svg><image xlink:href='#{social[1]['logo'] | relative_url}' /></svg>"
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
154
227
  end
228
+ "<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{img_code}</a>"
155
229
  else
156
- if social[1]['logo'].include?('://')
157
- img_code = "<img src='#{social[1]['logo']}' alt='#{social[1]['title']}'>"
158
- else
159
- img_code = "<img src='#{social[1]['logo'] | relative_url}' alt='#{social[1]['title']}'>"
160
- 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>"
161
233
  end
162
- "<a href='#{social[1]['url']}' title='#{social[1]['title']}'>#{img_code}</a>"
163
234
  end
164
235
  end.join(" ")
165
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
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-14 00:00:00.000000000 Z
11
+ date: 2026-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll