elif self.inpre:
self.text = self.text + unicode(data, "utf-8")
else:
- isallwhitespace = data.strip()
- if isallwhitespace != "" and self.text[-1] == "\n":
- self.text = self.text + unicode(data, "utf-8").strip() + u' '
+ isallwhitespace = data.strip() == ""
+ if not isallwhitespace:
+ self.text = self.text + unicode(data, "utf-8").strip() + u' '
def handle_entityref(self, name):
entity = name