summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorryanss2015-01-09 23:59:00 -0500
committerryanss2015-01-09 23:59:00 -0500
commit236651561cb716dccaa50d444922d02777e0f766 (patch)
tree438e977c65acdc0c1b9e2d6256a4756c7d47d1ac /plugin
parent13ec2a26c2027a3472558fe073411ac47a3a10d5 (diff)
downloadvim-hn-236651561cb716dccaa50d444922d02777e0f766.tar.gz
Start each comment paragraph on a new line
Diffstat (limited to 'plugin')
-rw-r--r--plugin/hackernews.py13
1 files changed, 7 insertions, 6 deletions
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("<p>"):
+ 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)