Add decoration to pretty printed author

This commit is contained in:
Marty Oehme 2023-08-28 17:04:15 +02:00
parent fab58a9fc5
commit 2109c6535d
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -18,6 +18,12 @@ def _format_annotation(annotation: Annotation) -> str:
def to_stdout(annots: list[AnnotatedDocument]) -> None: def to_stdout(annots: list[AnnotatedDocument]) -> None:
"""Pretty print annotations to stdout.
Gives a nice human-readable representations of
the annotations in somewhat of a list form.
Not intended for machine-readability.
"""
if not annots: if not annots:
return return
@ -25,12 +31,17 @@ def to_stdout(annots: list[AnnotatedDocument]) -> None:
if not entry.annotations: if not entry.annotations:
continue continue
title_decoration = "=" * len(entry.document.get("title", "")) title_decoration = (
f"{'=' * len(entry.document.get('title', ''))} "
f"{'-' * len(entry.document.get('author', ''))}"
)
print( print(
f"{title_decoration}\n{papis.document.describe(entry.document)}\n{title_decoration}\n" f"{title_decoration}\n{papis.document.describe(entry.document)}\n{title_decoration}\n"
) )
for a in entry.annotations: for a in entry.annotations:
print(_format_annotation(a)) print(_format_annotation(a))
if entry != annots[-1]:
print("\n") print("\n")