From a5a3ec0dfade39c5aa9a31a611279bb4864ec668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 6 Feb 2022 16:52:24 +0100 Subject: [PATCH] add description attribute to formatting config --- PyTeX/format/formatting_config.py | 8 ++++++++ PyTeX/format/pytex_formatter.py | 12 ++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/PyTeX/format/formatting_config.py b/PyTeX/format/formatting_config.py index d585433..b547a8a 100644 --- a/PyTeX/format/formatting_config.py +++ b/PyTeX/format/formatting_config.py @@ -9,6 +9,7 @@ class FormattingConfig(Config): def __init__(self): self._naming_scheme: Optional[Union[NamingScheme, str]] = None self._license: Optional[List[License]] = None + self._description: Optional[str] = None self._include_extra_header: Optional[bool] = None self._include_build_time: Optional[bool] = None @@ -195,6 +196,13 @@ class FormattingConfig(Config): else: return self._escape_character + @property + def description(self) -> str: + if self._description is None: + return '' + else: + return self._description + class DocFormattingConfig: def __init__(self): diff --git a/PyTeX/format/pytex_formatter.py b/PyTeX/format/pytex_formatter.py index e44b64f..e52130b 100644 --- a/PyTeX/format/pytex_formatter.py +++ b/PyTeX/format/pytex_formatter.py @@ -116,7 +116,11 @@ class PyTeXFormatter(FormatterIF): return self._header - def format_header(self, **kwargs) -> None: - self._header = self.header.format( - **kwargs - ) # TODO: add standard keywords here + def format_header(self, **kwargs) -> str: + return '\n'.join( + [ + '%'*80, + self.header.format(**kwargs), # TODO: add standard keywords here + '%'*80 + ] + )