git ssb

0+

Grey the earthling / gkn.me.uk



Tree: 305411b620accbb0d285152dac313c556e5c02c3

Files: 305411b620accbb0d285152dac313c556e5c02c3 / generator / templates / day.py

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

Built with git-ssb-web