constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/

templates/reading/reading.html (1580B) - raw

      1 <html xmlns="http://www.w3.org/1999/xhtml"
      2       xmlns:py="http://genshi.edgewall.org/"
      3 	  lang="en-AU">
      4 
      5 <?python
      6 from viewutils import markdown, mini_markdown, tag_list, idify
      7 ?>
      8 
      9 <span py:def="stars(rating)" py:strip="True">
     10     <img src="/images/star.png" alt="[star]" py:for="_ in range(int(rating))" /><img src="/images/star-half.png" alt="[half-star]" py:if="rating > int(rating)" /><img src="/images/star-off.png" alt="" py:for="_ in range(int(5 - rating))" />
     11 </span>
     12 
     13 <head>
     14     <title>${config.get('reading', 'title')}</title>
     15     <link rel="alternate" type="application/atom+xml" title="Atom feed" href="reading.atom" />
     16 </head>
     17 
     18 <body>
     19 <section>
     20     <h1>${config.get('reading', 'title')}</h1>
     21 
     22     <py:for each="item in sorted(items, key=lambda e: e.publication_date, reverse=True)">
     23         <div class="item reading-log-entry" id="${idify(item.title.striptags())}">
     24             <img py:if="item.isbn" class="cover"
     25                  src="/covers/isbn/${item.isbn}/thumbnail"
     26                  alt="Cover image for ${item.title.striptags()}" />
     27             <div>
     28                 <span class="title"><a py:strip="not item.url" href="${item.url}">${item.title}</a></span>
     29                 <span py:if="item.author" class="author">by ${item.author}</span>
     30                 <time datetime="${item.publication_date.strftime(str('%Y-%m-%d %H:%M:%S%Z'))}">${item.publication_date.strftime(str('%-1d %B %Y'))}</time>
     31                 <span py:if="item.rating" class="rating">${stars(item.rating)}</span>
     32             </div>
     33         </div>
     34     </py:for>
     35 </section>
     36 </body>
     37 </html>
     38