pytex/PyTeX/format/simple_tex_formatter.py

29 lines
862 B
Python
Raw Normal View History

from .formatting_config import FormattingConfig
2022-02-06 19:40:14 +01:00
from .tex_formatter import TexFormatter
2022-02-08 17:04:16 +01:00
from pathlib import Path
from typing import Optional, List, Tuple, Dict
2022-02-06 19:40:14 +01:00
class SimpleTeXFormatter(TexFormatter):
2022-02-08 17:04:16 +01:00
def open_output_stream(self, build_dir: Path):
out_file = build_dir / self.input_file.with_suffix('').name
if out_file.exists():
raise NotImplementedError
else:
2022-02-08 23:34:18 +01:00
self._output_file = out_file.open('w')
2022-02-08 17:04:16 +01:00
def close_output_stream(self):
self._output_file.close()
2022-02-08 23:54:29 +01:00
@property
def future_config(self) -> List[Tuple[str, FormattingConfig]]:
return [] # TODO
2022-02-08 17:04:16 +01:00
2022-02-08 23:34:18 +01:00
@property
2022-02-08 17:04:16 +01:00
def dependencies(self) -> List[str]:
2022-02-08 17:40:08 +01:00
return [] # sty / cls file does not depend on anything
2022-02-08 17:04:16 +01:00
2022-02-08 18:26:25 +01:00
@property
2022-02-08 17:04:16 +01:00
def output_files(self) -> List[str]:
return [self.input_file.with_suffix('').name]