Add escape argument to OutoutFormat.format_tag().
This commit is contained in:
parent
4dd082dffd
commit
8e4eb7d152
1 changed files with 4 additions and 3 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue