diff --git a/cards/views.py b/cards/views.py index 16508d3..7a503eb 100755 --- a/cards/views.py +++ b/cards/views.py @@ -13,6 +13,8 @@ def prettify_mana(text): if not match: break text = text[:match.start()] + render_to_string('cards/manacost.html', {'cost': ManaCost(str(match.group(0)))}) + text[match.end():] + + text = text.replace('{T}', render_to_string('cards/manacost.html', {'cost': 'T'})) return text diff --git a/templates/cards/manacost.html b/templates/cards/manacost.html index 9978d91..ac12f6d 100644 --- a/templates/cards/manacost.html +++ b/templates/cards/manacost.html @@ -1,17 +1,20 @@ {% load get_range %} - -{% if cost.x %}X{% endif %} -{% if cost.y %}Y{% endif %} -{% if cost.z %}Z{% endif %} -{% if cost.any > 0 or cost.converted == 0 %} - {{ cost.any }} -{% endif %} -{% for i in cost.snow|get_range %} - {# use the unicode snowflake symbol #} - -{% endfor %} -{% for type, mana in cost.mana.mana.items %} - {% for i in mana|get_range %} - +{% if cost == 'T' %} + +{% else %} + {% if cost.x %}X{% endif %} + {% if cost.y %}Y{% endif %} + {% if cost.z %}Z{% endif %} + {% if cost.any > 0 or cost.converted == 0 %} + {{ cost.any }} + {% endif %} + {% for i in cost.snow|get_range %} + {# use the unicode snowflake symbol #} + {% endfor %} -{% endfor %} + {% for type, mana in cost.mana.mana.items %} + {% for i in mana|get_range %} + + {% endfor %} + {% endfor %} +{% endif %}