chore: Refactor markdown format string handling
This commit is contained in:
parent
c21ab4a76c
commit
d087c366c3
2 changed files with 5 additions and 6 deletions
|
@ -88,10 +88,11 @@ def main(
|
||||||
git: bool,
|
git: bool,
|
||||||
force: bool,
|
force: bool,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Extract annotations from any pdf document.
|
"""Extract annotations from any documents.
|
||||||
|
|
||||||
The extract plugin allows manual or automatic extraction of all annotations
|
The extract plugin allows manual or automatic extraction of all annotations
|
||||||
contained in the pdf documents belonging to entries of the papis library.
|
contained in the documents belonging to entries of the papis library,
|
||||||
|
primarily targeting PDF documents currently.
|
||||||
It can write those changes to stdout or directly create and update notes
|
It can write those changes to stdout or directly create and update notes
|
||||||
for papis documents.
|
for papis documents.
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,13 @@ def format_markdown(
|
||||||
|
|
||||||
heading = f"{document.get('title', '')} - {document.get('author', '')}"
|
heading = f"{document.get('title', '')} - {document.get('author', '')}"
|
||||||
if headings == "atx":
|
if headings == "atx":
|
||||||
output = f"# {heading}\n\n"
|
output += f"# {heading}\n\n"
|
||||||
elif headings == "setext":
|
elif headings == "setext":
|
||||||
title_decoration = (
|
title_decoration = (
|
||||||
f"{'=' * len(document.get('title', ''))} "
|
f"{'=' * len(document.get('title', ''))} "
|
||||||
f"{'-' * len(document.get('author', ''))}"
|
f"{'-' * len(document.get('author', ''))}"
|
||||||
)
|
)
|
||||||
output = f"{title_decoration}\n{heading}\n{title_decoration}\n\n"
|
output += f"{title_decoration}\n{heading}\n{title_decoration}\n\n"
|
||||||
else:
|
|
||||||
output = ""
|
|
||||||
|
|
||||||
for a in annotations:
|
for a in annotations:
|
||||||
output += a.format(template)
|
output += a.format(template)
|
||||||
|
|
Loading…
Reference in a new issue