$def with(books=[], title="", url="", key="", min_books=1, load_more=None, test=False, compact_mode=False) $ ctx.setdefault("links", []) $# Apparently fonts always need crossorigin for some reason $ slick_font = '' $if slick_font not in ctx.links: $ ctx.links.append(slick_font) $def render_carousel_cover(book, lazy): $ fallback_cover = 'https://openlibrary.org/images/icons/avatar_book.png' $ cover_host = '//covers.openlibrary.org' $ url = book.get('key') or book.url $ title = book.title $if book.get('cover_url'): $ cover_url = book.get('cover_url') $elif book.get('cover_id') or book.get('cover_i'): $ cover_url = '%s/b/id/%s-M.jpg'%(cover_host, book.get('cover_id') or book.get('cover_i')) $elif book.get('ia'): $ cover_url = '%s/b/ia/%s-M.jpg?default=%s'%(cover_host, book.get('ia')[0], fallback_cover) $elif book.get('cover_edition_key'): $ cover_url = '%s/b/olid/%s-M.jpg'%(cover_host, book.get('cover_edition_key')) $else: $ cover_url = False $if book.get('authors'): $ author_names = [author.name for author in book.authors] $ byline = _(' by %(name)s', name=', '.join(author_names)) $else: $ byline = '' $ author_names = '' $ modifier = '' $ work_key = book.key if book.key.startswith('/work') else book.get('work_key') $if test or (books and len(books) >= min_books):