Merge pull request #80 from rubyu/fix-text-exporter

Fixes an issue fields are not being escaped in doExport().
This commit is contained in:
Damien Elmes 2014-05-22 12:48:41 +09:00
commit d25052a56f

View file

@ -20,10 +20,12 @@ class Exporter(object):
file.close() file.close()
def escapeText(self, text): def escapeText(self, text):
"Escape newlines, tabs and CSS." "Escape newlines, tabs, CSS and quotechar."
text = text.replace("\n", "<br>") text = text.replace("\n", "<br>")
text = text.replace("\t", " " * 8) text = text.replace("\t", " " * 8)
text = re.sub("(?i)<style>.*?</style>", "", text) text = re.sub("(?i)<style>.*?</style>", "", text)
if "\"" in text:
text = "\"" + text.replace("\"", "\"\"") + "\""
return text return text
def cardIds(self): def cardIds(self):