git ssb

0+

Grey the earthling / gkn.me.uk



Tree: df8c0d25c35c9792c466c8fdc5979c1dd7d92766

Files: df8c0d25c35c9792c466c8fdc5979c1dd7d92766 / generator / templates / month.py

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

Built with git-ssb-web