You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: reference.md
+4
Original file line number
Diff line number
Diff line change
@@ -135,6 +135,10 @@ The 'else' part may be omitted, for example:
135
135
136
136
%div{'id': 'No1' if tree is TheLarch}
137
137
138
+
The 'else' part also may contain conditional expression:
139
+
140
+
'score': '29.9' if name == 'St Stephan' else '29.3' if name == 'Richard III'
141
+
138
142
For the 'class' and 'id' attributes conditional expressions are processed in a different way: condition tags are placed inside the value rather than around the whole attribute. That is done so because these attributes may get additional value parts from [HAML syntax](#class-and-id--and-). The downside is that conditional expression cannot remove 'class' or 'id' attribute altogether, as it happens with common attributes. Example:
139
143
140
144
%div{'id': 'dog_kennel' if assisant.name == 'Mr Lambert' else 'mattress',
0 commit comments