soup2html() tweak to better avoid indentation at paragraph start.

- Legacy-Id: 329
This commit is contained in:
Henrik Levkowetz 2007-06-12 00:55:41 +00:00
parent 67eb998901
commit 541b041cdc

View file

@ -43,7 +43,7 @@ def para(words, pre):
text = "".join(words)
text = unescape(text)
if not pre:
text = re.sub("[\r\n\t ]+", " ", text)
text = re.sub("[\r\n\t ]+", " ", text.strip())
text = textwrap.fill(text)
return text
@ -99,7 +99,7 @@ class TextSoup(BeautifulSoup):
node = render(self, encoding)
str = node.text
str = re.sub("[ \t]+", " ", str)
str = re.sub("\n\n+ *", "\n\n", str)
str = re.sub("\n\n+", "\n\n", str)
return str
def soup2text(html):