get a higher-res thumbnail for "Think Black"
[books.alexwlchan.net] / templates / review.html
1 {% extends "base.html" %}
2
3 {% block head_content %}
4 <meta name="twitter:card" content="summary">
5 <meta name="twitter:site" content="@alexwlchan"/>
6 <meta name="twitter:title" content="alexwlchan's review of {{ review_entry.book.title }}"/>
7 <meta name="twitter:image" content="https://books.alexwlchan.net/squares/{{ review_entry.book.cover_image }}"/>
8
9 <meta property="og:type" content="article" />
10 <meta property="og:url" content="https://books.alexwlchan.net/{{ review_entry.out_path() }}">
11 <meta property="og:title" content="alexwlchan's review of {{ review_entry.book.title }}">
12 <meta property="og:image" content="https://books.alexwlchan.net/squares/{{ review_entry.book.cover_image }}"/>
13 {% endblock %}
14
15 {% block content %}
16   {% if tint_colors[review_entry.book.cover_image] %}
17     {% set r = tint_colors[review_entry.book.cover_image][0] * 255 | int %}
18     {% set g = tint_colors[review_entry.book.cover_image][1] * 255 | int %}
19     {% set b = tint_colors[review_entry.book.cover_image][2] * 255 | int %}
20     <style>
21       .review a {
22         color: rgb({{ r }}, {{ g }}, {{ b }});
23       }
24
25       .review a:hover {
26         background: rgb({{ r }}, {{ g }}, {{ b }}, 0.3);
27       }
28
29       .book-cover img {
30         box-shadow: 0px 5px 5px rgba({{ r }}, {{ g }}, {{ b }}, 0.25);
31       }
32
33       aside #shelf_background {
34         background: url({{ tint_colors[review_entry.book.cover_image] | create_shelf_data_uri }});
35         background-size: auto 100%;
36       }
37     </style>
38   {% endif %}
39
40   {% if review_entry.book.cover_image %}
41     <div class="book-cover">
42       {% set book = review_entry.book %}
43       {% include "_book_cover.html" %}
44     </div>
45   {% endif %}
46
47   <h1><span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span></h1>
48
49   {#
50     This means the publication year will be printed in parens next to
51     the first/principal contributor, but only the first contributor.
52     #}
53   {% set contributor_options = {"has_printed_year": False} %}
54
55   <table class="book_metadata">
56     {% for label, contributor in [
57       ("author", review_entry.book.author),
58       ("editor", review_entry.book.editor),
59       ("illustrator", review_entry.book.illustrator),
60       ("narrator", review_entry.book.narrator),
61     ] %}
62       {% if contributor %}
63         <tr>
64           <th>{{ label }}{% if "and" in contributor or ", " in contributor or " & " in contributor %}s{% endif %}:</th>
65           <td>{{ contributor }}
66             {%- if review_entry.book.publication_year and not contributor_options["has_printed_year"] %}
67               ({{ review_entry.book.publication_year}})
68               {% set _ = contributor_options.update({"has_printed_year": True}) %}
69             {%- endif -%}
70           </td>
71         </tr>
72       {% endif %}
73     {% endfor %}
74
75     {% if review_entry.review.date_read %}
76     <tr>
77       <th>date read:</th>
78       <td>{{ review_entry.review.date_read | render_date }}
79         {% if review_entry.review.did_not_finish %}
80         <span class="did_not_finish">
81           (did not finish)
82         </span>
83         {% endif %}
84       </td>
85     </tr>
86     {% endif %}
87     {% if review_entry.review.rating %}
88     <tr>
89       <th>rating:</th>
90       <td>
91         {% for _ in range(review_entry.review.rating) %}
92         ★
93         {% endfor %}
94         {% for _ in range(5 - review_entry.review.rating) %}
95         ☆
96         {% endfor %}
97       </td>
98     </tr>
99     {% endif %}
100   </table>
101
102   <div class="review">
103     {{ review_entry.review.text | render_markdown | safe }}
104
105     <p>(see <a href="/reviews">all reviews</a>)</p>
106   </div>
107 {% endblock %}