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.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/blog_experiment/blog/html.py b/blog_experiment/blog/html.py
new file mode 100644
index 00000000..7293d395
--- /dev/null
+++ b/blog_experiment/blog/html.py
@@ -0,0 +1,29 @@
+import subprocess
+
+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,
+ ),
+ ),
+ {},
+ )
+ )