leforestier / yattag

Python library to generate HTML or XML in a readable, concise and pythonic way.
333 stars 31 forks source link

HTML tags in text #9

Closed JosefJezek closed 10 years ago

JosefJezek commented 10 years ago

How to disable translate > to >?

with tag('script', type="text/javascript", charset="utf8"):
text('''
$(this).html( '<input type="text" placeholder="Hledat '+title+'" />' );
''')

Output: $(this).html( '&lt;input type="text" placeholder="Hledat '+title+'" /&gt;' );

leforestier commented 10 years ago

I suggest you use the asis method instead of the text method. The asis method inserts content "as is". Of course, it's then your responsibility to make sure the content is safe to insert in the html document.

JosefJezek commented 10 years ago

Thank you! :+1: