Browse Source

verify Fixed a bug with the '+' char.

Mike Smith 11 years ago
parent
commit
5cf0b94a86
1 changed files with 10 additions and 7 deletions
  1. 10 7
      toolset/benchmark/fortune_html_parser.py

+ 10 - 7
toolset/benchmark/fortune_html_parser.py

@@ -27,22 +27,25 @@ class FortuneHTMLParser(HTMLParser):
     # """ is a valid escaping, but we are normalizing
     # """ is a valid escaping, but we are normalizing
     # it so that our final parse can just be checked for
     # it so that our final parse can just be checked for
     # equality.
     # equality.
-    norm = name.replace("34", "quot")
+    if name == "34":
+      # Append our normalized entity reference to our body.
+      self.body.append(""")
     # Again, "+" is a valid escaping of the "+", but
     # Again, "+" is a valid escaping of the "+", but
     # it is not required, so we need to normalize for out
     # it is not required, so we need to normalize for out
     # final parse and equality check.
     # final parse and equality check.
-    norm = norm.replace("43", "+")
+    if name == "43":
+      self.body.append("+")
     # Again, ">" is a valid escaping of ">", but we
     # Again, ">" is a valid escaping of ">", but we
     # need to normalize to ">" for equality checking.
     # need to normalize to ">" for equality checking.
-    norm = norm.replace("62", "gt")
+    if name == "62":
+      self.body.append(">")
     # Again, "&#60;" is a valid escaping of "<", but we
     # Again, "&#60;" is a valid escaping of "<", but we
     # need to nromalize to "&lt;" for equality checking.
     # need to nromalize to "&lt;" for equality checking.
-    norm = norm.replace("60", "lt")
-    # Append our normalized entity reference to our body.
-    self.body.append("&{n};".format(n=norm))
+    if name == "60":
+      self.body.append("&lt;")
 
 
   def handle_entityref(self, name):
   def handle_entityref(self, name):
-    self.body.append("&{n};".format(n=norm))
+    self.body.append("&{n};".format(n=name))
 
 
   # This is called every time a tag is opened. We append
   # This is called every time a tag is opened. We append
   # each one wrapped in "<" and ">".
   # each one wrapped in "<" and ">".