forked from ev3dev/ev3dev.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthor-card.html
More file actions
16 lines (15 loc) · 988 Bytes
/
author-card.html
File metadata and controls
16 lines (15 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!-- Provides unofficial GitHub card function for include.author variable -->
{% assign author_no_at_sign = include.author | strip_html | remove_first: "@" %}
{% assign at_sign = include.author | strip_html | replace: author_no_at_sign %}
{% if include.theme %}
{% assign extra_classes = "user-card-" | append: include.theme %}
{% endif %}
<!-- first function does not work and truncate function returns trailing "..." -->
{% assign test_at_sign_is_first = include.author | truncate: 4 | replace: "@" | size %}
<!-- this looks weird, but it was the only way I could figure out how to test
that the first character of include.author is "@" -->
{% if at_sign.size > 0 and test_at_sign_is_first == 3 %}
<div class="user-card {{ extra_classes }}" data-card-user="{{author_no_at_sign}}"><div class="user-card-name">{{ include.author }}</div></div><br/>
{% else %}
<div class="user-card {{ extra_classes }}"><div class="user-card-name">{{ include.author }}</div></div>
{% endif %}