make pytex file more flexible

This commit is contained in:
Maximilian Keßler 2022-02-06 20:38:51 +01:00
parent 4928694212
commit 6bef2a82e6

View file

@ -3,12 +3,18 @@ from pathlib import Path
from .enums import PyTeXFileType
from PyTeX.format.formatterif import FormatterIF
from PyTeX.build.paths import RelativePath
from ...format.enums import TeXType
class PyTeXSourceFile:
def __init__(self):
self._pytex_file_type: PyTeXFileType = None
def __init__(
self,
relative_path: RelativePath,
formatter: Optional[FormatterIF] = None,
pytex_file_type: Optional[PyTeXFileType] = None
):
self._relative_path: RelativePath = None
self._pytex_file_type: PyTeXFileType = None
self._formatter: FormatterIF = None
@property
@ -28,6 +34,14 @@ class PyTeXSourceFile:
]
return files
@property
def formatter(self) -> FormatterIF:
return self._formatter
@formatter.setter
def formatter(self, formatter):
self._formatter = formatter
def format(self, target_root: Union[Path, RelativePath]) -> Optional[List[Tuple[RelativePath, Dict]]]:
try:
configs = self._formatter.format(