Hide HTML entity if it doesn't exist

Signed-off-by: Ivan Boothe <ivan@rootwork.org>
This commit is contained in:
Ivan Boothe 2021-10-25 20:20:55 -07:00
parent 2462364d46
commit d225b02bc9

View file

@ -86,15 +86,17 @@ class KeywordQueryEventListener(EventListener):
encoded = htmlentities.encode(char.character) encoded = htmlentities.encode(char.character)
if "&" in encoded: if "&" in encoded:
sep = " - " sep = " - "
html = encoded
else: else:
sep = "" sep = ""
html = ""
items.append( items.append(
ExtensionResultItem( ExtensionResultItem(
icon=image_path, icon=image_path,
name=char.name.capitalize() + " - " + char.character, name=char.name.capitalize() + " - " + char.character,
description=char.block + " - U+" + char.code + sep + encoded, description=char.block + " - U+" + char.code + sep + html,
on_enter=CopyToClipboardAction(char.character), on_enter=CopyToClipboardAction(char.character),
on_alt_enter=CopyToClipboardAction(encoded), on_alt_enter=CopyToClipboardAction(html),
) )
) )
return RenderResultListAction(items) return RenderResultListAction(items)