mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
New style display of posts
This commit is contained in:
parent
11a73b4fc2
commit
d5b6d559c3
2 changed files with 12 additions and 10 deletions
|
@ -19,18 +19,20 @@ class Entry:
|
|||
|
||||
def __str__(self):
|
||||
date_str = self.date.strftime(self.journal.config['timeformat'])
|
||||
body_wrapper = "\n" if self.body else ""
|
||||
if self.journal.config['linewrap']:
|
||||
body = body_wrapper + textwrap.fill(self.body, self.journal.config['linewrap'])
|
||||
title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap'])
|
||||
seplen = len(title.splitlines()[-1])
|
||||
body = textwrap.fill(self.body, self.journal.config['linewrap'], initial_indent="| ", subsequent_indent="| ")
|
||||
else:
|
||||
body = body_wrapper + self.body.strip()
|
||||
space = "\n"
|
||||
title = date_str + " " + self.title
|
||||
seplen = len(title)
|
||||
body = self.body.strip()
|
||||
separator = "\n" #+ "-"*seplen + "\n"
|
||||
|
||||
return "{date} {title} {body} {space}".format(
|
||||
date=date_str,
|
||||
title=self.title,
|
||||
body=body,
|
||||
space=space
|
||||
return "{title}{sep}{body}\n".format(
|
||||
title=title,
|
||||
sep=separator if self.body else "",
|
||||
body=body
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
|
|
|
@ -134,7 +134,7 @@ class Journal:
|
|||
|
||||
def __str__(self):
|
||||
"""Prettyprints the journal's entries"""
|
||||
sep = "-"*60+"\n"
|
||||
sep = "\n"
|
||||
pp = sep.join([str(e) for e in self.entries])
|
||||
if self.config['highlight']: # highlight tags
|
||||
if self.search_tags:
|
||||
|
|
Loading…
Add table
Reference in a new issue