Hello,

I'd like to know if there is a basic HTML wrapper for Python, like
TextWrapper but allowing the generation of HTML from strings or iterables
of strings. Like:

make_select = HTMLWrapper(tag='select class="eggs"', indent='  ')
make_option = HTMLWrapper(tag='option')

Applying this like:

s = make_select([make_option('Option %d' % (i + 1), \
    escape=False, strip=False) for i in range(3)])

should return s like (when printed):

<select class="eggs">
  <option>Option 1</option>
  <option>Option 2</option>
  <option>Option 3</option>
</select>

Vlad Tudorache
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to