move close output stream method to tex formatter

This commit is contained in:
Maximilian Keßler 2022-02-17 20:37:38 +01:00
parent e4de1ceb7f
commit 87666fbec6
2 changed files with 9 additions and 10 deletions

View file

@ -14,9 +14,6 @@ class SimpleTeXFormatter(TexFormatter):
} }
return self.name + switcher[self.config.tex_type] return self.name + switcher[self.config.tex_type]
def close_output_stream(self):
self._output_file.close()
@property @property
def future_config(self) -> List[Tuple[str, FormattingConfig]]: def future_config(self) -> List[Tuple[str, FormattingConfig]]:
return [] # TODO return [] # TODO

View file

@ -75,12 +75,8 @@ class TexFormatter(PyTeXFormatter, ABC):
else: else:
self._output_file = out_file.open('w') self._output_file = out_file.open('w')
@abstractmethod
def close_output_stream(self) -> None: def close_output_stream(self) -> None:
""" self._output_file.close()
:return:
"""
@property @property
@abstractmethod @abstractmethod
@ -123,8 +119,14 @@ class TexFormatter(PyTeXFormatter, ABC):
""" """
return line.rstrip() return line.rstrip()
def _shipout_line(self, line): def _shipout_line(self, line) -> None:
self.write_line(line + '\n') """
The line might get dropped according to current mode
:param line: Line to shipout
:return: None
"""
self.write_line(line.rstrip('\n') + '\n')
def write_line(self, line: str): def write_line(self, line: str):
if self._output_file is None: if self._output_file is None: