From ccc524c52110786f29ce1d53bdd43d9f785b5a85 Mon Sep 17 00:00:00 2001 From: John C Miller Date: Wed, 21 Jun 2023 09:28:05 -0400 Subject: [PATCH] Improved Pattern:Script Compatibility --- psbs/psparser.py | 7 +++++-- setup.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/psbs/psparser.py b/psbs/psparser.py index 0ed31e1..06b9581 100644 --- a/psbs/psparser.py +++ b/psbs/psparser.py @@ -18,6 +18,7 @@ def split_ps(input_str): sections = { "prelude": [], "tags": [], + "mappings": [], "objects": [], "legend": [], "sounds": [], @@ -26,6 +27,7 @@ def split_ps(input_str): "winconditions": [], "levels": [], } + optional_sections = ["tags","mappings"] section_headers = list(sections.keys())[1:] headers = re.finditer( r"^(" + "|".join(section_headers) + ") *$", @@ -44,8 +46,9 @@ def split_ps(input_str): content = input_str[start:] content = re.sub(r"^(=*) *", "", content, flags=re.MULTILINE) sections[section].append(content.strip()) - if not sections["tags"]: - del sections["tags"] + for optional_section in optional_sections: + if not sections[optional_section]: + del sections[optional_section] return sections diff --git a/setup.py b/setup.py index ea42d4c..344faf9 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='psbs', - version='0.1.2', + version='0.1.3', python_requires='>=3.8', description='PuzzleScript Build System', long_description=long_description, @@ -15,7 +15,7 @@ author='J.C. Miller', author_email='johncoreymiller@gmail.com', url='https://github.com/jcmiller11/PSBS', - download_url = 'https://github.com/jcmiller11/PSBS/archive/refs/tags/0.1.2.tar.gz', + download_url = 'https://github.com/jcmiller11/PSBS/archive/refs/tags/0.1.3.tar.gz', license='MIT', packages=find_packages(), package_data={'': ['example.txt']},