Add an entry for "Cosmogramma"
[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.name }}"/>
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.name }}"/>
13 {% endblock %}
14
15 {% block content %}
16   {% set (r, g, b) = review_entry.book.cover.tint_color | from_hex %}
17   {% set r = r / 255 %}
18   {% set g = g / 255 %}
19   {% set b = b / 255 %}
20   <style>
21     .review a {
22       color: {{ review_entry.book.cover.tint_color }};
23     }
24
25     .review a:hover {
26       background: {{ review_entry.book.cover.tint_color | as_rgba(0.3) }};
27     }
28
29     .book-cover img {
30       box-shadow: 0px 5px 5px {{ review_entry.book.cover.tint_color | as_rgba(0.25) }};
31     }
32
33     aside #shelf_background {
34       background: url({{ review_entry.book.cover.tint_color | from_hex | create_shelf_data_uri }});
35       background-size: auto 100%;
36     }
37   </style>
38
39   <div class="book-cover">
40     {% set book = review_entry.book %}
41     {% include "_book_cover.html" %}
42   </div>
43
44   <h1>
45     <span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span>
46     {% if review_entry.book.series %}
47     <span class="book-series">({{ review_entry.book.series | smartypants | safe }})</span>
48     {% endif %}
49   </h1>
50
51   {#
52     This means the publication year will be printed in parens next to
53     the first/principal contributor, but only the first contributor.
54     #}
55   {% set contributor_options = {"has_printed_year": False} %}
56
57   <table class="book_metadata">
58     {% for label, contributor in [
59       ("author", review_entry.book.author),
60       ("editor", review_entry.book.editor),
61       ("illustrator", review_entry.book.illustrator),
62       ("narrator", review_entry.book.narrator),
63     ] %}
64       {% if contributor %}
65         <tr>
66           <th>{{ label }}{% if " and" in contributor or ", " in contributor or " & " in contributor %}s{% endif %}:</th>
67           <td>{{ contributor }}
68             {%- if review_entry.book.publication_year and not contributor_options["has_printed_year"] %}
69               ({{ review_entry.book.publication_year}})
70               {% set _ = contributor_options.update({"has_printed_year": True}) %}
71             {%- endif -%}
72           </td>
73         </tr>
74       {% endif %}
75     {% endfor %}
76
77     {% if review_entry.review.date_read %}
78     <tr>
79       <th>date read:</th>
80       <td>{{ review_entry.review.date_read | render_date }}
81         {% if review_entry.review.did_not_finish %}
82         <span class="did_not_finish">
83           (did not finish)
84         </span>
85         {% endif %}
86       </td>
87     </tr>
88     {% endif %}
89     {% if review_entry.review.rating and not review_entry.review.did_not_finish %}
90     <tr>
91       <th>rating:</th>
92       <td>
93         {% for _ in range(review_entry.review.rating) %}
94         ★
95         {% endfor %}
96         {% for _ in range(5 - review_entry.review.rating) %}
97         ☆
98         {% endfor %}
99       </td>
100     </tr>
101     {% endif %}
102   </table>
103
104   <div class="review">
105     {{ review_entry.review.text | render_markdown | safe }}
106
107     <p>(see <a href="/reviews">all reviews</a>)</p>
108   </div>
109 {% endblock %}