add header to simple tex formatter
This commit is contained in:
parent
e760eaef6d
commit
8e115b46c2
3 changed files with 27 additions and 2 deletions
|
@ -111,6 +111,7 @@ class FormatterProperty(MacroReplacementAtomIF, Enum):
|
||||||
pytex_dirty = 'pytex_dirty'
|
pytex_dirty = 'pytex_dirty'
|
||||||
tex_type = 'tex_type'
|
tex_type = 'tex_type'
|
||||||
tex_flavour = 'latex_flavour'
|
tex_flavour = 'latex_flavour'
|
||||||
|
description = 'description'
|
||||||
|
|
||||||
|
|
||||||
class Argument(MacroReplacementAtomIF, Enum):
|
class Argument(MacroReplacementAtomIF, Enum):
|
||||||
|
|
|
@ -152,7 +152,8 @@ class PyTeXFormatter(FormatterIF, ABC):
|
||||||
FormatterProperty.pytex_dirty.value: self.git_version_info.pytex_version.dirty,
|
FormatterProperty.pytex_dirty.value: self.git_version_info.pytex_version.dirty,
|
||||||
FormatterProperty.tex_type.value: self.config.tex_type.value,
|
FormatterProperty.tex_type.value: self.config.tex_type.value,
|
||||||
FormatterProperty.tex_flavour.value: self.config.tex_flavour.value,
|
FormatterProperty.tex_flavour.value: self.config.tex_flavour.value,
|
||||||
FormatterProperty.file_prefix.value: self.file_prefix
|
FormatterProperty.file_prefix.value: self.file_prefix,
|
||||||
|
FormatterProperty.description.value: self.config.description
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -2,7 +2,7 @@ from .formatting_config import FormattingConfig
|
||||||
from .tex_formatter import TexFormatter
|
from .tex_formatter import TexFormatter
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional, List, Tuple, Dict
|
from typing import Optional, List, Tuple, Dict
|
||||||
from .enums import TeXFlavour, TeXType
|
from .enums import TeXFlavour, TeXType, FormatterProperty
|
||||||
|
|
||||||
|
|
||||||
class SimpleTeXFormatter(TexFormatter):
|
class SimpleTeXFormatter(TexFormatter):
|
||||||
|
@ -35,3 +35,26 @@ class SimpleTeXFormatter(TexFormatter):
|
||||||
return '' if raw == '' else raw + '%'
|
return '' if raw == '' else raw + '%'
|
||||||
else:
|
else:
|
||||||
return line.rstrip()
|
return line.rstrip()
|
||||||
|
|
||||||
|
def format_post_header(self) -> None:
|
||||||
|
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(
|
||||||
|
r'\ProvidesExpl%s{%s}{%s}{%s}{%s}'
|
||||||
|
% (
|
||||||
|
self.config.tex_type.value.capitalize(),
|
||||||
|
self.name,
|
||||||
|
self.config.version,
|
||||||
|
self.attribute_dict[FormatterProperty.date.value],
|
||||||
|
self.config.description
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue