/dev/macros/CoverImage
Type: /type/macro
description: CoverImage macro
macro: value: $def with(book, size="M")

$ title = book.title_prefix + " " + book.title

$ olid = book.key.split("/")[2]

$if size == "M":
    <div class="cover-wrapper">
        <img src="http://covers.openlibrary.org/b/olid/$olid-M.jpg?default=false" onerror="\$(this).hide(); \$('#default-cover-$olid').show();" width="173"/>
        <div class="default-cover-$size.lower()" id="default-cover-$olid" style="display: none;">
            <div id="book-title">
                $ author_names = ", ".join(a.name for a in book.authors) or book.by_statement
                $title
                <div id="author-names">$author_names</div>
            </div>
        </div>
    </div>
$else:
    <img src="http://covers.openlibrary.org/b/olid/$olid-S.jpg?default=http://wiki-beta.us.archive.org/static/images/blank.book.png" height="58"/>