From 9587f400acfdd63bf3036e42f9d94d6110503456 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 29 Nov 2015 18:26:19 +0100 Subject: [PATCH] Fixed an escaping issue for nested inlinefuncs. --- evennia/utils/nested_inlinefuncs.py | 2 +- evennia/utils/tests.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/evennia/utils/nested_inlinefuncs.py b/evennia/utils/nested_inlinefuncs.py index b182866bc..d36c5a7f4 100644 --- a/evennia/utils/nested_inlinefuncs.py +++ b/evennia/utils/nested_inlinefuncs.py @@ -189,7 +189,7 @@ _RE_TOKEN = re.compile(r""" (?P(?(?\\'|\\"|\\\)|\\$\w+\()| # escaped tokens should re-appear in text - (?P[\w\s.-\/#!%\^&\*;:=\-\"\'_`~\(}{\[\]]+) # everything else should also be included""", + (?P[\w\s.-\/#!%\^&\*;:=\-_`~\(}{\[\]]+|\"{1}|\'{1}) # everything else should also be included""", re.UNICODE + re.IGNORECASE + re.VERBOSE + re.DOTALL) diff --git a/evennia/utils/tests.py b/evennia/utils/tests.py index 300b5dc38..1cd5074ee 100644 --- a/evennia/utils/tests.py +++ b/evennia/utils/tests.py @@ -336,5 +336,10 @@ class TestNestedInlineFuncs(TestCase): def test_escaped(self): self.assertEqual(nested_inlinefuncs.parse_inlinefunc( - "this should be $pad('''escaped,''' and \"\"\"instead,\"\"\" cropped $crop(with a long,5) text., 80)"), + "this should be $pad('''escaped,''' and '''instead,''' cropped $crop(with a long,5) text., 80)"), + "this should be escaped, and instead, cropped with text. ") + + def test_escaped2(self): + self.assertEqual(nested_inlinefuncs.parse_inlinefunc( + 'this should be $pad("""escaped,""" and """instead,""" cropped $crop(with a long,5) text., 80)'), "this should be escaped, and instead, cropped with text. ")