commit 6af05bc818bec43c8bcb3883bee1dfc1079c4bdb
parent c71fa184c85b9dd7d425a43eaee29841eec78f8e
Author: luke8086 <55237178+luke8086@users.noreply.github.com>
Date: Mon, 25 Jul 2022 22:50:25 +0000
Ignore newlines when parsing HTML
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/retronews.py b/retronews.py
@@ -159,7 +159,7 @@ class HTMLParser(html.parser.HTMLParser):
def handle_data(self, data):
if self.current_link is None or self.current_link == data:
# Data is not a link or it's identical to the link
- self.text += data
+ self.text += data.replace("\n", " ")
elif data.endswith("...") and self.current_link.startswith(data[:-3]):
# Replace HN-shortened URL with the full one
self.text += self.current_link