Add escape argument to OutoutFormat.format_tag().

This commit is contained in:
Andrey Golovizin 2014-09-11 10:54:25 +02:00
parent 4dd082dffd
commit 8e4eb7d152

View file

@ -85,9 +85,10 @@ class HTMLFormat(OutputFormat):
else:
return None
def format_tag(self, tag, text):
from xml.sax.saxutils import escape
text = escape(text)
def format_tag(self, tag, text, escape=True):
from xml.sax import saxutils
if escape:
text = saxutils.escape(text)
if tag:
return '<{tag}>{text}</{tag}>'.format(tag=tag, text=text)
else: