make pytex file more flexible
This commit is contained in:
parent
4928694212
commit
6bef2a82e6
1 changed files with 16 additions and 2 deletions
|
@ -3,12 +3,18 @@ from pathlib import Path
|
||||||
from .enums import PyTeXFileType
|
from .enums import PyTeXFileType
|
||||||
from PyTeX.format.formatterif import FormatterIF
|
from PyTeX.format.formatterif import FormatterIF
|
||||||
from PyTeX.build.paths import RelativePath
|
from PyTeX.build.paths import RelativePath
|
||||||
|
from ...format.enums import TeXType
|
||||||
|
|
||||||
|
|
||||||
class PyTeXSourceFile:
|
class PyTeXSourceFile:
|
||||||
def __init__(self):
|
def __init__(
|
||||||
self._pytex_file_type: PyTeXFileType = None
|
self,
|
||||||
|
relative_path: RelativePath,
|
||||||
|
formatter: Optional[FormatterIF] = None,
|
||||||
|
pytex_file_type: Optional[PyTeXFileType] = None
|
||||||
|
):
|
||||||
self._relative_path: RelativePath = None
|
self._relative_path: RelativePath = None
|
||||||
|
self._pytex_file_type: PyTeXFileType = None
|
||||||
self._formatter: FormatterIF = None
|
self._formatter: FormatterIF = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -28,6 +34,14 @@ class PyTeXSourceFile:
|
||||||
]
|
]
|
||||||
return files
|
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]]]:
|
def format(self, target_root: Union[Path, RelativePath]) -> Optional[List[Tuple[RelativePath, Dict]]]:
|
||||||
try:
|
try:
|
||||||
configs = self._formatter.format(
|
configs = self._formatter.format(
|
||||||
|
|
Loading…
Reference in a new issue