Browse Source

verify Whitespace between tags is considered data

and therefore needs to be stripped.
Mike Smith 11 years ago
parent
commit
e0a7e23fa2
1 changed files with 2 additions and 1 deletions
  1. 2 1
      toolset/benchmark/fortune_html_parser.py

+ 2 - 1
toolset/benchmark/fortune_html_parser.py

@@ -69,7 +69,8 @@ class FortuneHTMLParser(HTMLParser):
   # the contents inside of "<td>" and "</td>", but there
   # the contents inside of "<td>" and "</td>", but there
   # are also the "<title>" and "</title>" tags.
   # are also the "<title>" and "</title>" tags.
   def handle_data (self, data):
   def handle_data (self, data):
-    self.body.append("{d}".format(d=data))
+    if data.strip() != '':
+      self.body.append("{d}".format(d=data))
 
 
   # This is called every time a tag is closed. We append
   # This is called every time a tag is closed. We append
   # each one wrapped in "</" and ">".
   # each one wrapped in "</" and ">".