aboutsummaryrefslogtreecommitdiff
path: root/blog_experiment/blog/html.py
diff options
context:
space:
mode:
Diffstat (limited to 'blog_experiment/blog/html.py')
-rw-r--r--blog_experiment/blog/html.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/blog_experiment/blog/html.py b/blog_experiment/blog/html.py
index 25a2e82e..c7112ea8 100644
--- a/blog_experiment/blog/html.py
+++ b/blog_experiment/blog/html.py
@@ -1,25 +1,35 @@
-import bs4
+import itertools
+
import htmlgenerator as h
-from blog import meta
+from blog import meta, pretty
def html_template(*content, page_title=None):
- title = meta.TITLE
+ title = [h.A(meta.TITLE, href=meta.BASE_URL)]
if page_title:
title += f" - {page_title}"
- return bs4.BeautifulSoup(h.render(
+
+ title = h.BaseElement(*title)
+
+ links = list(itertools.chain(*[(h.A(text, href=href), ", ") for text, href in meta.LINKS]))
+
+ links += h.BaseElement(f" {meta.EMAIL_TEXT}")
+
+ return pretty.pretty_html(h.render(
h.HTML(
h.HEAD(
- h.TITLE(title),
+ h.TITLE(meta.TITLE + (f" - {page_title}" if page_title else "")),
h.LINK(rel="alternate", type="application/rss+xml", title=meta.TITLE, href=f"{meta.BASE_URL}/feed/"),
),
h.BODY(
h.H1(title),
h.H2(meta.SUBTITLE),
+ h.P(*links),
*content,
),
doctype="html",
),
{},
- ), features="html.parser").prettify()
+ ))
+