-
Bug
-
Resolution: Fixed
-
Blocker
-
3.1.0-dev
-
None
According to the coding guidelines on IF statements in templates, "basic parenthesis can also be used to enforce good old BODMAS rules." However, using parentheses with the new twig templating engine makes it choke on statements like these:
<!-- IF not ($A or $B) --><!-- ENDIF -->
|
<!-- IF X and (.loopvar or Y) --><!-- ENDIF -->
|
This is because the regexes that look for the dollar sign and the period require whitespace directly before. A workaround is therefore:
<!-- IF not ( $A or $B) --><!-- ENDIF -->
|
<!-- IF X and ( .loopvar or Y) --><!-- ENDIF -->
|
This breaks normal coding style, however, and twig doesn't exactly fail gracefully on omitting this workaround:
Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected character "$"
|