summaryrefslogtreecommitdiff
path: root/blog_experiment/blog/html.py
blob: 3478eb2fc8a895a04e50a4a1fa008ce31d8f8798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import bs4
import htmlgenerator as h

from blog import meta


def html_template(*content, page_title=None):
    title = "El blog es mío"
    if page_title:
        title += f" - {page_title}"
    return bs4.BeautifulSoup(h.render(
        h.HTML(
            h.HEAD(h.TITLE(title)),
            h.BODY(
                h.H1(meta.TITLE),
                h.H2(meta.SUBTITLE),
                *content,
            ),
            doctype="html",
        ),
        {},
    ), features="html.parser").prettify()