Browse Source

...may as well refactor this before it bites someone again

master
Graham Northup 3 years ago
parent
commit
4025a494d6
Signed by untrusted user: grissess GPG Key ID: 5D000E6F539376FB
  1. 6
      app/items.py

6
app/items.py

@ -2,6 +2,8 @@ import glob, collections
import os
from monsters import Monster
HEADER_CHARACTERS = set('-=')
def parse_headers(spell_text):
"""Takes in the 'tail' part of a spell file"""
lines = spell_text.split("\n")
@ -50,7 +52,7 @@ def get_items(items_dir):
title = lines[0]
lines = lines[1:]
while not (set(lines[0]) - set('-=')):
while not (set(lines[0]) - HEADER_CHARACTERS):
lines = lines[1:]
heads, body = parse_headers('\n'.join(lines))
secs = parse_sections(body)
@ -83,7 +85,7 @@ def get_new_items():
title = lines[0]
lines = lines[1:]
while not (set(lines[0]) - set('-')):
while not (set(lines[0]) - HEADER_CHARACTERS):
lines = lines[1:]
heads, body = parse_headers('\n'.join(lines))
secs = parse_sections(body)

Loading…
Cancel
Save