예제 #1
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))
예제 #2
0
def write_html_header(doc: yattag.doc.Doc) -> None:
    """Produces the verify first line of a HTML output."""
    doc.asis("<!DOCTYPE html>\n")