strip arguments from macros, change some macro names

This commit is contained in:
Maximilian Keßler 2021-10-06 18:39:13 +02:00
parent d0d1caa96c
commit ad43e5993a
2 changed files with 6 additions and 6 deletions

View file

@ -32,9 +32,9 @@ class PackageFormatter:
if type(arg) == Attributes:
new_args.append(getattr(self, arg.value))
elif type(arg) == Args:
new_args.append(match_groups[arg.value])
new_args.append(match_groups[arg.value].strip())
elif type(arg) == str:
new_args.append(arg)
new_args.append(arg.strip())
else:
new_args += 'ERROR'
new_args = tuple(new_args)
@ -43,7 +43,7 @@ class PackageFormatter:
if type(user_kwargs[kw]) == Attributes:
new_kwargs[kw] = getattr(self, user_kwargs[kw].value)
elif type(user_kwargs[kw]) == Args:
new_kwargs[kw] = match_groups[user_kwargs[kw].value]
new_kwargs[kw] = match_groups[user_kwargs[kw].value].strip()
elif type(user_kwargs[kw]) == str:
new_kwargs[kw] = user_kwargs[kw]
else:

View file

@ -22,8 +22,8 @@ def make_default_commands(package_formatter: PackageFormatter):
package_formatter.add_replacement('file name', '{name}', name=Attributes.file_name)
package_formatter.add_replacement('date', '{}', Attributes.date)
package_formatter.add_replacement('author', '{}', Attributes.author)
package_formatter.add_arg_replacement(1, 'newif', r'\newif\if{prefix}{condition}',
prefix=Attributes.package_prefix, condition=Args.one)
package_formatter.add_arg_replacement(2, 'new if', r'\newif\if{prefix}{condition}\{prefix}{condition}{value}',
prefix=Attributes.package_prefix, condition=Args.one, value=Args.two)
package_formatter.add_arg_replacement(2, 'set if', r'\{prefix}{condition}{value}',
prefix=Attributes.package_prefix, condition=Args.one, value=Args.two)
package_formatter.add_arg_replacement(1, 'if', r'\if{prefix}{condition}', prefix=Attributes.package_prefix,