Skip to content

Commit 93ae8d5

Browse files
committed
Make author-card include for individual cards
this way it can be used for different layouts. updated the tutorial layout to take advantage of this instead of using it's own author cards.
1 parent 9ab0ef4 commit 93ae8d5

5 files changed

Lines changed: 24 additions & 25 deletions

File tree

_includes/author-card.html

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
<!-- Provides unofficial GitHub card function for author_card variable -->
1+
<!-- Provides unofficial GitHub card function for include.author variable -->
22

3-
{% assign authors = author_card %}
4-
{% for author in authors %}
5-
{% assign author_no_at_sign = author | strip_html | remove_first: "@" %}
6-
{% assign at_sign = author | strip_html | replace: author_no_at_sign %}
7-
<!-- first function does not work and truncate function returns trailing "..." -->
8-
{% assign test_at_sign_is_first = author | truncate: 4 | replace: "@" | size %}
9-
<!-- this looks weird, but it was the only way I could figure out how to test
10-
that the first character of author is "@" -->
11-
{% if at_sign.size > 0 and test_at_sign_is_first == 3 %}
12-
<div data-card-user="{{author_no_at_sign}}"></div><br/>
13-
{% else %}
14-
<div class="user-card"><div class="user-card-name">{{ author }}</div></div>
15-
{% endif %}
16-
{% endfor %}
3+
{% assign author_no_at_sign = include.author | strip_html | remove_first: "@" %}
4+
{% assign at_sign = include.author | strip_html | replace: author_no_at_sign %}
5+
<!-- first function does not work and truncate function returns trailing "..." -->
6+
{% assign test_at_sign_is_first = include.author | truncate: 4 | replace: "@" | size %}
7+
<!-- this looks weird, but it was the only way I could figure out how to test
8+
that the first character of include.author is "@" -->
9+
{% if at_sign.size > 0 and test_at_sign_is_first == 3 %}
10+
<div data-card-user="{{author_no_at_sign}}"></div><br/>
11+
{% else %}
12+
<div class="user-card"><div class="user-card-name">{{ include.author }}</div></div>
13+
{% endif %}

_layouts/news.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ <h3 class="panel-title">Post Info</h3>
2626
</li>
2727
{% if page.author %}
2828
<li class="list-group-item">
29-
{% assign author_card = page.author %}
30-
{% include author-card.html %}
29+
{% for author in page.author %}
30+
{% include author-card.html author=author %}
31+
{% endfor %}
3132
</li>
3233
{% endif %}
3334
</ul>

_layouts/project.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ <h3 class="panel-title">Project Info</h3>
3434
{% endif %}
3535
{% if page.author %}
3636
<li class="list-group-item">
37-
{% assign author_card = page.author %}
38-
{% include author-card.html %}
37+
{% for author in page.author %}
38+
{% include author-card.html author = author %}
39+
{% endfor %}
3940
</li>
4041
{% endif %}
4142
</ul>

_layouts/tutorial.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
{{ content }}
2020

21-
{% if page.author_cards %}
22-
{% if author_cards.length > 1 %}
21+
{% if page.author %}
22+
{% assign count = page.author | size %}
23+
{% if count > 1 %}
2324
<h2> Authors </h2>
2425
{% else %}
2526
<h2> Author </h2>
2627
{% endif %}
27-
{% for author in page.author_cards %}
28-
<div class="github-card" data-user="{{ author }}"></div>
28+
{% for author in page.author %}
29+
<div style="float: left; margin-right: 20px;">{% include author-card.html author = author %}</div>
2930
{% endfor %}
30-
<script src="//cdn.jsdelivr.net/github-cards/latest/widget.js"></script>
3131
{% endif %}

docs/tutorials/setting-up-python-pycharm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Setting Up a Python Development Environment with PyCharm
33
subject: Software - Python
4-
author_cards: {antonvh}
4+
author: "@antonvh"
55
---
66

77
* Table of Contents

0 commit comments

Comments
 (0)