There's not a great way to do inline formatting in Haml in general. See http://chriseppstein.github.com/blog/2010/02/08/haml-sucks-for-content/ for an explanation why. In this case, you could do it a little neater (e.g. \| on the lines following the links), but it seems to me that having separators in your HTML is mixing content and presentation in the first place. Why not use CSS to add separators?
On Tue, Sep 21, 2010 at 6:09 PM, Jamison Dance <[email protected]> wrote: > Hey all. I am trying to insert a pipe character at the end of a few > lines of HAML to separate menu items, and am struggling mightily. I > got it to work with some crazy hacks, but there has got to be a better > way. Right now the code for the menu looks like this: > %li > != "#{link_to("Home", "/")} | " > %li > != "#{link_to("About", "about")} | " > %li > != "#{link_to("Submit Data", new_raw_data_set_path)} | " > %li > != "#{link_to("Search", search_path)} | " > %li > != "#{link_to("Browse", raw_data_sets_path)}" > > As you can see, I have had to embed ruby in a string, and escape the > HTML to produce a pipe character between each menu item. Is there a > better way I can do this? I keep getting tripped up by the fact that > HAML interprets the pipe as a signal for a multiline string when it > is not embedded in Ruby code like this. Thanks for your help. > > -- > You received this message because you are subscribed to the Google Groups > "Haml" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected] <haml%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/haml?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/haml?hl=en.
