diff options
Diffstat (limited to 'parser/utils.py')
-rwxr-xr-x | parser/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/parser/utils.py b/parser/utils.py index 34649ca..645bc96 100755 --- a/parser/utils.py +++ b/parser/utils.py @@ -4,7 +4,7 @@ import json import re from fractions import Fraction -docsLoc = '../5thSRD/docs/' +docsLoc = 'parser/5thSRD/docs/' skillsByAbility = {'str': ['Athletics'], 'dex': ['Acrobatics', 'Sleight of Hand', 'Stealth'], 'con': [], 'int': ['Arcana', 'History', 'Investigation', 'Nature', 'Religion'], 'wis': ['Animal Handling', 'Insight', 'Medicine', 'Perception', 'Survival'], 'cha': ['Deception', 'Intimidation', 'Performance', 'Persuasion']} @@ -163,9 +163,11 @@ def getSpells(): names2names = {'name': 'name', 'level': 'level', 'type': 'school', 'classes': 'classes', 'casting_time': 'Casting Time', 'range': 'Range', 'components': 'Components', 'duration': 'Duration'} from pathlib import Path for s in Path(docsLoc + '/spellcasting/spells/').iterdir(): + if s.name == 'index.md': + continue with s.open() as f: data = f.read() - spell = {'entry': 'spell'} + spell = {'entry': 'spells'} for name in names2names: spell[name] = re.search('(?sm)[\*]*{}[\*:]* (.*?)^[a-zA-Z#\*]'.format(names2names[name]), data).group(1).strip() spell['name'] = spell['name'].lower() |