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
0d19f1790f
commit
08b7624513
2 changed files with 12 additions and 10 deletions
|
@ -19,18 +19,20 @@ class Entry:
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
date_str = self.date.strftime(self.journal.config['timeformat'])
|
date_str = self.date.strftime(self.journal.config['timeformat'])
|
||||||
body_wrapper = "\n" if self.body else ""
|
|
||||||
if self.journal.config['linewrap']:
|
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:
|
else:
|
||||||
body = body_wrapper + self.body.strip()
|
title = date_str + " " + self.title
|
||||||
space = "\n"
|
seplen = len(title)
|
||||||
|
body = self.body.strip()
|
||||||
|
separator = "\n" #+ "-"*seplen + "\n"
|
||||||
|
|
||||||
return "{date} {title} {body} {space}".format(
|
return "{title}{sep}{body}\n".format(
|
||||||
date=date_str,
|
title=title,
|
||||||
title=self.title,
|
sep=separator if self.body else "",
|
||||||
body=body,
|
body=body
|
||||||
space=space
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Journal:
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Prettyprints the journal's entries"""
|
"""Prettyprints the journal's entries"""
|
||||||
sep = "-"*60+"\n"
|
sep = "\n"
|
||||||
pp = sep.join([str(e) for e in self.entries])
|
pp = sep.join([str(e) for e in self.entries])
|
||||||
if self.config['highlight']: # highlight tags
|
if self.config['highlight']: # highlight tags
|
||||||
if self.search_tags:
|
if self.search_tags:
|
||||||
|
|
Loading…
Add table
Reference in a new issue