Esempio n. 1
0
def test_loadyaml_static():
    my_alert = ly("tests/assets/yaml_components/red_alert.yml", static=True)
    your_alert = e.div()(
        e.span("boolattr", style="background-color: red",
               class_="alert")("This is an Alert"),
        e.i(class_="horror")("{{!}}"),
    )
    assert my_alert == your_alert
Esempio n. 2
0
def badge(href: str, src: str, alt: str):
    return e.span()(e.a(href=href)(e.img(src=src, alt=alt)))
Esempio n. 3
0
def plugin(title: str, href: str, description: str):
    return e.ul()(e.li()(e.a(href=href)(e.b()(title)),
                         e.span()(f": {description}")))
Esempio n. 4
0
from htmldoom import base as b
from htmldoom import elements as e
from htmldoom import render as _render
from htmldoom import renders

from .layout import render_document


@renders(
    e.tr(class_="spacer", style="height:5px"),
    e.tr(class_="athing", id_="{id}")(
        e.td(align="right", valign="top",
             class_="title")(e.span(class_="rank")("{rank}.")),
        e.td(valign="top", class_="votelinks")(e.center()(
            e.a(id_="up_{id}",
                href="vote?id={id}&how=up&goto=news")(e.div(class_="votearrow",
                                                            title="upvote")))),
        e.td(class_="title")(
            e.a(href="{href}", class_="storylink")("{title}"),
            e.span(class_="sitebit comhead")(
                " (",
                e.a(href="from?site={from_url}")(
                    e.span(class_="sitestr")("{from_name}")),
                ")",
            ),
        ),
    ),
    e.tr()(
        e.td(colspan="2"),
        e.td(class_="subtext")(
            e.span(class_="score", id_="score_{id}")("{score} points"),
Esempio n. 5
0
     e.td(style="width:18px;padding-right:4px")(
         e.a(href="https://news.ycombinator.com")(e.img(
             src="y18.gif",
             width="18",
             height="18",
             style="border:1px white solid;",
         ))),
     e.td(style="line-height:12pt; height:10px;")(
         e.span(class_="pagetop")(
             e.b(class_="hnname")(e.a(href="news")("Hacker News ")),
             e.a(href="newest")("new"),
             " | ",
             e.a(href="front")("past"),
             " | ",
             e.a(href="newcomments")("comments"),
             " | ",
             e.a(href="ask")("ask"),
             " | ",
             e.a(href="show")("show"),
             " | ",
             e.a(href="jobs")("jobs"),
             " | ",
             e.a(href="submit")("submit"),
         )),
     e.td(style="text-align:right;padding-right:4px;")(e.span(
         class_="pagetop")(e.a(href="login?goto=news")("login"))),
 )))),
 e.tr("title", id_="pagespace", style="height:10px"),
 e.tr()(e.td()(e.table(
     border="0",
     cellpadding="0",
     cellspacing="0",
Esempio n. 6
0
 e.div(class_="container")(
     e.a(href="/", class_="navbar-brand")(e.img(
         src="https://niteo.co/static_niteo_co/images/logo.svg",
         width="120",
         height="30",
         alt="Niteo",
     )),
     e.button(
         class_="navbar-toggler",
         type_="button",
         data_toggle="collapse",
         data_target="#navbarResponsive",
         aria_controls="navbarSupportedContent",
         aria_expanded="false",
         aria_label="Toggle navigation",
     )(e.span(class_="navbar-toggler-icon")),
     e.div(class_="collapse navbar-collapse", id_="navbarResponsive")(
         e.ul(class_="navbar-nav ml-auto")(
             e.li(class_="nav-item")(e.a(class_="nav-link",
                                         href="/projects")("Projects")),
             e.li()(e.a(class_="nav-link", href="/about")("About")),
             e.li(class_="nav-item")(e.a(class_="nav-link",
                                         href="/team")("Team")),
             e.li(class_="nav-item")(e.a(class_="nav-link",
                                         href="/careers")("Careers")),
             e.li(class_="nav-item")(e.a(href="http://blog.niteo.co/",
                                         class_="nav-link")("Blog")),
             e.li(class_="nav-item")(e.a(class_="nav-link",
                                         href="/contact")("Contact")),
         )),
 )),
Esempio n. 7
0
         " rendering engines without explicitly making any optimisation.",
         e.br(),
         e.a(href="https://github.com/sayanarijit/htmldoom/blob/master/examples")(
             e.b()("Refer to the benchmarks here.")
         ),
     ),
 ),
 e.p()(
     e.h2()("Plugins and ecosystem"),
     e.p()(
         e.ul()(
             e.li()(
                 e.a(href="https://github.com/sayanarijit/moodlmth")(
                     e.b()("moodlmth")
                 ),
                 e.span()(": Convert raw HTML pages into python source code"),
             )
         ),
         e.ul()(
             e.li()(
                 e.a(href="https://github.com/sayanarijit/pyramid_htmldoom")(
                     e.b()("pyramid_htmldoom")
                 ),
                 e.span()(": htmldoom rendering library plugin for Pyramid"),
             )
         ),
     ),
 ),
 e.p()(
     e.h2()("Contributing"),
     e.p()(