$def with (doc, decorations=None, cta=True, availability=None, extra=None, attrs=None, rating=None, reading_log=None, show_librarian_extras=False) $code: max_rendered_authors = 9 doc_type = ( 'infogami_work' if doc.get('type', {}).get('key') == '/type/work' else 'infogami_edition' if doc.get('type', {}).get('key') == '/type/edition' else 'solr_work' if not doc.get('editions') else 'solr_edition' ) selected_ed = doc if doc_type == 'solr_edition': selected_ed = doc.get('editions')[0] book_url = doc.url() if doc_type.startswith('infogami_') else doc.key book_provider = get_book_provider(doc) if doc_type == 'solr_edition': work_edition_url = book_url + '?edition=' + urlquote('key:' + selected_ed.key) elif book_provider and doc_type.endswith('_work'): work_edition_url = book_url + '?edition=' + urlquote(book_provider.get_best_identifier_slug(doc)) else: work_edition_url = book_url edition_work = None if doc_type == 'infogami_edition' and 'works' in doc: edition_work = doc['works'][0] full_title = selected_ed.get('title', '') + (': ' + selected_ed.subtitle if selected_ed.get('subtitle') else '') if doc_type == 'infogami_edition' and edition_work: full_work_title = edition_work.get('title', '') + (': ' + edition_work.subtitle if edition_work.get('subtitle') else '') else: full_work_title = doc.get('title', '') + (': ' + doc.subtitle if doc.get('subtitle') else '')
  • $ cover = get_cover_url(selected_ed) or "/images/icons/avatar_book-sm.png" $_('Cover of: %(title)s', title=full_title)
    $if doc.get('first_publish_year'): $_('First published in %(year)s', year=doc.first_publish_year) $if doc.get('edition_count'): $ungettext('1 edition', '%(count)d editions', doc.edition_count, count=doc.edition_count) $if doc.get('languages'): $:ungettext('in 1 language', 'in %(count)d languages', len(doc.languages), count=len(doc.languages), langs=commify_list([get_language_name('/languages/' + lang) for lang in doc.languages])) $if doc.get('ia'): — $_('%s previewable', len(doc.get('ia'))) $if len(doc.get('ia')) > 1: $for x, i in enumerate(doc.get('ia')[1:10]): Cover of edition $i $if show_librarian_extras:
    $if doc_type == 'solr_edition' or (doc_type == 'infogami_edition' and edition_work):
    $_('Work Title'): $full_work_title
    $ is_orphan = doc_type.startswith('solr_') and doc['key'].endswith('M') or doc_type == 'infogami_edition' and not edition_work $if is_orphan:
    $_('Orphaned Edition')
    $if extra: $:extra
    $if decorations: $# should show reading log status widget if there is one in decorations, or read, or return, or leave waitlist
    $:decorations
    $if cta: $ selected_ed['availability'] = selected_ed.get('availability', {}) or doc.get('availability', {}) or availability or {} $:macros.LoanStatus(selected_ed, work_key=doc.key)
    $if reading_log: $:reading_log $if rating: $:rating