From ad43e5993a27d66b3d0299e2d092edd67f6c4fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 6 Oct 2021 18:39:13 +0200 Subject: [PATCH] strip arguments from macros, change some macro names --- package_formatter.py | 6 +++--- replacements.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package_formatter.py b/package_formatter.py index c77e29d..b7ad7fc 100644 --- a/package_formatter.py +++ b/package_formatter.py @@ -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: diff --git a/replacements.py b/replacements.py index 6b11782..f80f2ab 100644 --- a/replacements.py +++ b/replacements.py @@ -22,9 +22,9 @@ 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, 'setif', r'\{prefix}{condition}{value}', + 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, condition=Args.one)