1 | import htmlgenerator as hg |
2 |
|
3 |
|
4 | def run(data): |
5 | contents = [ |
6 | hg.DIV( |
7 | hg.P(hg.A(hg.IMG(src="/static/svg/left.svg", _class="inline svg icon"), " Back", href="/blog"), _class="back-button"), |
8 | hg.H1(data.title, _class="title"), |
9 | hg.P( |
10 | data.description, |
11 | _class="description", |
12 | ), |
13 | hg.P( |
14 | hg.B(data.datestring, _class="datetime"), |
15 | hg.I(data.readtime, _class="readtime", title="at 150wpm"), |
16 | ), |
17 | _class="blog-metadata", |
18 | ), |
19 | hg.DIV( |
20 | hg.mark_safe(data.content), |
21 | _class="blog-content", |
22 | ), |
23 | hg.DIV( |
24 | hg.H2("Links", id="links") if len(data.links) > 0 else "", |
25 | hg.UL(*[ |
26 | hg.LI( |
27 | hg.SPAN(link, style="margin-right: 0.5em"), |
28 | hg.I(hg.A(data.links[link] if not data.links[link].startswith("/static") else data.links[link].split("/")[-1], href=data.links[link], target="_blank")), |
29 | ) |
30 | for link in data.links |
31 | ]), |
32 | hg.P( |
33 | hg.B("Article hyperlink: "), |
34 | hg.I(hg.A( |
35 | f"https://joshstock.in/blog/{data.identifier}", |
36 | href=f"/blog/{data.identifier}", |
37 | )), |
38 | ), |
39 | hg.H2("Comments", id="comments"), |
40 | hg.P( |
41 | hg.I( |
42 | "To prevent spam, anonymous comments are held for moderation and may take a few days to appear." |
43 | ) |
44 | ), |
45 | hg.DIV(id="commento"), |
46 | hg.SCRIPT(defer=True, src="https://comments.joshstock.in/js/commento.js"), |
47 | _class="blog-end", |
48 | ), |
49 | ] |
50 |
|
51 | return contents |
52 |
|