From fd0f765ad5aa06940c0e31ef0ba0eb192bedd8af Mon Sep 17 00:00:00 2001 From: BlauFeuer Date: Sat, 22 Oct 2016 14:06:19 -0400 Subject: [PATCH 1/4] MXP tags to use double quote instead of single This works around the problem of having to escape single quotes (apostrophes) in MXP commands or texts, but then requires (simple) double quotes to be escaped. --- evennia/server/portal/mxp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/server/portal/mxp.py b/evennia/server/portal/mxp.py index 0d7efefd34..e62e65c2c7 100644 --- a/evennia/server/portal/mxp.py +++ b/evennia/server/portal/mxp.py @@ -21,7 +21,7 @@ LINKS_SUB = re.compile(r'\|lc(.*?)\|lt(.*?)\|le', re.DOTALL) MXP = "\x5B" MXP_TEMPSECURE = "\x1B[4z" MXP_SEND = MXP_TEMPSECURE + \ - "" + \ + "" + \ "\\2" + \ MXP_TEMPSECURE + \ "" From ecb82a2a23011934909ceecc229be7bf8cdf39a5 Mon Sep 17 00:00:00 2001 From: BlauFeuer Date: Sat, 22 Oct 2016 14:43:32 -0400 Subject: [PATCH 2/4] MXP text/command simple double quote escape Escape simple double quote characters when used in MXP text/command text --- evennia/server/portal/mxp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/evennia/server/portal/mxp.py b/evennia/server/portal/mxp.py index e62e65c2c7..f1c14f26fc 100644 --- a/evennia/server/portal/mxp.py +++ b/evennia/server/portal/mxp.py @@ -38,6 +38,7 @@ def mxp_parse(text): """ text = text.replace("&", "&") \ + .replace('"', """) \ .replace("<", "<") \ .replace(">", ">") From 501c9f73a1be6556cf455e9f3377317323bcf0f9 Mon Sep 17 00:00:00 2001 From: BlauFeuer Date: Wed, 26 Oct 2016 15:12:41 -0400 Subject: [PATCH 3/4] text2html.py Use double quotes in HTML MXP link This just changes the problem from not escaping single quotes properly to not escaping double quotes when supplied in the MXP command or text. --- evennia/utils/text2html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/utils/text2html.py b/evennia/utils/text2html.py index 066301beba..1275927766 100644 --- a/evennia/utils/text2html.py +++ b/evennia/utils/text2html.py @@ -243,7 +243,7 @@ class TextToHTMLparser(object): text (str): Processed text. """ - return self.re_mxplink.sub(r"""\2""", text) + return self.re_mxplink.sub(r'''\2''', text) def do_sub(self, match): """ From 1f270d76ab7ee897af67aba4e7340361355265b4 Mon Sep 17 00:00:00 2001 From: BlauFeuer Date: Thu, 3 Nov 2016 18:13:43 -0400 Subject: [PATCH 4/4] Clarify MXP links in docstring --- evennia/utils/text2html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evennia/utils/text2html.py b/evennia/utils/text2html.py index 1275927766..fd751c5523 100644 --- a/evennia/utils/text2html.py +++ b/evennia/utils/text2html.py @@ -234,7 +234,7 @@ class TextToHTMLparser(object): def convert_links(self, text): """ - Replaces links with HTML code. + Replaces MXP links with HTML code. Args: text (str): Text to process.