Compare commits
1 commit
5a99665d7e
...
984025b472
Author | SHA1 | Date | |
---|---|---|---|
984025b472 |
3 changed files with 9 additions and 10 deletions
|
@ -8,7 +8,10 @@ import papis.strings
|
|||
from papis.document import Document
|
||||
|
||||
from papis_extract import extractor, exporter
|
||||
from papis_extract.formatter import Formatter, formatters
|
||||
from papis_extract.formatter import (
|
||||
Formatter,
|
||||
formatters
|
||||
)
|
||||
|
||||
logger = papis.logging.get_logger(__name__)
|
||||
|
||||
|
@ -65,7 +68,6 @@ def main(
|
|||
write: bool,
|
||||
template: str,
|
||||
git: bool,
|
||||
force: bool,
|
||||
) -> None:
|
||||
"""Extract annotations from any pdf document.
|
||||
|
||||
|
@ -87,7 +89,7 @@ def main(
|
|||
|
||||
formatter = formatters[template]
|
||||
|
||||
run(documents, edit=manual, write=write, git=git, formatter=formatter, force=force)
|
||||
run(documents, edit=manual, write=write, git=git, formatter=formatter)
|
||||
|
||||
|
||||
def run(
|
||||
|
@ -96,12 +98,11 @@ def run(
|
|||
edit: bool = False,
|
||||
write: bool = False,
|
||||
git: bool = False,
|
||||
force: bool = False,
|
||||
) -> None:
|
||||
annotated_docs = extractor.start(documents)
|
||||
if write:
|
||||
exporter.to_notes(
|
||||
formatter=formatter, annotated_docs=annotated_docs, edit=edit, git=git, force=force
|
||||
formatter=formatter, annotated_docs=annotated_docs, edit=edit, git=git
|
||||
)
|
||||
else:
|
||||
exporter.to_stdout(formatter=formatter, annotated_docs=annotated_docs)
|
||||
|
|
|
@ -26,14 +26,13 @@ def test_formatting_replacements(fmt_string, expected):
|
|||
|
||||
assert sut.format(fmt_string) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"fmt_string,expected",
|
||||
[
|
||||
("{{doc.title}}", "document-title"),
|
||||
("{{doc.title}}-{{doc.author}}", "document-title-document-author"),
|
||||
("{{quote}} ({{doc.author}})", "I am the text value (document-author)"),
|
||||
],
|
||||
]
|
||||
)
|
||||
def test_formatting_document_access(fmt_string, expected):
|
||||
sut = Annotation(
|
||||
|
@ -45,7 +44,6 @@ def test_formatting_document_access(fmt_string, expected):
|
|||
|
||||
assert sut.format(fmt_string, doc=doc) == expected
|
||||
|
||||
|
||||
def test_colorname_matches_exact():
|
||||
sut = Annotation("testfile", colors=(1.0, 0.0, 0.0), minimum_similarity_color=1.0)
|
||||
c_name = sut.colorname
|
||||
|
|
Loading…
Reference in a new issue