bookwyrm/bookwyrm/templates/snippets/authors.html
2021-12-22 14:53:34 +01:00

33 lines
1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% spaceless %}
{% load i18n %}
{% load humanize %}
{% comment %}
@todo The author property needs to be an Organization or a Person. Well be using Thing which is the more generic ancestor.
@see https://schema.org/Author
{% endcomment %}
{% firstof limit None as limit %}
{% with subtraction_value='-'|add:limit %}
{% with remainder_count=book.authors.count|add:subtraction_value %}
{% with remainder_count_display=remainder_count|intcomma %}
{% for author in book.authors.all|slice:limit %}
<a
href="{{ author.local_path }}"
class="author {{ link_class }}"
itemprop="author"
itemscope
itemtype="https://schema.org/Thing"
><span
itemprop="name"
>{{ author.name }}</span></a>{% if not forloop.last %}, {% elif remainder_count > 0 %}, {% blocktrans trimmed count counter=remainder_count %}
and {{ remainder_count_display }} other
{% plural %}
and {{ remainder_count_display }} others
{% endblocktrans %}{% endif %}
{% endfor %}
{% endwith %}
{% endwith %}
{% endwith %}
{% endspaceless %}