Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show multiple of each type of ISBN in omniline #6355

Merged

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Mar 31, 2022

Closes: #6360

The previous means of getting ISBNs for the books page omniline only gets the first ISBN 10 and ISBN 13 if multiples exist for either. This PR ensures that all ISBNs are displayed in the omniline.

Technical

The new code is modeled after the display_identifiers function, which is used to display IDs in the book details section of the page. I'm assuming that the openlib- checks are not needed for ISBNs, and did not include them. Please correct me if I'm wrong.

$def display_identifiers(label, ids, itemprop=None):
$if label != "Goodreads":
$ all_ids = [-1!=id['value'].find('openlib-') for id in ids]
$if (True in all_ids) and (1==len(all_ids)):
$return
<!-- FIXME: Identifier names need to be translated (I18N) -->
<dt>$label</dt>
<dd class="object" $:cond(itemprop, 'itemprop="%s"' % itemprop, '')>
$for id in ids:
$ sep = cond(loop.last, "", ", ")
$if -1 != id.value.find('openlib-'):
$continue
$if id.url:
<a href="$id.url$('?tag=' + affiliate_id('amazon') if 'amazon.' in id.url else '')">$id.value</a>$sep
$else:
${id.value}$sep
</dd>

Testing

Screenshot

Stakeholders

@mekarpeles mekarpeles self-assigned this Apr 1, 2022
@mekarpeles mekarpeles merged commit bb42240 into internetarchive:master Apr 1, 2022
@jimchamp jimchamp deleted the bug/isbn-exclusion-woes branch July 15, 2022 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display all ISBNs in omnibar
2 participants