diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-03 13:49:08 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-03 13:49:08 +0200 |
| commit | 149d4c9578a4fec1e6a99161a084eaebe0b7df6d (patch) | |
| tree | ddaac8023b3c39e0a12ffa198a88ab3783d02c68 /scripts/generate_boss_html.py | |
| parent | b0f0335ee378552be33bf40fcd4246534c831be3 (diff) | |
| download | muhqs-game-149d4c9578a4fec1e6a99161a084eaebe0b7df6d.tar.gz muhqs-game-149d4c9578a4fec1e6a99161a084eaebe0b7df6d.zip | |
support a path prefix for the hover card placeholder png
Diffstat (limited to 'scripts/generate_boss_html.py')
| -rwxr-xr-x | scripts/generate_boss_html.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/scripts/generate_boss_html.py b/scripts/generate_boss_html.py index 7f023b34..12eadea3 100755 --- a/scripts/generate_boss_html.py +++ b/scripts/generate_boss_html.py @@ -17,7 +17,7 @@ NAMES = {"kraken": "The Kraken", "tyrant": "The Tyrant"} DESCS = { "kraken": "Face the evil of the sea. Overcome the kraken, the fierce epicenter of the ozean, which employs creatures of the depth to stop your offense.<br>Since the kraken does not move and can not win it is the perfect boss to start.", - "tyrant": "" # TODO + "tyrant": "" # TODO } TEMPLATE = """<!DOCTYPE html> @@ -146,7 +146,7 @@ code { padding: .2em .4em; font-size: 85%; margin: 0; - white-space: pre-wrap; + white-space: pre-wrap; } pre { margin: 0; @@ -242,6 +242,7 @@ def ai_instruction(name: str, rules, lang: str) -> str: def gen_startdeck_ul(map_def: dict, lang: str) -> str: + """Generate the HTML for the hoverable startdeck listing""" if 'start_deck_list' in map_def: dl = map_def["start_deck_list"].splitlines() else: @@ -249,10 +250,10 @@ def gen_startdeck_ul(map_def: dict, lang: str) -> str: s = "" for card in dl: - cardFmt = "" + card_fmt = "" parts = card.split() if len(parts) > 1: - cardFmt = f'{parts[0]} ' + card_fmt = f'{parts[0]} ' c = parts[1] else: c = card @@ -262,9 +263,15 @@ def gen_startdeck_ul(map_def: dict, lang: str) -> str: c, lang, path_prefix='../') hlink = generate_card_hover_links.gen_hoverable_link( - c, lambda _: c, gen_link_target, '../latex-build/', lang) - cardFmt += hlink - s += f'\n<li>{cardFmt}</li>' + c, + lambda _: c, + gen_link_target, + '../latex-build/', + lang, + placeholder_png_prefix='../') + + card_fmt += hlink + s += f'\n<li>{card_fmt}</li>' return f'<ul id="start-decklist">{s}\n</ul>' |
