:else is implemented via "if ! condition", so in the following
expression:
:if 1+1==3
...
:else
...
the else part is compiled into "if ! 1+1 == 3". Since in JavaScript,
the not operator has higher precedence, this is interpreted as
"if (!1)+1 == 3", which is false. Therefore, the above expression
will output nothing unless the condition would have been written as
":if (1+1==3)"
This commit fixes :else and :elseif by always adding parenthesis like
it is done for if.
:else is implemented via "if ! condition", so in the following expression:
:if 1+1==3 ... :else ...
the else part is compiled into "if ! 1+1 == 3". Since in JavaScript, the not operator has higher precedence, this is interpreted as "if (!1)+1 == 3", which is false. Therefore, the above expression will output nothing unless the condition would have been written as ":if (1+1==3)"
This commit fixes :else and :elseif by always adding parenthesis like it is done for if.