This commit is contained in:
11
genspells.py
11
genspells.py
@@ -59,9 +59,11 @@ def main():
|
||||
spells.update(json.load(jf))
|
||||
|
||||
if args.characterclass != "All":
|
||||
spells = dict(filter(lambda x: args.characterclass in x[1]["classes"], spells.items()))
|
||||
spells = dict(
|
||||
filter(lambda x: args.characterclass in x[1]["classes"], spells.items())
|
||||
)
|
||||
|
||||
spells = dict(sorted(spells.items(), key=spell_sorter(args.sort.split(','))))
|
||||
spells = dict(sorted(spells.items(), key=spell_sorter(args.sort.split(","))))
|
||||
pages = generate_pages(spells, args.twosided)
|
||||
filename = args.output if args.output is not None else args.characterclass
|
||||
write_doc(filename, pages)
|
||||
@@ -75,8 +77,8 @@ def write_doc(filename, pages):
|
||||
def generate_pages(spells, twosided=False):
|
||||
spellpages = []
|
||||
back = get_template("spellcard_back").render()
|
||||
for i in range(0, len(spells)+9, 10):
|
||||
spellpages.append(generate_page(list(spells.items())[i:i+10]))
|
||||
for i in range(0, len(spells) + 9, 10):
|
||||
spellpages.append(generate_page(list(spells.items())[i : i + 10]))
|
||||
if twosided:
|
||||
spellpages.append(back)
|
||||
if not twosided:
|
||||
@@ -109,5 +111,6 @@ def latex_format(text):
|
||||
text = re.sub(r"([0-9]+)\sm", r"\1~m", text)
|
||||
return text
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user