From 6bef2a82e6155ed669e3b872335472f05bdc29e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 6 Feb 2022 20:38:51 +0100 Subject: [PATCH] make pytex file more flexible --- PyTeX/build/pytex_file/pytex_file.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/PyTeX/build/pytex_file/pytex_file.py b/PyTeX/build/pytex_file/pytex_file.py index 13af17e..01ac1d0 100644 --- a/PyTeX/build/pytex_file/pytex_file.py +++ b/PyTeX/build/pytex_file/pytex_file.py @@ -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(