From 9394103e42aec8d8348ad0c19e70c0fd635d3e3c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 16 Sep 2020 14:35:21 +0200 Subject: improve how card content is drawn * Card content is always bottom aligned at \contentBottom * Only use one node instead of two to draw \splitcontent * Draw content background relative to the content size * Remove now obsolete \contentsplit variants --- scripts/generate_latex.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/generate_latex.py b/scripts/generate_latex.py index 6b35d8fc..c8407eca 100755 --- a/scripts/generate_latex.py +++ b/scripts/generate_latex.py @@ -76,7 +76,7 @@ def generate_card(card_name: str, card: MutableMapping): movement = card['movement'] # stats = f'\\faHeart: {health}\\\\ \\faShoePrints: {movement}' - stats = [f'Health: {health}', f'Movement: {movement}'] + stats = f'Health: {health}\\\\ Movement: {movement}' attack = card.get('attack', None) if attack: @@ -84,9 +84,8 @@ def generate_card(card_name: str, card: MutableMapping): if "Range" in attack: attack_sym = '\\ding{246}' # stats += f'\\\\ {attack_sym}: {attack}' - stats.append(f'Attack: {attack}') + stats += f'\\\\ Attack: {attack}' - stats_str = '\\\\ '.join(stats) if 'effect' in card or 'full_action' in card: ability_block = "" @@ -100,12 +99,9 @@ def generate_card(card_name: str, card: MutableMapping): ability_block += '\\\\ ' ability_block += f'\\faRotateRight: {full_action}' - if len(stats) == 2: - card_content += f'\cardsplitcontenttwolines{{{stats_str}}}{{{ability_block}}}' - else: - card_content += f'\cardsplitcontent{{{stats_str}}}{{{ability_block}}}' + card_content += f'\cardsplitcontent{{{stats}}}{{{ability_block}}}' else: - card_content += f'\cardcontent{{{stats_str}}}' + card_content += f'\cardcontent{{{stats}}}' card_content += '\n' @@ -121,8 +117,8 @@ def generate_card(card_name: str, card: MutableMapping): elif card['type'] == 'equipment': # card_content += f'\cardsplitcontent{{\\faRecycle: {card["durability"]}}}{{{card["effect"]}}}' - card_content += f'\cardsplitcontentsingleline{{Durability: {card["durability"]}}}{{{card["effect"]}}}\n' - card_content += f'\cardplaycost{{{card["play"]}}}\n' + card_content += f'\cardsplitcontent{{Durability: {card["durability"]}}}{{{card["effect"]}}}\n' + card_content += f'\cardplaycost{{{card["play"]}}}' else: print('WARNING: unknown card type {card["type"]}!') -- cgit v1.2.3