Exemple #1
0
def write_html_header(doc: yattag.doc.Doc) -> None:
    """Produces the verify first line of a HTML output."""
    doc.asis("<!DOCTYPE html>\n")
Exemple #2
0
def write_html_head(doc: yattag.doc.Doc, title: str) -> None:
    """Produces the <head> tag and its contents."""
    prefix = config.Config.get_uri_prefix()
    with doc.tag("head"):
        with doc.tag("title"):
            doc.text(_("Where to map?") + title)
        doc.stag("meta", charset="UTF-8")
        doc.stag("link",
                 rel="stylesheet",
                 type="text/css",
                 href=prefix + "/static/osm.css")
        with doc.tag("script", src=prefix + "/static/bundle.js"):
            pass
        doc.stag("meta",
                 name="viewport",
                 content="width=device-width, initial-scale=1")
Exemple #3
0
def write_html_head(doc: yattag.doc.Doc, title: str) -> None:
    """Produces the <head> tag and its contents."""
    prefix = config.Config.get_uri_prefix()
    with doc.tag("head"):
        with doc.tag("title"):
            doc.text(_("Where to map?") + title)
        doc.stag("meta", charset="UTF-8")
        doc.stag("link",
                 rel="stylesheet",
                 type="text/css",
                 href=prefix + "/static/osm.css")
        with doc.tag("script", src=prefix + "/static/sorttable.js"):
            pass
        doc.stag("meta",
                 name="viewport",
                 content="width=device-width, initial-scale=1")
        if config.Config.has_matomo():
            datadir = config.get_abspath("data")
            with open(os.path.join(datadir, "matomo.html.template")) as stream:
                matomo_url = config.Config.get_matomo_url()
                matomo_site_id = config.Config.get_matomo_site_id()
                doc.asis(stream.read().replace("@MATOMO_URL@",
                                               matomo_url).replace(
                                                   "@MATOMO_SITE_ID@",
                                                   matomo_site_id))
Exemple #4
0
def write_html_head(doc: yattag.doc.Doc, title: str) -> None:
    """Produces the <head> tag and its contents."""
    prefix = config.Config.get_uri_prefix()
    with doc.tag("head"):
        doc.stag("meta", charset="UTF-8")
        doc.stag("meta",
                 name="viewport",
                 content="width=device-width, initial-scale=1")
        with doc.tag("title"):
            doc.text(_("Where to map?") + title)
        doc.stag("link",
                 rel="icon",
                 type="image/vnd.microsoft.icon",
                 sizes="16x12",
                 href=prefix + "/favicon.ico")
        doc.stag("link",
                 rel="icon",
                 type="image/svg+xml",
                 sizes="any",
                 href=prefix + "/favicon.svg")

        css_path = os.path.join(config.Config.get_workdir(), "osm.min.css")
        with open(css_path, "r") as stream:
            with doc.tag("style"):
                doc.text(stream.read())

        with doc.tag("noscript"):
            with doc.tag("style", type="text/css"):
                doc.text(".no-js { display: block; }")
                doc.text(".js { display: none; }")

        with doc.tag("script", defer="", src=prefix + "/static/bundle.js"):
            pass