aboutsummaryrefslogtreecommitdiff
path: root/blog_experiment/blog/html.py
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2023-10-07 21:53:02 +0200
committeralex <alex@pdp7.net>2023-10-07 21:53:02 +0200
commita4d7a6d6b23180660d53df499a72e8af3548a8c1 (patch)
treed56ee405d32fbff79a75a1708fb253f1095f8f64 /blog_experiment/blog/html.py
parentbf8b87730aa24524c0974cd4083a30c0d1c411a1 (diff)
Make blog work as container
* Use BeautifulSoup instead of HTML Tidy, so everything is done in Python * Pull content as submodule for testing purposes * Comment how to use bicephalus from working copy
Diffstat (limited to 'blog_experiment/blog/html.py')
-rw-r--r--blog_experiment/blog/html.py37
1 files changed, 12 insertions, 25 deletions
diff --git a/blog_experiment/blog/html.py b/blog_experiment/blog/html.py
index a114318a..6c3b0099 100644
--- a/blog_experiment/blog/html.py
+++ b/blog_experiment/blog/html.py
@@ -1,30 +1,17 @@
-import subprocess
-
+import bs4
import htmlgenerator as h
-def tidy(s):
- p = subprocess.run(
- ["tidy", "--indent", "yes", "-q", "-wrap", "160"],
- input=s,
- stdout=subprocess.PIPE,
- encoding="UTF8",
- )
- return p.stdout
-
-
def html_template(*content):
- return tidy(
- h.render(
- h.HTML(
- h.HEAD(h.TITLE("El blog es mío")),
- h.BODY(
- h.H1("El blog es mío"),
- h.H2("Hay otros como él, pero este es el mío"),
- *content,
- ),
- doctype="html",
+ return bs4.BeautifulSoup(h.render(
+ h.HTML(
+ h.HEAD(h.TITLE("El blog es mío")),
+ h.BODY(
+ h.H1("El blog es mío"),
+ h.H2("Hay otros como él, pero este es el mío"),
+ *content,
),
- {},
- )
- )
+ doctype="html",
+ ),
+ {},
+ ), features="html.parser").prettify()