Пример #1
0
                        )(e.i(class_="fa fa-facebook-f")),
                        e.a(
                            class_="ml-1",
                            href="https://twitter.com/teamniteo",
                            target="_blank",
                        )(e.i(class_="fa fa-twitter")),
                    ),
                ),
            ),
        ),
        e.div(
            class_="row h-100 justify-content-center align-items-center mt-4")(
                e.p()(e.small()("© 2007 - 2019 Niteo "))),
    )),
    b.comment(" END FOOTER "),
    e.script(src="https://niteo.co/static_niteo_co/main.js"),
    b.comment(" Fanstatic body css/js here "),
    e.script()(b"""
        var loadJS = function (url, implementationCode) {
          // url: URL of external file,
          // implementationCode: code to be called after script is loaded,

          var scriptTag = document.createElement('script');
          scriptTag.src = url;

          scriptTag.onload = implementationCode;
          scriptTag.onreadystatechange = implementationCode;

          document.body.appendChild(scriptTag);
        };
Пример #2
0
                        e.a(href="http://www.ycombinator.com/apply/")(
                            "Apply to YC"),
                        " | ",
                        e.a(href="mailto:[email protected]")("Contact"),
                    ),
                    e.br(),
                    e.br(),
                    e.form(action="//hn.algolia.com/", method="get")(
                        "Search: ",
                        e.input_(
                            "value",
                            type_="text",
                            name="q",
                            size="17",
                            autocorrect="off",
                            spellcheck="false",
                            autocapitalize="off",
                            autocomplete="false",
                        ),
                    ),
                ),
            )),
        ))),
        e.script(type_="text/javascript", src="hn.js?9UnLxU8WHV0ou3hRwndX"),
    ))
def render_document(data, news_renderer):
    return {
        "newslist":
        (news_renderer(rank=k + 1, news=v) for k, v in data["news"].items())
    }
Пример #3
0
        "https://niteo.co/static_niteo_co/images/favicon/safari-pinned-tab.svg",
        color="#5bbad5",
    ),
    e.link(
        rel="shortcut icon",
        href="https://niteo.co/static_niteo_co/images/favicon/favicon.ico",
    ),
    e.meta(name="msapplication-TileColor", content="#00aba9"),
    e.meta(
        name="msapplication-config",
        content=
        "https://niteo.co/static_niteo_co/images/favicon/browserconfig.xml",
    ),
    e.meta(name="theme-color", content="#ffffff"),
    e.link(href="https://niteo.co/static_niteo_co/main.css", rel="stylesheet"),
    e.script(crossorigin="anonymous",
             src="/fanstatic/minisites/jquery-2.2.4.min.js"),
))
def render_head(data: dict, title_renderer: callable = render_title) -> dict:
    return {"title": title_renderer(data=data)}


@renders(e.body()("{contents}"))
def render_body(data) -> None:
    raise NotImplementedError("You are trying to render a base layout.")


@renders(e.html(lang="en", prefix="og: http://ogp.me/ns#")("{head}", "{body}"))
def render_html(
    data: dict,
    title_renderer: callable = render_title,
    head_renderer: callable = render_head,