/upstream/macros/CoverImage
Type: /type/macro
macro: value: $def with(book, size="M")

$ title = book.title_prefix + " " + book.title

$ olid = book.key.split("/")[2]

$code:
    def aname(a):
        if isinstance(a, basestring):
            return a
        else:
            return a.name

$ author_names = ", ".join(aname(a) for a in book.authors) or book.get('by_statement','')

$ cover_url = book.get_cover_url(size)

$if size == "M":
    <div class="coverMagic">
        $if cover_url:
            <div class="SRPCover bookCover">
                <img src="$cover_url" class="cover" alt="$title $_.by $author_names"/>
            </div>
        $else:
            <div class="SRPCoverBlank" style="display: block">
                <div class="innerBorder">
                    <div class="BookTitle">$:macros.TruncateString(title, 70)
                        <div class="Author">$:macros.TruncateString(author_names, 30)</div>
                    </div>
                </div>
            </div>
    </div>
$else:
    $if cover_url:
        <img src="$cover_url" height="58" title="$title" alt="$title"/>
    $else:
        <img src="/images/icons/avatar_book-sm.png" alt="$title"/>