コード例 #1
0
ファイル: test_htmlgen.py プロジェクト: terrasea/formencode
def test_basic():
    output = '<a href="test">hey there</a>'
    assert str(html.a(href='test')('hey there')) == output
    assert str(html.a('hey there')(href='test')) == output
    assert str(html.a(href='test', c='hey there')) == output
    assert str(html.a('hey there', href='test')) == output
    assert str(html.a(href='test')('hey ', 'there')) == output
    assert str(html.a(href='test')(['hey ', 'there'])) == output
コード例 #2
0
def test_basic():
    output = '<a href="test">hey there</a>'
    assert str(html.a(href='test')('hey there')) == output
    assert str(html.a('hey there')(href='test')) == output
    assert str(html.a(href='test', c='hey there')) == output
    assert str(html.a('hey there', href='test')) == output
    assert str(html.a(href='test')('hey ', 'there')) == output
    assert str(html.a(href='test')(['hey ', 'there'])) == output
コード例 #3
0
ファイル: test_htmlgen.py プロジェクト: avanov/formencode
def test_basic():
    output = '<a href="test">hey there</a>'
    assert str(html.a(href="test")("hey there")) == output
    assert str(html.a("hey there")(href="test")) == output
    assert str(html.a(href="test", c="hey there")) == output
    assert str(html.a("hey there", href="test")) == output
    assert str(html.a(href="test")("hey ", "there")) == output
    assert str(html.a(href="test")(["hey ", "there"])) == output
コード例 #4
0
ファイル: menus.py プロジェクト: umeboshi2/trumpet.history
    def __init__(self, header='BaseMenu', **args):
        super(BaseMenu, self).__init__(**args)
        super(BaseMenu, self).set('class', 'ctx-menu nav navbar-nav')
        self._menu = {}

        # setup dropdown menu and header anchor
        self.dropdown = html.li()
        self.dropdown.set('class', 'dropdown')
        self.header_anchor = html.a(header, class_='dropdown-toggle')
        self.header_anchor.set('data-toggle', 'dropdown')
        # we append a caret to the end of the header
        # to demonstrate that this is a dropdown menu
        caret = html.b(' ', class_="caret")
        # append the objects
        self.header_anchor.append(caret)
        self.append(self.dropdown)
        self.dropdown.append(self.header_anchor)
        # create and append the menu container
        self.menu_list = UL()
        self.menu_list.set('class', 'dropdown-menu')
        self.dropdown.append(self.menu_list)
コード例 #5
0
ファイル: menus.py プロジェクト: umeboshi2/trumpet.history
 def append_new_entry(self, name, page):
     self._menu[name] = html.a(name, href=page)
     li = html.li(self._menu[name])
     self.menu_list.append(li)