Link to a tweet about "Unicorn"
[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   <table class="book_metadata">
50     {% if review_entry.book.author %}
51       <tr>
52         <td>author{% if "and" in review_entry.book.author or ", " in review_entry.book.author or " & " in review_entry.book.author %}s{% endif %}:</td>
53         <th>{{ review_entry.book.author }}
54           {%- if review_entry.book.publication_year %}
55             ({{ review_entry.book.publication_year}})
56           {%- endif -%}
57         </th>
58       </tr>
59     {% endif %}
60     {% if review_entry.book.editor %}
61       <tr>
62         <td>editor{% if "and" in review_entry.book.editor or ", " in review_entry.book.editor or " & " in review_entry.book.editor %}s{% endif %}:</td>
63         <th>{{ review_entry.book.editor }}
64           {%- if review_entry.book.publication_year %}
65             ({{ review_entry.book.publication_year}})
66           {%- endif -%}
67         </th>
68       </tr>
69     {% endif %}
70     {% if review_entry.review.date_read %}
71     <tr>
72       <td>date read:</td>
73       <th>{{ review_entry.review.date_read | render_date }}
74         {% if review_entry.review.did_not_finish %}
75         <span class="did_not_finish">
76           (did not finish)
77         </span>
78         {% endif %}
79       </th>
80     </tr>
81     {% endif %}
82     {% if review_entry.review.rating %}
83     <tr>
84       <td>rating:</td>
85       <th>
86         {% for _ in range(review_entry.review.rating) %}
87         ★
88         {% endfor %}
89         {% for _ in range(5 - review_entry.review.rating) %}
90         ☆
91         {% endfor %}
92         {% if review_entry.review.did_not_finish %}
93         (did not finish)
94         {% endif %}
95       </th>
96     </tr>
97     {% endif %}
98   </table>
99
100   <div class="review">
101     {{ review_entry.review.text | render_markdown | safe }}
102
103     <p>(see <a href="/reviews">all reviews</a>)</p>
104   </div>
105 {% endblock %}