mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-18 12:08:31 +02:00
Pretty print titles as bold.
This commit is contained in:
parent
8615679beb
commit
af3e054b33
2 changed files with 7 additions and 2 deletions
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
||||||
import re
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from .util import split_title
|
from .util import split_title, bold
|
||||||
|
|
||||||
|
|
||||||
class Entry:
|
class Entry:
|
||||||
|
@ -100,7 +100,7 @@ class Entry:
|
||||||
return title
|
return title
|
||||||
else:
|
else:
|
||||||
return "{title}{sep}{body}\n".format(
|
return "{title}{sep}{body}\n".format(
|
||||||
title=title,
|
title=bold(title),
|
||||||
sep="\n" if has_body else "",
|
sep="\n" if has_body else "",
|
||||||
body=body if has_body else "",
|
body=body if has_body else "",
|
||||||
)
|
)
|
||||||
|
|
|
@ -178,6 +178,11 @@ def colorize(string):
|
||||||
return u"\033[36m{}\033[39m".format(string)
|
return u"\033[36m{}\033[39m".format(string)
|
||||||
|
|
||||||
|
|
||||||
|
def bold(string):
|
||||||
|
"""Returns the string wrapped in bold ANSI escape"""
|
||||||
|
return u"\033[1m{}\033[0m".format(string)
|
||||||
|
|
||||||
|
|
||||||
def slugify(string):
|
def slugify(string):
|
||||||
"""Slugifies a string.
|
"""Slugifies a string.
|
||||||
Based on public domain code from https://github.com/zacharyvoase/slugify
|
Based on public domain code from https://github.com/zacharyvoase/slugify
|
||||||
|
|
Loading…
Add table
Reference in a new issue