示例#1
0
def test_OneLine_Header():
    e = hr.Header(3, "this")
    f = StringIO()
    e.render(f)
    f.seek(0)
    text = f.read().strip()
    assert text.startswith("<h3>")
    assert text.endswith("</h3>")
    assert "this" in text
示例#2
0
render_page(page, "test_html_output6.html")

# # Step 7
# #########

page = hr.Html()

head = hr.Head()
head.append(hr.Title("PythonClass = Revision 1087:"))

page.append(head)

body = hr.Body()

body.append(hr.Header(2, "PythonClass - Class 6 example"))

body.append(
    hr.P(
        "Here is a paragraph of text -- there could be more of them, "
        "but this is enough  to show that we can do some text",
        style="text-align: center; font-style: oblique;"))

body.append(hr.Hr())

list = hr.Ul(id="TheList", style="line-height:200%")

list.append(hr.Li("The first item in a list"))
list.append(hr.Li("This is the second item", style="color: red"))

item = hr.Li()
body.append(
    hr.
    P("And here is another piece of text -- you should be able to add any number"
      ))

page.append(body)

render_page(page, "test_html_output2.html")

# # Step 3
# ##########

page = hr.Html()

head = hr.Header()
head.append(hr.Title("PythonClass = Revision 1087:"))

page.append(head)

body = hr.Body()

body.append(
    hr.P("Here is a paragraph of text -- there could be more of them, "
         "but this is enough  to show that we can do some text"))
body.append(
    hr.
    P("And here is another piece of text -- you should be able to add any number"
      ))

page.append(body)