All pastes #436472 Raw Edit

Something

public text v1 · immutable
·published 2007-04-12 15:11 UTC
rendered paste body
from cStringIO import StringIO

def HTMLmarkup(tag, text, **attributes):
    """
    markups the text with the tag and
    attributes
    """

    s = StringIO()
    s.write('<%s' % tag)
    for attribute, value in attributes.items():
        s.write(' %s="%s"' % (attribute, value))

    s.write('>%s</%s>' % (text, tag))
    return s.getvalue()

tags = [ 'b', 'body', 'html' ]

for i in tags:
    globals()[i] = lambda x, i=i, **y: HTMLmarkup(i, x, **y)