refactor: Move templating to separate file
This commit is contained in:
parent
e633c0335e
commit
4eb983d9e3
7 changed files with 97 additions and 41 deletions
|
|
@ -1,14 +1,49 @@
|
|||
import chevron
|
||||
|
||||
from papis_extract.annotation_data import Markdown
|
||||
from papis_extract.templating import Markdown, Csv
|
||||
|
||||
|
||||
def test_template_markers():
|
||||
...
|
||||
|
||||
|
||||
def test_markdown_default():
|
||||
fmt = Markdown()
|
||||
assert chevron.render(fmt.string, {
|
||||
"file": "somefile/somewhere.pdf",
|
||||
"quote": "I am quote",
|
||||
"note": "and including note.",
|
||||
"page": 46,
|
||||
"tag": "important",
|
||||
"type": "highlight",
|
||||
}) == "#important\n> I am quote [p. 46]\n NOTE: and including note."
|
||||
assert (
|
||||
chevron.render(
|
||||
fmt.string,
|
||||
{
|
||||
"file": "somefile/somewhere.pdf",
|
||||
"quote": "I am quote",
|
||||
"note": "and including note.",
|
||||
"page": 46,
|
||||
"tag": "important",
|
||||
"type": "highlight",
|
||||
},
|
||||
)
|
||||
== "#important\n> I am quote [p. 46]\n NOTE: and including note."
|
||||
)
|
||||
|
||||
|
||||
def test_csv_string():
|
||||
fmt = Csv()
|
||||
assert (
|
||||
chevron.render(
|
||||
fmt.string,
|
||||
{
|
||||
"file": "somefile/somewhere.pdf",
|
||||
"quote": "I am quote",
|
||||
"note": "and including note.",
|
||||
"page": 46,
|
||||
"tag": "important",
|
||||
"type": "highlight",
|
||||
},
|
||||
)
|
||||
== "highlight, important, 46, "
|
||||
"I am quote, and including note., somefile/somewhere.pdf"
|
||||
)
|
||||
|
||||
|
||||
def test_csv_header():
|
||||
fmt = Csv()
|
||||
assert chevron.render(fmt.header, {}) == "type, tag, page, quote, note, file"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue