Allow arguments to TALES extensions to be multi-lines
authorThierry Florac <thierry.florac@onf.fr>
Tue, 17 Jul 2018 11:31:41 +0200
changeset 219 758f286d76af
parent 218 9bf1c695938e
child 220 d82c0fe2a2c9
Allow arguments to TALES extensions to be multi-lines
src/pyams_utils/tales.py
--- a/src/pyams_utils/tales.py	Fri Jul 13 17:11:35 2018 +0200
+++ b/src/pyams_utils/tales.py	Tue Jul 17 11:31:41 2018 +0200
@@ -40,7 +40,7 @@
         return assignment + transform
 
 
-FUNCTION_EXPRESSION = re.compile('(.+)\((.+)\)')
+FUNCTION_EXPRESSION = re.compile('(.+)\((.+)\)', re.MULTILINE | re.DOTALL)
 ARGUMENTS_EXPRESSION = re.compile('[^(,)]+')
 
 
@@ -63,7 +63,7 @@
         if '=' in arg:
             key, value = arg.split('=', 1)
             value = get_value(econtext, value)
-            return {key: value}
+            return {key.strip(): value}
         try:
             arg = int(arg)  # check integer value
         except ValueError: