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: else:
return None return None
def format_tag(self, tag, text): def format_tag(self, tag, text, escape=True):
from xml.sax.saxutils import escape from xml.sax import saxutils
text = escape(text) if escape:
text = saxutils.escape(text)
if tag: if tag:
return '<{tag}>{text}</{tag}>'.format(tag=tag, text=text) return '<{tag}>{text}</{tag}>'.format(tag=tag, text=text)
else: else: