CommonClient: Escape markup sent in chat messages (#3659)
* escape markup in uncolored text * Fix comment to allign with style guide Fixes the comment so it follows the style guide, along with making it better explain the code. * Make more concise
This commit is contained in:
parent
4d1507cd0e
commit
e33a9991ef
4
kvui.py
4
kvui.py
|
@ -836,6 +836,10 @@ class KivyJSONtoTextParser(JSONtoTextParser):
|
|||
return self._handle_text(node)
|
||||
|
||||
def _handle_text(self, node: JSONMessagePart):
|
||||
# All other text goes through _handle_color, and we don't want to escape markup twice,
|
||||
# or mess up text that already has intentional markup applied to it
|
||||
if node.get("type", "text") == "text":
|
||||
node["text"] = escape_markup(node["text"])
|
||||
for ref in node.get("refs", []):
|
||||
node["text"] = f"[ref={self.ref_count}|{ref}]{node['text']}[/ref]"
|
||||
self.ref_count += 1
|
||||
|
|
Loading…
Reference in New Issue