/upstream/macros/EditionImageWork
Type: /type/macro
macro: value: $def with(book, size="M")

$code:
    def aname(a):
        if isinstance(a, basestring):
            return a
        else:
            return a.name
$ authorlist = ', '.join([aname(author) for author in book.authors])

$ title = book.title_prefix + " " + book.title
$ olid = book.key.split("/")[2]

<script type="text/javascript">
\$(window).load(editionCovers);
</script>

$if size == "M":
    <div class="coverMagic">
        <div class="SRPCover">
            <a href="$book.key" title="$title">
                <img src="http://covers.openlibrary.org/b/olid/$olid-M.jpg?default=false" class="edition" alt="$title"/>
            </a>
        </div>
        <div class="SRPCoverBlank" onClick="document.location.href='$book.key';" title="Go to the page for $title">
            <div class="innerBorder">
                <div class="BookTitle">
                    $:macros.TruncateString(title, 70)
                    <div class="Author">$:authorlist</div>
                </div>
            </div>
        </div>
    </div>
$else:
    <a href="$book.key" title="$title">
        <img src="http://covers.openlibrary.org/b/olid/$olid-S.jpg?default=http://upstream.openlibrary.org/images/icons/avatar_book-sm.png" alt="$title"/>
    </a>