From 23609c117584d0d27979d05e481fca41d2806f98 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 19 Apr 2012 05:59:27 +0900 Subject: [PATCH] Revert "escape HTML in type in the answer" This reverts commit 8dbfd676ef2c4dc35ee16d363e51fe0324276da4. --- aqt/reviewer.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/aqt/reviewer.py b/aqt/reviewer.py index c1b560911..d30968249 100644 --- a/aqt/reviewer.py +++ b/aqt/reviewer.py @@ -2,7 +2,7 @@ # Copyright: Damien Elmes # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html -import time, os, stat, shutil, difflib, simplejson, re, cgi +import time, os, stat, shutil, difflib, simplejson, re import unicodedata as ucd from aqt.qt import * from anki.utils import fmtTimeSpan, stripHTML, isMac @@ -359,12 +359,11 @@ img { max-width: 95%; max-height: 95%; } "Calculates answer fragment depending on testChar's unicode category" ZERO_SIZE = 'Mn' def head(a): - return cgi.escape(a[:len(a) - 1]) + return a[:len(a) - 1] def tail(a): - return cgi.escape(a[len(a) - 1:]) + return a[len(a) - 1:] if ucd.category(testChar) == ZERO_SIZE: - return self.ok(head(correct)) + self.bad( - tail(correct) + cgi.escape(wrong)) + return self.ok(head(correct)) + self.bad(tail(correct) + wrong) return self.ok(correct) + self.bad(wrong) def correct(self, a, b): @@ -377,7 +376,7 @@ img { max-width: 95%; max-height: 95%; } s = difflib.SequenceMatcher(None, b, a) for tag, i1, i2, j1, j2 in s.get_opcodes(): if tag == "equal": - lastEqual = cgi.escape(b[i1:i2]) + lastEqual = b[i1:i2] elif tag == "replace": ret += self.applyStyle(b[i1], lastEqual, b[i1:i2] + ("-" * ((j2 - j1) - (i2 - i1))))