diff options
author | Your Name <you@example.com> | 2021-05-01 15:34:12 -0400 |
---|---|---|
committer | Your Name <you@example.com> | 2021-05-01 15:34:12 -0400 |
commit | 6e41af7248b4e594d1b538a5989c9d0998b53cca (patch) | |
tree | 2e58dc57bdc9893ea2bca4cb8310f5d22e4da762 /parser/utils.py | |
parent | 7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d (diff) | |
download | dmtool-6e41af7248b4e594d1b538a5989c9d0998b53cca.tar.gz dmtool-6e41af7248b4e594d1b538a5989c9d0998b53cca.tar.bz2 dmtool-6e41af7248b4e594d1b538a5989c9d0998b53cca.zip |
Made data source a git module
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() |