move close output stream method to tex formatter
This commit is contained in:
parent
e4de1ceb7f
commit
87666fbec6
2 changed files with 9 additions and 10 deletions
|
@ -14,9 +14,6 @@ class SimpleTeXFormatter(TexFormatter):
|
|||
}
|
||||
return self.name + switcher[self.config.tex_type]
|
||||
|
||||
def close_output_stream(self):
|
||||
self._output_file.close()
|
||||
|
||||
@property
|
||||
def future_config(self) -> List[Tuple[str, FormattingConfig]]:
|
||||
return [] # TODO
|
||||
|
|
|
@ -75,12 +75,8 @@ class TexFormatter(PyTeXFormatter, ABC):
|
|||
else:
|
||||
self._output_file = out_file.open('w')
|
||||
|
||||
@abstractmethod
|
||||
def close_output_stream(self) -> None:
|
||||
"""
|
||||
|
||||
:return:
|
||||
"""
|
||||
self._output_file.close()
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
|
@ -123,8 +119,14 @@ class TexFormatter(PyTeXFormatter, ABC):
|
|||
"""
|
||||
return line.rstrip()
|
||||
|
||||
def _shipout_line(self, line):
|
||||
self.write_line(line + '\n')
|
||||
def _shipout_line(self, line) -> None:
|
||||
"""
|
||||
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):
|
||||
if self._output_file is None:
|
||||
|
|
Loading…
Reference in a new issue