Fixed an escaping issue for nested inlinefuncs.
This commit is contained in:
parent
0c08f7c550
commit
9587f400ac
2 changed files with 7 additions and 2 deletions
|
|
@ -189,7 +189,7 @@ _RE_TOKEN = re.compile(r"""
|
||||||
(?P<end>(?<!\\)\))| # unescaped } (end of function call)
|
(?P<end>(?<!\\)\))| # unescaped } (end of function call)
|
||||||
(?P<start>(?<!\\)\$\w+\()| # unescaped $funcname{ (start of function call)
|
(?P<start>(?<!\\)\$\w+\()| # unescaped $funcname{ (start of function call)
|
||||||
(?P<escaped>\\'|\\"|\\\)|\\$\w+\()| # escaped tokens should re-appear in text
|
(?P<escaped>\\'|\\"|\\\)|\\$\w+\()| # escaped tokens should re-appear in text
|
||||||
(?P<rest>[\w\s.-\/#!%\^&\*;:=\-\"\'_`~\(}{\[\]]+) # everything else should also be included""",
|
(?P<rest>[\w\s.-\/#!%\^&\*;:=\-_`~\(}{\[\]]+|\"{1}|\'{1}) # everything else should also be included""",
|
||||||
re.UNICODE + re.IGNORECASE + re.VERBOSE + re.DOTALL)
|
re.UNICODE + re.IGNORECASE + re.VERBOSE + re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -336,5 +336,10 @@ class TestNestedInlineFuncs(TestCase):
|
||||||
|
|
||||||
def test_escaped(self):
|
def test_escaped(self):
|
||||||
self.assertEqual(nested_inlinefuncs.parse_inlinefunc(
|
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. ")
|
"this should be escaped, and instead, cropped with text. ")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue