Missing weapons now raise a warning, and recursive directory parsing.

In order to avoid parsing arbitrary python files encountered during
directory recursion, ``makesheets`` now checks each python file for a
string listing the *dungeonsheets_version* before trying to import the
character file.
This commit is contained in:
Mark Wolfman
2020-11-08 14:14:50 -06:00
parent debbfc5ae1
commit ccf886b8ae
10 changed files with 153 additions and 57 deletions
+3 -7
View File
@@ -155,13 +155,9 @@ class JSONCharacterReader(BaseCharacterReader):
match = item_re.match(obj['name'])
if match:
weapon_name = self.get_attrib(match.group()).lower()
if weapon_name[:3] == "i. ":
# Ignore artificer infusions
warnings.warn("Ignoring weapon infusion")
else:
weapon_name = weapon_name.split('(')[0].strip()
weapon_name = weapon_name.split(',')[0].strip()
yield weapon_name
weapon_name = weapon_name.split('(')[0].strip()
weapon_name = weapon_name.split(',')[0].strip()
yield weapon_name
def __call__(self, filename: str):
"""Create a character property dictionary from the JSON file."""