Why not build all of this in a helper?
= build_nav(:home, :faq, :other)
def build_nav(*sections)
list = sections.collect do |section|
link_to section.to_s.titleize, eval("#{section}_url")
end
list.join(whitespace(4))
end
def whitespace(times = 1)
" " * times
end
-hampton.
On 2/6/07, Doug McBride <[EMAIL PROTECTED]> wrote:
>
>
> I know about surround and precede and succeed, but is there an
> elegant, easy-to-read way to express this ugly rhtml in haml, for when
> you really want to control the spacing?
>
> <%= link_to "Home", home_url %> / <%= link_to
> "FAQ", faq_url %> / <... etc. ...> /
> <%= link_to "Other", other_url %>
>
> I mean I can use Ruby in place to make a list of the link_to's and
> then use join " / " on them, or I can chain up a
> bunch of succeeds or something, but... ew.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---