git ssb

0+

Grey the earthling / gkn.me.uk



Tree: 482f7f2ad6b114ad2f8af9815ad7788e2b630cd3

Files: 482f7f2ad6b114ad2f8af9815ad7788e2b630cd3 / generator / templates / year.py

2169 bytesRaw
1import common
2
3
4def html(entries, date):
5 list_of_entries = (
6 "<ol>"
7 + "".join(
8 ("<li>" + common.link_to_entry(entry) + "</li>")
9 for entry in entries
10 if entries[entry]["date"].year == date.year
11 )
12 + "</ol>"
13 )
14 list_of_dates = (
15 "<h2>Years:</h2>"
16 + "<ol>"
17 + "".join(
18 (
19 "<li>"
20 + (
21 f"<strong>{year:%Y}</strong>"
22 if year.year == date.year
23 else f'<a href="{common.url_of_year(year)}">{year:%Y}</a>'
24 )
25 + "</li>"
26 )
27 for year in common.years
28 )
29 + "</ol>"
30 + "<h2>Months:</h2>"
31 + "<ol>"
32 + "".join(
33 (
34 "<li>"
35 + f'<a href="{common.url_of_month(month)}">{month:%B}</a>'
36 + "</li>"
37 )
38 for month in common.months
39 if month.year == date.year
40 )
41 + "</ol>"
42 )
43
44 return common.print_html(
45 f"""<!doctype html>
46 <html>
47 <head>
48 {common.head}
49 <title>{common.title(f"{date:%Y}")}</title>
50 </head>
51 <body class="{common.colour_class}">
52 <header>
53 <h1>{date:%Y}</h1>
54 <nav>
55 <a href="#menu"><strong>Other lists of entries ↓</strong></a>
56 </nav>
57 </header>
58 <main>
59 <hr/>
60 <nav>
61 {list_of_entries}
62 </nav>
63 </main>
64 <footer id="menu">
65 <hr/>
66 <nav class="menu">
67 <a href="/entries"><strong>All entries</strong></a>
68 {list_of_dates}
69 </nav>
70 </footer>
71 {common.footer}
72 </body>
73 </html>
74 """
75 )
76

Built with git-ssb-web