From e7d04e802ea9fcf4a56210be16aaa0b131e5e797 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 17 Sep 2023 17:39:54 +0200 Subject: Refactor in modules, add gemtext parser --- blog_experiment/blog/html.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 blog_experiment/blog/html.py (limited to 'blog_experiment/blog/html.py') 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, + ), + ), + {}, + ) + ) -- cgit v1.2.3