Neatly format author lists

This commit is contained in:
Nick Johnson 2018-03-21 16:04:37 +00:00
parent 7038c5f9b9
commit 4486c636b8
3 changed files with 14 additions and 4 deletions

10
_includes/authorlist.html Normal file
View File

@ -0,0 +1,10 @@
{%- assign authors=include.authors|split:"," -%}
{%- for author in authors -%}
{%- if author contains "<" -%}
{%- assign authorparts=author|split:"<" -%}
<a href="mailto:{{authorparts[1]|remove:">"}}">{{authorparts[0]|strip}}</a>
{%- else -%}
{{author}}
{%- endif -%}
{% if forloop.last == false %}, {% endif %}
{%- endfor -%}

View File

@ -10,7 +10,7 @@
<tr> <tr>
<td><a href="{{page.url|relative_url}}">{{page.eip|xml_escape}}</a></td> <td><a href="{{page.url|relative_url}}">{{page.eip|xml_escape}}</a></td>
<td>{{page.title|xml_escape}}</td> <td>{{page.title|xml_escape}}</td>
<td>{{page.author|xml_escape}}</td> <td>{% include authorlist.html authors=page.author %}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -5,7 +5,7 @@ layout: default
<div class="home"> <div class="home">
<h1 class="page-heading">EIP {{ page.eip | xml_escape }}: {{ page.title | xml_escape }}</h1> <h1 class="page-heading">EIP {{ page.eip | xml_escape }}: {{ page.title | xml_escape }}</h1>
<table> <table>
<tr><th>Author</th><td>{{ page.author | xml_escape }}</td></tr> <tr><th>Author</th><td>{% include authorlist.html authors=page.author %}</td></tr>
{% if page["discussions-to"] != undefined %} {% if page["discussions-to"] != undefined %}
<tr><th>Discussions-To</th><td><a href="mailto:{{ page["discussions-to"] | uri_escape }}">{{ page["discussions-to"] | xml_escape }}</a></td></tr> <tr><th>Discussions-To</th><td><a href="mailto:{{ page["discussions-to"] | uri_escape }}">{{ page["discussions-to"] | xml_escape }}</a></td></tr>
{% endif %} {% endif %}
@ -19,10 +19,10 @@ layout: default
<tr><th>Requires</th><td>{% include eipnums.html eips=page.requires %}</td></tr> <tr><th>Requires</th><td>{% include eipnums.html eips=page.requires %}</td></tr>
{% endif %} {% endif %}
{% if page.replaces != undefined %} {% if page.replaces != undefined %}
<tr><th>Replaces</th><td>{{% include eipnums.html eips=page.replaces %}</td></tr> <tr><th>Replaces</th><td>{% include eipnums.html eips=page.replaces %}</td></tr>
{% endif %} {% endif %}
{% if page["superseded-by"] != undefined %} {% if page["superseded-by"] != undefined %}
<tr><th>Superseded by</th><td>{% include eipnums.html eips=page['superseded-by'] %}</td></tr> <tr><th>Superseded by</th><td>{% include eipnums.html eips=page.superseded-by %}</td></tr>
{% endif %} {% endif %}
{% if page.resolution != undefined %} {% if page.resolution != undefined %}
<tr><th>Resolution</th><td><a href="{{page.resolution | uri_escape }}">{{ page.resolution | xml_escape }}</a></td></tr> <tr><th>Resolution</th><td><a href="{{page.resolution | uri_escape }}">{{ page.resolution | xml_escape }}</a></td></tr>