The problem is that a | at the end of a line (seperated by whitespace) is recognized as syntax for advanced line-breaks. What to do if you want to get this character as output?
Example
Say you want to create a menu like
Section 1 | Section 2 | ...
Note: if this is just what you want then take a look at concatenate link_to with pipe.
Wether or not a link is shown depends on a certain condition. In HAML/Ruby on Rails this could look like which does not work
%div.menu
-if condition1?
#{link_to 'Section 1', section_1_path} |
-if condition2?
#{link_to 'Section 2', section_2_path} |
-if condition3?
...
Work-around
As a (somehow dirty) work-around I changed the code:
%div.menu
-if condition1?
#{link_to 'Section 1', section_1_path} #{'|'}
-if condition2?
#{link_to 'Section 2', section_2_path} #{'|'}
-if condition3?
...
No need for escaping, just the same indentation than the element u want separated.
you can try this in browser:
online haml editor: rendera
or
html2haml