From 6e41af7248b4e594d1b538a5989c9d0998b53cca Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 1 May 2021 15:34:12 -0400 Subject: Made data source a git module --- parser/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'parser/utils.py') 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() -- cgit v1.2.3