Macro |
$def with (results, fulltext=False)
$ _ = i18n.get_namespace('/search')
<div style="margin-left: 30px; margin-right: 30px;">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
$for b in results:
$if fulltext:
$ book = b[0]
$ ocaid = b[1]
$ pages = b[2]
$else:
$ book = b
$ ocaid = None
<tr>
<td style="padding-left: 0px; padding-right: 0px; text-align: center; vertical-align: top; border-bottom: 1px solid #ccc;">
$ olid = book.key.split('/')[-1]
<a href="$book.key"><img src="http://covers.openlibrary.org/b/olid/$olid-S.jpg?default=http://openlibrary.org/static/images/blank.book.png" height="60" /></a>
</td>
<td valign="middle" width="100%" style="padding-left: 10px; border-bottom: 1px solid #ccc;">
<a href="$book.key/$book.title.replace(' ', '_').replace('/', '_')" class="result">$book.title_prefix $book.title</a>
$if book.get('authors', None):
<span class="result-small">$_.by
$ authorlist = ', '.join([thingrepr(author).rstrip() for author in book.authors])
$:authorlist
</span>
$if book.ocaid: <a href="http://www.archive.org/stream/$book.ocaid" class="ReadNow">$_.fulltext</a>
<div class="result-small">
$if book.publishers:
$(', '.join(book.publishers)), $book.publish_date
$else:
$book.publish_date
$book.physical_format
</div>
$if fulltext:
<p>Pages:
$if len(pages)==0: <i>Unknown</i>
$ a = []
$for pn, pg in pages:
$ a.append('<a href="http://www.archive.org/stream/%s#page/n%s/mode/1up">%s</a>'% (book.ocaid, pn-1, pg))
$:(', '.join(a))
</p>
</td></tr>
</table>
</div>
|