git ssb

0+

Grey the earthling / gkn.me.uk



Tree: 292a4fa877f02b9de2309f7e755dd3c01c1ccb0e

Files: 292a4fa877f02b9de2309f7e755dd3c01c1ccb0e / generator / templates / entries.py

3125 bytesRaw
1import common
2
3
4def atom(entries):
5 return (
6 """<?xml version="1.0" encoding="utf-8"?>"""
7 """<feed xmlns="http://www.w3.org/2005/Atom">"""
8 "<title>" + common.title("") + "</title>"
9 f"""<id>{common.base_url}/</id>"""
10 f"""<link href="{common.base_url}/" rel="alternate"/>"""
11 f"""<link href="{common.base_url}/feed" rel="self"/>"""
12 "<author><name>Grey Nicholson</name></author>"
13 f"<icon>{common.base_url}/style/icon.svg</icon>"
14 "<updated>"
15 + common.updated.isoformat()
16 + "</updated>"
17 + "\n"
18 + "\n".join(common.atom_entry(id) for id in reversed(entries))
19 + "\n"
20 + "</feed>"
21 )
22
23
24def html(entries):
25 list_of_entries = (
26 "<ol reversed>"
27 + "".join(
28 ("<li>" + common.link_to_entry(entry) + "</li>")
29 for entry in reversed(entries)
30 )
31 + "</ol>"
32 )
33 list_of_dates = (
34 "<h2>Years:</h2>"
35 + "<ol>"
36 + "".join(
37 ("<li>" + f'<a href="{common.url_of_year(year)}">{year:%Y}</a>' + "</li>")
38 for year in common.years
39 )
40 + "</ol>"
41 )
42 list_of_series = (
43 (
44 "<h2>Series:</h2>"
45 + "<ul>"
46 + "".join(
47 (
48 "<li>"
49 + f'<a href="{common.url_of_series(series)}">{series}</a>'
50 + "</li>"
51 )
52 for series in common.series
53 )
54 + "</ul>"
55 )
56 if len(common.series) > 0
57 else ""
58 )
59 list_of_tags = (
60 (
61 "<h2>Tags:</h2>"
62 + "<ul>"
63 + "".join(
64 ("<li>" + f'<a href="{common.url_of_tag(tag)}">{tag}</a>' + "</li>")
65 for tag in common.repeated_tags
66 )
67 + "</ul>"
68 )
69 if len(common.repeated_tags) > 0
70 else ""
71 )
72
73 return common.print_html(
74 f"""<!doctype html>
75 <html>
76 <head>
77 {common.head}
78 <title>{common.title('All entries')}</title>
79 </head>
80 <body class="{common.colour_class}">
81 <header>
82 <h1>All entries</h1>
83 <nav>
84 <a href="#menu"><strong>Other lists of entries ↓</strong></a>
85 </nav>
86 </header>
87 <main>
88 <hr/>
89 <nav>
90 {list_of_entries}
91 </nav>
92 </main>
93 <footer id="menu">
94 <hr/>
95 <nav class="menu">
96 <strong>All entries</strong>
97 {list_of_dates}
98 {list_of_series}
99 {list_of_tags}
100 </nav>
101 </footer>
102 {common.footer}
103 </body>
104 </html>
105 """
106 )
107

Built with git-ssb-web