make padding in generic text optional

This commit is contained in:
Maximilian Keßler 2022-02-17 21:44:34 +01:00
parent f2ba97cabe
commit f65610c06b
2 changed files with 10 additions and 2 deletions

View file

@ -36,7 +36,8 @@ class DTXFormatter(TexFormatter):
outfile=self.name + switcher[self.config.tex_out_type],
preamble='', # TODO
postamble='', # TODO
guards=', '.join(self.config.docstrip_guards)
guards=', '.join(self.config.docstrip_guards),
padding=False
)
def _get_drv_file(self) -> str:
@ -45,6 +46,7 @@ class DTXFormatter(TexFormatter):
documentclass='l3doc', # TODO
preamble='', # TODO
infile=self.name + '.dtx',
padding=False
)
def format_pre_header(self) -> None:

View file

@ -62,10 +62,16 @@ class GenericText:
return str(self._path) if self._path else None
def format(self, **kwargs) -> str:
padding = True
if 'padding' in kwargs.keys():
padding = kwargs['padding']
kwargs.pop('padding', None)
lines = []
for line in self.text:
try:
line = '% ' + line.rstrip().format(**kwargs).ljust(77) + '%'
line = '% ' + line.rstrip().format(**kwargs)
if padding:
line = line.ljust(77) + ' %'
if len(line) > 80:
logger.warning(
'Line too long') # TODO