Beispiel #1
0
def test_simple_doc_with_raw_texts():
    doc = Doc()
    with doc.tag("doc"):
        doc.cdata("the cdata string\nwith\nbroken\nlines")

        with doc.tag("body", id="the_id", klass="A"):
            doc.asis("<h2>\n  some <b>raw</b> html\n</h2>")
            doc.text("that's it")
    assert str(doc) == """\
Beispiel #2
0
def test_simple_doc():
    doc = Doc()
    doc.asis('<!doctype html>\n')
    with doc.tag("html"):
        doc.comment("HERE COMMES THE HEAD!")
        with doc.tag("head"):
            doc.line("style", '#that {\ncss: style;\ndefinition: 1px;\n}')

        doc.nl()
        doc.comment("HERE COMMES THE BODY!")
        with doc.tag("body", "optional", id="the_id", klass="A"):
            with doc.tag("p", klass="B"):
                doc.text("that text")
            with doc.tag("div", id="content"):
                with doc.tag("ul", ("id", "di"), klass="Cc",
                             style="the_style"):
                    doc.comment("AND THE LIST!")
                    for k in range(2):
                        doc.line("li", "that %s" % k, style="u")
                doc.text("that's it")

    assert str(doc) == """\