diff --git a/data/tools/unit_tree/html_output.py b/data/tools/unit_tree/html_output.py
index f00bb5e27d9b..a67bfcbb1c63 100644
--- a/data/tools/unit_tree/html_output.py
+++ b/data/tools/unit_tree/html_output.py
@@ -704,10 +704,16 @@ def uval(name):
write('\n\n')
write("
")
- write("%s%s
" % (_("Cost: ", "wesnoth-help"), cost))
- write("%s%s
" % (_("HP: "), hp))
- write("%s%s
" % (_("MP: "), mp))
- write("%s%s
" % (_("XP: "), xp))
+
+ attributes = (
+ (_("Cost: ", "wesnoth-help"), cost),
+ (_("HP: "), hp),
+ (_("XP: "), xp),
+ (_("MP: "), mp),
+ )
+
+ for attr_label, attr_value in attributes:
+ write('%s %s
' % (attr_label.strip(), attr_value))
# Write info about abilities.
anames = self.get_abilities(u)