Skip to content

htmforge.elements

htmforge.elements

HTML5 factory functions for htmforge elements.

a(*children, **attrs)

Hyperlink-Element.

Source code in htmforge\elements\__init__.py
def a(*children: Child, **attrs: object) -> Element:
    """Hyperlink-Element."""
    return Element("a", *children, **attrs)

abbr(*children, **attrs)

Abkuerzung mit optionalem Langtext via title-Attribut.

Source code in htmforge\elements\__init__.py
def abbr(*children: Child, **attrs: object) -> Element:
    """Abkuerzung mit optionalem Langtext via title-Attribut."""
    return Element("abbr", *children, **attrs)

address(*children, **attrs)

Kontaktinformations-Block.

Source code in htmforge\elements\__init__.py
def address(*children: Child, **attrs: object) -> Element:
    """Kontaktinformations-Block."""
    return Element("address", *children, **attrs)

area(**attrs)

Klickbarer Bereich in einer Bild-Map als Void-Element.

Source code in htmforge\elements\__init__.py
def area(**attrs: object) -> Element:
    """Klickbarer Bereich in einer Bild-Map als Void-Element."""
    return Element("area", **attrs)

article(*children, **attrs)

Eigenstaendiger Inhalt.

Source code in htmforge\elements\__init__.py
def article(*children: Child, **attrs: object) -> Element:
    """Eigenstaendiger Inhalt."""
    return Element("article", *children, **attrs)

aside(*children, **attrs)

Nebeninhalt.

Source code in htmforge\elements\__init__.py
def aside(*children: Child, **attrs: object) -> Element:
    """Nebeninhalt."""
    return Element("aside", *children, **attrs)

audio(*children, **attrs)

Audio-Mediaplayer.

Source code in htmforge\elements\__init__.py
def audio(*children: Child, **attrs: object) -> Element:
    """Audio-Mediaplayer."""
    return Element("audio", *children, **attrs)

blockquote(*children, **attrs)

Blockzitat.

Source code in htmforge\elements\__init__.py
def blockquote(*children: Child, **attrs: object) -> Element:
    """Blockzitat."""
    return Element("blockquote", *children, **attrs)

body(*children, **attrs)

Sichtbarer Dokumentinhalt.

Source code in htmforge\elements\__init__.py
def body(*children: Child, **attrs: object) -> Element:
    """Sichtbarer Dokumentinhalt."""
    return Element("body", *children, **attrs)

br(**attrs)

Zeilenumbruch als Void-Element.

Source code in htmforge\elements\__init__.py
def br(**attrs: object) -> Element:
    """Zeilenumbruch als Void-Element."""
    return Element("br", **attrs)

button(*children, **attrs)

Interaktiver Button.

Source code in htmforge\elements\__init__.py
def button(*children: Child, **attrs: object) -> Element:
    """Interaktiver Button."""
    return Element("button", *children, **attrs)

canvas(*children, **attrs)

Zeichenflaeche fuer JavaScript-Grafiken.

Source code in htmforge\elements\__init__.py
def canvas(*children: Child, **attrs: object) -> Element:
    """Zeichenflaeche fuer JavaScript-Grafiken."""
    return Element("canvas", *children, **attrs)

caption(*children, **attrs)

Tabellenbeschriftung.

Source code in htmforge\elements\__init__.py
def caption(*children: Child, **attrs: object) -> Element:
    """Tabellenbeschriftung."""
    return Element("caption", *children, **attrs)

code(*children, **attrs)

Inline-Codefragment.

Source code in htmforge\elements\__init__.py
def code(*children: Child, **attrs: object) -> Element:
    """Inline-Codefragment."""
    return Element("code", *children, **attrs)

col(**attrs)

Einzelne Tabellenspalte als Void-Element.

Source code in htmforge\elements\__init__.py
def col(**attrs: object) -> Element:
    """Einzelne Tabellenspalte als Void-Element."""
    return Element("col", **attrs)

colgroup(*children, **attrs)

Gruppe von Tabellenspalten.

Source code in htmforge\elements\__init__.py
def colgroup(*children: Child, **attrs: object) -> Element:
    """Gruppe von Tabellenspalten."""
    return Element("colgroup", *children, **attrs)

details(*children, **attrs)

Aufklappbares Disclosure-Element.

Source code in htmforge\elements\__init__.py
def details(*children: Child, **attrs: object) -> Element:
    """Aufklappbares Disclosure-Element."""
    return Element("details", *children, **attrs)

dialog(*children, **attrs)

Modaler oder nicht-modaler Dialog-Container.

Source code in htmforge\elements\__init__.py
def dialog(*children: Child, **attrs: object) -> Element:
    """Modaler oder nicht-modaler Dialog-Container."""
    return Element("dialog", *children, **attrs)

div(*children, **attrs)

Block-Container.

Source code in htmforge\elements\__init__.py
def div(*children: Child, **attrs: object) -> Element:
    """Block-Container."""
    return Element("div", *children, **attrs)

em(*children, **attrs)

Betonter Text.

Source code in htmforge\elements\__init__.py
def em(*children: Child, **attrs: object) -> Element:
    """Betonter Text."""
    return Element("em", *children, **attrs)

fieldset(*children, **attrs)

Gruppierung verwandter Formularfelder.

Source code in htmforge\elements\__init__.py
def fieldset(*children: Child, **attrs: object) -> Element:
    """Gruppierung verwandter Formularfelder."""
    return Element("fieldset", *children, **attrs)

figcaption(*children, **attrs)

Bildunterschrift fuer figure.

Source code in htmforge\elements\__init__.py
def figcaption(*children: Child, **attrs: object) -> Element:
    """Bildunterschrift fuer figure."""
    return Element("figcaption", *children, **attrs)

figure(*children, **attrs)

Container fuer Medieninhalte.

Source code in htmforge\elements\__init__.py
def figure(*children: Child, **attrs: object) -> Element:
    """Container fuer Medieninhalte."""
    return Element("figure", *children, **attrs)

footer(*children, **attrs)

Fussbereich eines Abschnitts.

Source code in htmforge\elements\__init__.py
def footer(*children: Child, **attrs: object) -> Element:
    """Fussbereich eines Abschnitts."""
    return Element("footer", *children, **attrs)

form(*children, **attrs)

Formular-Container.

Source code in htmforge\elements\__init__.py
def form(*children: Child, **attrs: object) -> Element:
    """Formular-Container."""
    return Element("form", *children, **attrs)

h1(*children, **attrs)

Ueberschrift Ebene 1.

Source code in htmforge\elements\__init__.py
def h1(*children: Child, **attrs: object) -> Element:
    """Ueberschrift Ebene 1."""
    return Element("h1", *children, **attrs)

h2(*children, **attrs)

Ueberschrift Ebene 2.

Source code in htmforge\elements\__init__.py
def h2(*children: Child, **attrs: object) -> Element:
    """Ueberschrift Ebene 2."""
    return Element("h2", *children, **attrs)

h3(*children, **attrs)

Ueberschrift Ebene 3.

Source code in htmforge\elements\__init__.py
def h3(*children: Child, **attrs: object) -> Element:
    """Ueberschrift Ebene 3."""
    return Element("h3", *children, **attrs)

h4(*children, **attrs)

Ueberschrift Ebene 4.

Source code in htmforge\elements\__init__.py
def h4(*children: Child, **attrs: object) -> Element:
    """Ueberschrift Ebene 4."""
    return Element("h4", *children, **attrs)

h5(*children, **attrs)

Ueberschrift Ebene 5.

Source code in htmforge\elements\__init__.py
def h5(*children: Child, **attrs: object) -> Element:
    """Ueberschrift Ebene 5."""
    return Element("h5", *children, **attrs)

h6(*children, **attrs)

Ueberschrift Ebene 6.

Source code in htmforge\elements\__init__.py
def h6(*children: Child, **attrs: object) -> Element:
    """Ueberschrift Ebene 6."""
    return Element("h6", *children, **attrs)

head(*children, **attrs)

Dokumentkopf mit Metadaten.

Source code in htmforge\elements\__init__.py
def head(*children: Child, **attrs: object) -> Element:
    """Dokumentkopf mit Metadaten."""
    return Element("head", *children, **attrs)

header(*children, **attrs)

Kopfbereich eines Abschnitts.

Source code in htmforge\elements\__init__.py
def header(*children: Child, **attrs: object) -> Element:
    """Kopfbereich eines Abschnitts."""
    return Element("header", *children, **attrs)

hr(**attrs)

Thematischer Trennstrich als Void-Element.

Source code in htmforge\elements\__init__.py
def hr(**attrs: object) -> Element:
    """Thematischer Trennstrich als Void-Element."""
    return Element("hr", **attrs)

html(*children, **attrs)

Wurzelelement des HTML-Dokuments.

Source code in htmforge\elements\__init__.py
def html(*children: Child, **attrs: object) -> Element:
    """Wurzelelement des HTML-Dokuments."""
    return Element("html", *children, **attrs)

iframe(*children, **attrs)

Eingebetteter Browser-Frame.

Source code in htmforge\elements\__init__.py
def iframe(*children: Child, **attrs: object) -> Element:
    """Eingebetteter Browser-Frame."""
    return Element("iframe", *children, **attrs)

img(**attrs)

Bild als Void-Element.

Source code in htmforge\elements\__init__.py
def img(**attrs: object) -> Element:
    """Bild als Void-Element."""
    return Element("img", **attrs)

input(**attrs)

Eingabefeld als Void-Element.

Source code in htmforge\elements\__init__.py
def input(**attrs: object) -> Element:
    """Eingabefeld als Void-Element."""
    return Element("input", **attrs)

kbd(*children, **attrs)

Tastatureingabe-Formatierung.

Source code in htmforge\elements\__init__.py
def kbd(*children: Child, **attrs: object) -> Element:
    """Tastatureingabe-Formatierung."""
    return Element("kbd", *children, **attrs)

label(*children, **attrs)

Beschriftung fuer Formularfelder.

Source code in htmforge\elements\__init__.py
def label(*children: Child, **attrs: object) -> Element:
    """Beschriftung fuer Formularfelder."""
    return Element("label", *children, **attrs)

legend(*children, **attrs)

Beschriftung fuer ein fieldset-Element.

Source code in htmforge\elements\__init__.py
def legend(*children: Child, **attrs: object) -> Element:
    """Beschriftung fuer ein fieldset-Element."""
    return Element("legend", *children, **attrs)

li(*children, **attrs)

Listeneintrag.

Source code in htmforge\elements\__init__.py
def li(*children: Child, **attrs: object) -> Element:
    """Listeneintrag."""
    return Element("li", *children, **attrs)

Externe Ressource als Void-Element (z.B. Stylesheet).

Source code in htmforge\elements\__init__.py
def link(**attrs: object) -> Element:
    """Externe Ressource als Void-Element (z.B. Stylesheet)."""
    return Element("link", **attrs)

main(*children, **attrs)

Hauptinhalt der Seite.

Source code in htmforge\elements\__init__.py
def main(*children: Child, **attrs: object) -> Element:
    """Hauptinhalt der Seite."""
    return Element("main", *children, **attrs)

map_(*children, **attrs)

Bild-Map-Container (map_ wegen Python-Namenskonflikt).

Source code in htmforge\elements\__init__.py
def map_(*children: Child, **attrs: object) -> Element:
    """Bild-Map-Container (map_ wegen Python-Namenskonflikt)."""
    return Element("map", *children, **attrs)

mark(*children, **attrs)

Hervorgehobener (markierter) Text.

Source code in htmforge\elements\__init__.py
def mark(*children: Child, **attrs: object) -> Element:
    """Hervorgehobener (markierter) Text."""
    return Element("mark", *children, **attrs)

meta(**attrs)

Metadaten-Void-Element.

Source code in htmforge\elements\__init__.py
def meta(**attrs: object) -> Element:
    """Metadaten-Void-Element."""
    return Element("meta", **attrs)

meter(*children, **attrs)

Skalarer Messwert innerhalb eines bekannten Bereichs.

Source code in htmforge\elements\__init__.py
def meter(*children: Child, **attrs: object) -> Element:
    """Skalarer Messwert innerhalb eines bekannten Bereichs."""
    return Element("meter", *children, **attrs)

nav(*children, **attrs)

Navigationsbereich.

Source code in htmforge\elements\__init__.py
def nav(*children: Child, **attrs: object) -> Element:
    """Navigationsbereich."""
    return Element("nav", *children, **attrs)

noscript(*children, **attrs)

Fallback-Inhalt wenn JavaScript deaktiviert ist.

Source code in htmforge\elements\__init__.py
def noscript(*children: Child, **attrs: object) -> Element:
    """Fallback-Inhalt wenn JavaScript deaktiviert ist."""
    return Element("noscript", *children, **attrs)

ol(*children, **attrs)

Geordnete Liste.

Source code in htmforge\elements\__init__.py
def ol(*children: Child, **attrs: object) -> Element:
    """Geordnete Liste."""
    return Element("ol", *children, **attrs)

option(*children, **attrs)

Eintrag in einer Auswahlliste.

Source code in htmforge\elements\__init__.py
def option(*children: Child, **attrs: object) -> Element:
    """Eintrag in einer Auswahlliste."""
    return Element("option", *children, **attrs)

p(*children, **attrs)

Absatz-Element.

Source code in htmforge\elements\__init__.py
def p(*children: Child, **attrs: object) -> Element:
    """Absatz-Element."""
    return Element("p", *children, **attrs)

picture(*children, **attrs)

Responsives Bild-Container-Element.

Source code in htmforge\elements\__init__.py
def picture(*children: Child, **attrs: object) -> Element:
    """Responsives Bild-Container-Element."""
    return Element("picture", *children, **attrs)

pre(*children, **attrs)

Vorformatierter Textblock.

Source code in htmforge\elements\__init__.py
def pre(*children: Child, **attrs: object) -> Element:
    """Vorformatierter Textblock."""
    return Element("pre", *children, **attrs)

progress(*children, **attrs)

Fortschrittsbalken.

Source code in htmforge\elements\__init__.py
def progress(*children: Child, **attrs: object) -> Element:
    """Fortschrittsbalken."""
    return Element("progress", *children, **attrs)

raw(text)

Gibt einen String als rohes, nicht-escaptes HTML-Markup zurück.

Verwende diese Funktion, um Inhalte von <script> oder <style>- Tags einzubetten, die von markupsafe nicht erneut escaped werden sollen.

Parameters:

Name Type Description Default
text str

Der rohe Textinhalt (CSS, JavaScript …).

required

Returns:

Name Type Description
Ein Markup

class:markupsafe.Markup-Objekt.

Example

from htmforge.elements import script, raw script(raw("console.log(1)")).to_html() ''

Source code in htmforge\elements\__init__.py
def raw(text: str) -> Markup:
    """Gibt einen String als rohes, nicht-escaptes HTML-Markup zurück.

    Verwende diese Funktion, um Inhalte von ``<script>`` oder ``<style>``-
    Tags einzubetten, die von markupsafe nicht erneut escaped werden sollen.

    Args:
        text: Der rohe Textinhalt (CSS, JavaScript …).

    Returns:
        Ein :class:`markupsafe.Markup`-Objekt.

    Example:
        >>> from htmforge.elements import script, raw
        >>> script(raw("console.log(1)")).to_html()
        '<script>console.log(1)</script>'
    """
    return Markup(text)  # noqa: S704

script(*children, **attrs)

Skript-Block oder externes Skript.

Verwende :func:raw für Inline-JavaScript, damit der Inhalt nicht escaped wird.

Source code in htmforge\elements\__init__.py
def script(*children: Child, **attrs: object) -> Element:
    """Skript-Block oder externes Skript.

    Verwende :func:`raw` für Inline-JavaScript, damit der Inhalt
    nicht escaped wird.
    """
    return Element("script", *children, **attrs)

section(*children, **attrs)

Thematischer Abschnitt.

Source code in htmforge\elements\__init__.py
def section(*children: Child, **attrs: object) -> Element:
    """Thematischer Abschnitt."""
    return Element("section", *children, **attrs)

select(*children, **attrs)

Auswahlliste.

Source code in htmforge\elements\__init__.py
def select(*children: Child, **attrs: object) -> Element:
    """Auswahlliste."""
    return Element("select", *children, **attrs)

small(*children, **attrs)

Nebenbemerkung oder Kleingedrucktes.

Source code in htmforge\elements\__init__.py
def small(*children: Child, **attrs: object) -> Element:
    """Nebenbemerkung oder Kleingedrucktes."""
    return Element("small", *children, **attrs)

source(**attrs)

Mediaquelle als Void-Element fuer audio/video/picture.

Source code in htmforge\elements\__init__.py
def source(**attrs: object) -> Element:
    """Mediaquelle als Void-Element fuer audio/video/picture."""
    return Element("source", **attrs)

span(*children, **attrs)

Inline-Container.

Source code in htmforge\elements\__init__.py
def span(*children: Child, **attrs: object) -> Element:
    """Inline-Container."""
    return Element("span", *children, **attrs)

strong(*children, **attrs)

Wichtiger, stark hervorgehobener Text.

Source code in htmforge\elements\__init__.py
def strong(*children: Child, **attrs: object) -> Element:
    """Wichtiger, stark hervorgehobener Text."""
    return Element("strong", *children, **attrs)

style(*children, **attrs)

Inline-CSS-Block.

Verwende :func:raw für CSS-Inhalt, damit er nicht escaped wird.

Source code in htmforge\elements\__init__.py
def style(*children: Child, **attrs: object) -> Element:
    """Inline-CSS-Block.

    Verwende :func:`raw` für CSS-Inhalt, damit er nicht escaped wird.
    """
    return Element("style", *children, **attrs)

sub(*children, **attrs)

Tiefgestellter Text.

Source code in htmforge\elements\__init__.py
def sub(*children: Child, **attrs: object) -> Element:
    """Tiefgestellter Text."""
    return Element("sub", *children, **attrs)

summary(*children, **attrs)

Sichtbare Zusammenfassung fuer ein details-Element.

Source code in htmforge\elements\__init__.py
def summary(*children: Child, **attrs: object) -> Element:
    """Sichtbare Zusammenfassung fuer ein details-Element."""
    return Element("summary", *children, **attrs)

sup(*children, **attrs)

Hochgestellter Text.

Source code in htmforge\elements\__init__.py
def sup(*children: Child, **attrs: object) -> Element:
    """Hochgestellter Text."""
    return Element("sup", *children, **attrs)

table(*children, **attrs)

Tabellen-Container.

Source code in htmforge\elements\__init__.py
def table(*children: Child, **attrs: object) -> Element:
    """Tabellen-Container."""
    return Element("table", *children, **attrs)

tbody(*children, **attrs)

Tabelleninhalt.

Source code in htmforge\elements\__init__.py
def tbody(*children: Child, **attrs: object) -> Element:
    """Tabelleninhalt."""
    return Element("tbody", *children, **attrs)

td(*children, **attrs)

Tabellenzelle.

Source code in htmforge\elements\__init__.py
def td(*children: Child, **attrs: object) -> Element:
    """Tabellenzelle."""
    return Element("td", *children, **attrs)

textarea(*children, **attrs)

Mehrzeiliges Texteingabefeld.

Source code in htmforge\elements\__init__.py
def textarea(*children: Child, **attrs: object) -> Element:
    """Mehrzeiliges Texteingabefeld."""
    return Element("textarea", *children, **attrs)

tfoot(*children, **attrs)

Tabellenfuss.

Source code in htmforge\elements\__init__.py
def tfoot(*children: Child, **attrs: object) -> Element:
    """Tabellenfuss."""
    return Element("tfoot", *children, **attrs)

th(*children, **attrs)

Tabellenkopf-Zelle.

Source code in htmforge\elements\__init__.py
def th(*children: Child, **attrs: object) -> Element:
    """Tabellenkopf-Zelle."""
    return Element("th", *children, **attrs)

thead(*children, **attrs)

Tabellenkopf.

Source code in htmforge\elements\__init__.py
def thead(*children: Child, **attrs: object) -> Element:
    """Tabellenkopf."""
    return Element("thead", *children, **attrs)

time(*children, **attrs)

Maschinenlesbarer Zeit-/Datumsinhalt.

Source code in htmforge\elements\__init__.py
def time(*children: Child, **attrs: object) -> Element:
    """Maschinenlesbarer Zeit-/Datumsinhalt."""
    return Element("time", *children, **attrs)

title(*children, **attrs)

Dokumenttitel (im Browser-Tab).

Source code in htmforge\elements\__init__.py
def title(*children: Child, **attrs: object) -> Element:
    """Dokumenttitel (im Browser-Tab)."""
    return Element("title", *children, **attrs)

tr(*children, **attrs)

Tabellenzeile.

Source code in htmforge\elements\__init__.py
def tr(*children: Child, **attrs: object) -> Element:
    """Tabellenzeile."""
    return Element("tr", *children, **attrs)

track(**attrs)

Textspur fuer audio/video als Void-Element.

Source code in htmforge\elements\__init__.py
def track(**attrs: object) -> Element:
    """Textspur fuer audio/video als Void-Element."""
    return Element("track", **attrs)

ul(*children, **attrs)

Ungeordnete Liste.

Source code in htmforge\elements\__init__.py
def ul(*children: Child, **attrs: object) -> Element:
    """Ungeordnete Liste."""
    return Element("ul", *children, **attrs)

video(*children, **attrs)

Video-Mediaplayer.

Source code in htmforge\elements\__init__.py
def video(*children: Child, **attrs: object) -> Element:
    """Video-Mediaplayer."""
    return Element("video", *children, **attrs)