add _get_provides_text method
This commit is contained in:
parent
f7575ccd0c
commit
ed004aaf33
2 changed files with 24 additions and 22 deletions
|
@ -37,25 +37,4 @@ class SimpleTeXFormatter(TexFormatter):
|
|||
return line.rstrip()
|
||||
|
||||
def format_post_header(self) -> None:
|
||||
if self.config.has_description:
|
||||
if self.config.tex_flavour == TeXFlavour.LaTeX2e:
|
||||
self._shipout_line(
|
||||
r'\Provides%s{%s}[%s - %s]'
|
||||
% (
|
||||
self.config.tex_type.value.capitalize(),
|
||||
self.name,
|
||||
self.attribute_dict[FormatterProperty.date.value],
|
||||
self.attribute_dict[FormatterProperty.description.value]
|
||||
)
|
||||
)
|
||||
else:
|
||||
self._shipout_line(
|
||||
'\\ProvidesExpl%s { %s } { %s } { %s }\n { %s }'
|
||||
% (
|
||||
self.config.tex_type.value.capitalize(),
|
||||
self.name,
|
||||
self.attribute_dict[FormatterProperty.date.value],
|
||||
self.config.version,
|
||||
self.config.description
|
||||
)
|
||||
)
|
||||
self._shipout_line(self._get_provides_text())
|
||||
|
|
|
@ -143,6 +143,29 @@ class TexFormatter(PyTeXFormatter, ABC):
|
|||
def mode(self, mode: FormatterMode) -> None:
|
||||
self._mode = mode
|
||||
|
||||
def _get_provides_text(self) -> str:
|
||||
if self.config.has_description:
|
||||
if self.config.tex_flavour == TeXFlavour.LaTeX2e:
|
||||
return \
|
||||
r'\Provides%s{%s}[%s - %s]' \
|
||||
% (
|
||||
self.config.tex_type.value.capitalize(),
|
||||
self.name,
|
||||
self.attribute_dict[FormatterProperty.date.value],
|
||||
self.attribute_dict[FormatterProperty.description.value]
|
||||
)
|
||||
|
||||
else:
|
||||
return \
|
||||
'\\ProvidesExpl%s { %s } { %s } { %s }\n { %s }' \
|
||||
% (
|
||||
self.config.tex_type.value.capitalize(),
|
||||
self.name,
|
||||
self.attribute_dict[FormatterProperty.date.value],
|
||||
self.config.version,
|
||||
self.config.description
|
||||
)
|
||||
|
||||
def format_header(self):
|
||||
if self._output_file is None:
|
||||
raise NotImplementedError
|
||||
|
|
Loading…
Reference in a new issue