mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 03:58:32 +02:00
Make indent character configurable.
Looks nice with │ (BOX DRAWINGS LIGHT VERTICAL) - Add indent_character to config settings - Use rpadded indent_character for textwrapping
This commit is contained in:
parent
a4783109b3
commit
91d48f85d0
2 changed files with 5 additions and 3 deletions
|
@ -74,15 +74,16 @@ class Entry:
|
||||||
"""Returns a pretty-printed version of the entry.
|
"""Returns a pretty-printed version of the entry.
|
||||||
If short is true, only print the title."""
|
If short is true, only print the title."""
|
||||||
date_str = self.date.strftime(self.journal.config['timeformat'])
|
date_str = self.date.strftime(self.journal.config['timeformat'])
|
||||||
|
indent = self.journal.config['indent_character'].rstrip() + " "
|
||||||
if not short and self.journal.config['linewrap']:
|
if not short and self.journal.config['linewrap']:
|
||||||
title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap'])
|
title = textwrap.fill(date_str + " " + self.title, self.journal.config['linewrap'])
|
||||||
body = "\n".join([
|
body = "\n".join([
|
||||||
textwrap.fill(
|
textwrap.fill(
|
||||||
line,
|
line,
|
||||||
self.journal.config['linewrap'],
|
self.journal.config['linewrap'],
|
||||||
initial_indent="| ",
|
initial_indent=indent,
|
||||||
subsequent_indent="| ",
|
subsequent_indent=indent,
|
||||||
drop_whitespace=True) or "| "
|
drop_whitespace=True) or indent
|
||||||
for line in self.body.rstrip(" \n").splitlines()
|
for line in self.body.rstrip(" \n").splitlines()
|
||||||
])
|
])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -26,6 +26,7 @@ class Journal(object):
|
||||||
'tagsymbols': '@',
|
'tagsymbols': '@',
|
||||||
'highlight': True,
|
'highlight': True,
|
||||||
'linewrap': 80,
|
'linewrap': 80,
|
||||||
|
'indent_character': '|',
|
||||||
}
|
}
|
||||||
self.config.update(kwargs)
|
self.config.update(kwargs)
|
||||||
# Set up date parser
|
# Set up date parser
|
||||||
|
|
Loading…
Add table
Reference in a new issue