From 32169bfd2fd71aa0f1f3064f9d5b0a668c9775cd Mon Sep 17 00:00:00 2001 From: "Ignacio R. Morelle" Date: Tue, 15 Aug 2017 23:58:56 -0300 Subject: [PATCH] wmlunits: Skip race names consisting of nothing but whitespace They mess the markup up and aren't usually intended to be included in the unit tree in the first place. --- data/tools/unit_tree/html_output.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/data/tools/unit_tree/html_output.py b/data/tools/unit_tree/html_output.py index 3fdbc93a880a..fa67b5e18df3 100644 --- a/data/tools/unit_tree/html_output.py +++ b/data/tools/unit_tree/html_output.py @@ -584,6 +584,11 @@ def end_menu(is_table_container=False): racenames += [("-", "-")] + sorted(r[1].items()) for racename, rid in racenames: + # Some add-ons use race names consisting of only whitespace for + # hiding races in the UI. We need to skip those since otherwise + # they result in unusual markup (e.g. invisible elements). + if not racename.strip(): + continue if racename == "-": add_menuitem_placeholder() else: @@ -622,7 +627,10 @@ def end_menu(is_table_container=False): got_menu = False menuid = 0 for r in racelist: - if not r: + # Some add-ons use race names consisting of only whitespace for + # hiding races in the UI. We need to skip those since otherwise + # they result in unusual markup (e.g. invisible elements). + if not r.strip(): continue if got_menu: end_menu()