Skip to content

Commit

Permalink
Add author date when showing author name to librarians (internetarchi…
Browse files Browse the repository at this point in the history
…ve#9052)

* Re-implement changes

- Store data in dictionaries
- Only show years for librarians on book page

* Delete integration test

* Use a regex to determine the year to display

* Use single quotes

* Add helper function to extract a year

* Register helper

* Final fixes

* Small clean-up

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Address comments

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and merwhite11 committed May 6, 2024
1 parent 137882b commit bf25b9b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 97 deletions.
5 changes: 5 additions & 0 deletions openlibrary/macros/BookByline.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@
$ death_date_formatted = ''
$if show_years and url and author.get('birth_date'):
<a href="$url" $:attrs>$rendered_name ($birth_date_formatted - $death_date_formatted)</a>
$elif show_years and author.get('birth_date'):
$elif show_years and author.get('birth_date'):
<span $:attrs>$rendered_name ($birth_date_formatted - $death_date_formatted)</span>
$elif url:
<a href="$url" $:attrs>$rendered_name</a>
$else:
<span $:attrs>$rendered_name ($birth_date_formatted - $death_date_formatted)</span>
$elif url:
<a href="$url" $:attrs>$rendered_name</a>
$else:
<span $:attrs>$rendered_name</span>

$def render_overflow_link(remaining_authors, overflow_url):
<small><em><a href="$overflow_url" $:attrs>$ungettext('%(n)s other', '%(n)s others', remaining_authors, n=remaining_authors)</a></em></small>
Expand Down
97 changes: 0 additions & 97 deletions tests/integration/test_author_name.py

This file was deleted.

0 comments on commit bf25b9b

Please sign in to comment.