$def with(author_data, limit=None, overflow_url=None, attrs='', show_years=False)
$def render_author_link(author):
$ name = author.get('name')
$ url = author.get('url')
$ rendered_name = cond(name, truncate(name, 40), _("Unknown author"))
$if show_years and author.get('birth_date'):
$ birth_date_formatted = extract_year(author.get('birth_date'))
$if author.get('death_date'):
$ death_date_formatted = extract_year(author.get('death_date'))
$else:
$ death_date_formatted = ''
$if show_years and url and author.get('birth_date'):
$rendered_name ($birth_date_formatted - $death_date_formatted)
$elif show_years and author.get('birth_date'):
$rendered_name ($birth_date_formatted - $death_date_formatted)
$elif url:
$rendered_name
$else:
$rendered_name
$def render_overflow_link(remaining_authors, overflow_url):
$ungettext('%(n)s other', '%(n)s others', remaining_authors, n=remaining_authors)
$code:
if limit is None:
limit = len(author_data)
remaining_authors = max(0, len(author_data) - limit)
render_items = [render_author_link(author) for author in author_data][:limit]
if remaining_authors > 0:
render_items.append(render_overflow_link(remaining_authors, overflow_url))
$if render_items:
$:_("by %(name)s", name=commify_list(render_items))
$else:
$:_("by an unknown author")