constance

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

templates/homepage/index.html (2385B) - 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 itertools import groupby
      7 from viewutils import markdown, mini_markdown, tag_list
      8 ?>
      9 
     10 <head>
     11     <link rel="alternate" type="application/atom+xml" title="Atom feed" href="firehose.atom" />
     12     <title>${config.get('homepage', 'title')}</title>
     13     <meta py:if="config.get('homepage', 'icbm')" name="ICBM" content="${config.get('homepage', 'icbm')}" />
     14     <py:if test="config.has_option('homepage', 'openid_delegate')">
     15         <link rel="openid.delegate" href="${config.get('homepage', 'openid_delegate')}" />
     16         <link rel="openid2.local_id" href="${config.get('homepage', 'openid_delegate')}" />
     17     </py:if>
     18     <py:if test="config.get('homepage', 'openid_server')">
     19         <link rel="openid.server" href="${config.get('homepage', 'openid_server')}" />
     20         <link rel="openid2.provider" href="${config.get('homepage', 'openid_server')}" />
     21     </py:if>
     22     <meta py:if="config.has_option('homepage', 'xrds')" http-equiv="X-XRDS-Location" content="${config.get('homepage', 'xrds')}" />
     23 </head>
     24 
     25 <body>
     26 
     27     <py:if test="len(blog_entries) != 0">
     28     <section>
     29         <h1>Recent blog entries</h1>
     30         <ul class="blog-index">
     31             <li py:for="item in sorted(blog_entries, key=lambda e: e.publication_date, reverse=True)[:4]">
     32                 <a href="blog/${item.id}">${item.title}</a>
     33                 <time datetime="${item.publication_date.strftime(str('%Y-%m-%d %H:%M:%S%Z'))}">${item.publication_date.strftime(str('%-1d %B %Y'))}</time>
     34             </li>
     35         </ul>
     36         <p class="more"><a href="blog/">older entries&#8230;</a></p>
     37     </section>
     38     </py:if>
     39 
     40     <py:if test="len(reading_entries) != 0">
     41     <section>
     42         <h1>Recent reading</h1>
     43         <ul class="reading-index">
     44             <li py:for="item in sorted((e for e in reading_entries if e.isbn), key=lambda e: e.publication_date, reverse=True)[:6]">
     45                 <a py:strip="not item.url" href="${item.url}">
     46                     <img py:if="item.isbn" class="cover"
     47                          src="/covers/isbn/${item.isbn}/thumbnail"
     48                          alt="${item.title.striptags()}" />
     49                 </a>
     50             </li>
     51         </ul>
     52         <p class="more"><a href="reading">older entries&#8230;</a></p>
     53     </section>
     54     </py:if>
     55 
     56 </body>
     57 </html>
     58