mirror of
https://github.com/Cockatrice/Magic-Spoiler.git
synced 2026-06-15 12:51:30 -05:00
Fix costs in text (#107)
* Replace anything found in `{}` with uppercase, single character versions
* Remove debug print
This commit is contained in:
parent
c13a719944
commit
4d62dcf946
12
spoilers.py
12
spoilers.py
|
|
@ -93,9 +93,21 @@ def correct_cards(mtgjson, manual_cards=[], card_corrections=[], delete_cards=[]
|
|||
|
||||
mtgjson = {"cards": mtgjson2}
|
||||
|
||||
for card in mtgjson['cards']:
|
||||
if '{' in card['text']:
|
||||
card['text'] = re.sub(r'{(.*?)}', replace_costs, card['text'])
|
||||
return mtgjson
|
||||
|
||||
|
||||
def replace_costs(match):
|
||||
full_cost = match.group(1)
|
||||
individual_costs = []
|
||||
if len(full_cost) > 0:
|
||||
for x in range(0, len(full_cost)):
|
||||
individual_costs.append('{' + str(full_cost[x]).upper() + '}')
|
||||
return ''.join(individual_costs)
|
||||
|
||||
|
||||
def error_check(mtgjson, card_corrections={}):
|
||||
errors = []
|
||||
for card in mtgjson['cards']:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user