common/tags.py
author sylvain.thenault@logilab.fr
Thu, 19 Feb 2009 18:54:26 +0100
branchtls-sprint
changeset 846 e449f1da7d09
parent 845 6103d0f55a0b
child 861 7985b5db2284
permissions -rw-r--r--
new label tag
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
845
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     1
from logilab.mtconverter import html_escape
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     2
from cubicweb.common.uilib import simple_sgml_tag
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     3
class tag(object):
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     4
    def __init__(self, name):
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     5
        self.name = name
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     6
        
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     7
    def __call__(self, __content=None, **attrs):
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     8
        return simple_sgml_tag(self.name, __content, **attrs)
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
     9
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
    10
input = tag('input')
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
    11
textarea = tag('textarea')
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
    12
a = tag('a')
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
    13
span = tag('span')
6103d0f55a0b simple tags
sylvain.thenault@logilab.fr
parents:
diff changeset
    14
img = tag('img')
846
e449f1da7d09 new label tag
sylvain.thenault@logilab.fr
parents: 845
diff changeset
    15
label = tag('label')