Made line wrapping more clever about whitespace

This commit is contained in:
Philip Douglass 2015-08-28 12:08:25 -04:00
parent 15ef9749ae
commit 1ea5255aa0

View file

@ -48,11 +48,10 @@ class Entry:
if not short and self.journal.config['linewrap']:
title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap'])
body = "\n".join([
textwrap.fill((line + " ") if (len(line) == 0) else line,
textwrap.fill(line,
self.journal.config['linewrap'],
initial_indent="| ",
subsequent_indent="| ",
drop_whitespace=False)
subsequent_indent="| ") or "|"
for line in self.body.rstrip(" \n").splitlines()
])
else: