From 236651561cb716dccaa50d444922d02777e0f766 Mon Sep 17 00:00:00 2001 From: ryanss Date: Fri, 9 Jan 2015 23:59:00 -0500 Subject: Start each comment paragraph on a new line --- plugin/hackernews.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'plugin') diff --git a/plugin/hackernews.py b/plugin/hackernews.py index dad0853..e3a85fe 100644 --- a/plugin/hackernews.py +++ b/plugin/hackernews.py @@ -55,11 +55,12 @@ def print_comments(comments, b): for comment in comments: level = comment['level'] b.append("%sComment by %s %s:" % ("\t"*level, comment.get('user','???'), comment['time_ago'])) - contents = textwrap.wrap(html.unescape(re.sub('<[^<]+?>', '', comment['content'])), - width=80, - initial_indent=" "*4*level, - subsequent_indent=" "*4*level) - for line in contents: - b.append(line) + for p in comment['content'].split("

"): + contents = textwrap.wrap(html.unescape(re.sub('<[^<]+?>', '', p)), + width=80, + initial_indent=" "*4*level, + subsequent_indent=" "*4*level) + for line in contents: + b.append(line) b.append("") print_comments(comment['comments'], b) -- cgit v1.2.3