Allow mixing of code and colours with other attrs when outputting HTML.

This commit is contained in:
Denis Kasak 2020-05-31 14:23:19 +02:00
parent 170c5811a3
commit 5191b596f3

View file

@ -328,15 +328,21 @@ class Formatted(object):
text = add_attribute(text, "code", True) text = add_attribute(text, "code", True)
attributes.pop("code") attributes.pop("code")
elif attributes["fgcolor"] or attributes["bgcolor"]: if attributes["fgcolor"] or attributes["bgcolor"]:
text = add_color( text = add_color(
text, text,
attributes["fgcolor"], attributes["fgcolor"],
attributes["bgcolor"] attributes["bgcolor"]
) )
else:
for key, value in attributes.items(): if attributes["fgcolor"]:
text = add_attribute(text, key, value) attributes.pop("fgcolor")
if attributes["bgcolor"]:
attributes.pop("bgcolor")
for key, value in attributes.items():
text = add_attribute(text, key, value)
return text return text