Skip to content

Commit

Permalink
Improved Pattern:Script Compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmiller11 committed Jun 21, 2023
1 parent 6370b2e commit ccc524c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions psbs/psparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def split_ps(input_str):
sections = {
"prelude": [],
"tags": [],
"mappings": [],
"objects": [],
"legend": [],
"sounds": [],
Expand All @@ -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) + ") *$",
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

setup(
name='psbs',
version='0.1.2',
version='0.1.3',
python_requires='>=3.8',
description='PuzzleScript Build System',
long_description=long_description,
long_description_content_type='text/markdown',
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']},
Expand Down

0 comments on commit ccc524c

Please sign in to comment.