From 8e4eb7d15256480d1f8f94b4a2b3b3b33e85556f Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Thu, 11 Sep 2014 10:54:25 +0200 Subject: [PATCH] Add escape argument to OutoutFormat.format_tag(). --- pixelocr/formatting.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pixelocr/formatting.py b/pixelocr/formatting.py index b3388d6..8c4c36e 100644 --- a/pixelocr/formatting.py +++ b/pixelocr/formatting.py @@ -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}'.format(tag=tag, text=text) else: