Add decoration to pretty printed author
This commit is contained in:
parent
fab58a9fc5
commit
2109c6535d
1 changed files with 13 additions and 2 deletions
|
@ -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")
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue