Esempio n. 1
0
def make_script(*,
                src: Optional[str] = None,
                _type: Optional[str] = None,
                content: str = "") -> Element:
    element = Element("script")
    kwargs = {}
    if src:
        kwargs["src"] = src
    if _type:
        kwargs["type"] = _type
    element = element(**kwargs)
    return element[content]
Esempio n. 2
0
def make_html(head: Element, body: Element, language: str = "en") -> Element:
    element = Element("html")
    return element(lang=language)[head, body]
Esempio n. 3
0
def make_body(children: Tuple[Element]) -> Element:
    return Element("body")[children]
Esempio n. 4
0
def make_title(text: str) -> Element:
    return Element("title")[text]
Esempio n. 5
0
def make_link(rel: str, href: str, *, _type: Optional[str] = None) -> Element:
    kwargs = dict(rel=rel, href=href)
    if _type:
        kwargs["type"] = _type
    return Element("link", no_content=True)(**kwargs)
Esempio n. 6
0
def make_meta(**kwargs) -> Element:
    return Element("meta", no_content=True)(**kwargs)
Esempio n. 7
0
def make_head(title: Element, metas: Tuple) -> Element:
    return Element("head")[(title, *metas)]