refactor: Extract templating to model module
This commit is contained in:
parent
e56f014136
commit
5450776eb2
4 changed files with 20 additions and 15 deletions
|
@ -8,7 +8,8 @@ import papis.strings
|
|||
from papis.document import Document
|
||||
|
||||
from papis_extract import extractor, exporter
|
||||
from papis_extract.annotation_data import AnnotatedDocument, Markdown
|
||||
from papis_extract.annotation_data import AnnotatedDocument
|
||||
from papis_extract.model.templating import Markdown
|
||||
|
||||
logger = papis.logging.get_logger(__name__)
|
||||
|
||||
|
|
|
@ -85,16 +85,3 @@ class AnnotatedDocument:
|
|||
document: Document
|
||||
annotations: list[Annotation]
|
||||
|
||||
|
||||
@dataclass
|
||||
class Templating(Protocol):
|
||||
string: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Markdown:
|
||||
string: str = (
|
||||
"{{#tag}}#{{tag}}\n{{/tag}}"
|
||||
"{{#quote}}> {{quote}}{{/quote}} {{#page}}[p. {{page}}]{{/page}}\n"
|
||||
"{{#note}} NOTE: {{note}}{{/note}}"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,8 @@ import papis.git
|
|||
import papis.config
|
||||
import Levenshtein
|
||||
|
||||
from papis_extract.annotation_data import AnnotatedDocument, Annotation, Templating
|
||||
from papis_extract.annotation_data import AnnotatedDocument
|
||||
from papis_extract.model.templating import Templating
|
||||
|
||||
logger = papis.logging.get_logger(__name__)
|
||||
|
||||
|
|
16
papis_extract/model/templating.py
Normal file
16
papis_extract/model/templating.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import Protocol
|
||||
|
||||
|
||||
@dataclass
|
||||
class Templating(Protocol):
|
||||
string: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class Markdown:
|
||||
string: str = (
|
||||
"{{#tag}}#{{tag}}\n{{/tag}}"
|
||||
"{{#quote}}> {{quote}}{{/quote}} {{#page}}[p. {{page}}]{{/page}}\n"
|
||||
"{{#note}} NOTE: {{note}}{{/note}}"
|
||||
)
|
Loading…
Reference in a new issue