feat: Change count display to lead with count

The actual count is now the first item on each line,
to make it easier to sort, strip, delete and compare
afterwards.
This commit is contained in:
Marty Oehme 2024-06-12 11:06:27 +02:00
parent d087c366c3
commit b5c081fbf3
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A
2 changed files with 4 additions and 4 deletions

View file

@ -66,10 +66,10 @@ def format_count(
count += 1
return (
f"{count} "
f"{document.get('author', '')}"
f"{' - ' if 'author' in document else ''}" # only put separator if author
f"{document.get('title', '')}: "
f"{count}\n"
f"{': ' if 'author' in document else ''}" # only put separator if author
f"{document.get('title', '')}"
).rstrip()

View file

@ -48,7 +48,7 @@ def test_markdown_setext():
def test_count_default():
fmt = format_count
assert fmt(document, annotations) == ("""document-author - document-title: 2""")
assert fmt(document, annotations) == ("""2 document-author: document-title""")
def test_csv_default():