There are two ways you could do this. The first is to use the "==" syntax
for embedding Ruby in plan text:

  == #{link_to 'self-destruct now', :action => 'explode'}?

The second is to use the "succeed" helper, which appends text directly after
a chunk of Haml:

  = succeed '?' do
    = link_to 'self-destruct now', :action => 'explode'

or

  = succeed '?' { link_to 'self_destruct now', :action => 'explode' }

We're thinking about expanding the ability to suppress whitespace in Haml,
though, so if you have any suggestions for what sort of syntax would be
nice, that would be great.

- Nathan

On 4/19/07, Paul Dowman <[EMAIL PROTECTED]> wrote:
>
>
> Hi, I've just been using haml for a couple of days so this might be
> an RTFM (I did though).
>
> Is it possible to suppress the newline (and indentation whitespace)
> that's automatically output? The reason is that when mixing links and
> normal text it's nice to have the link on it's own line in the haml
> file so that I can just use '=' and then normal ruby link_to syntax
> (and then syntax highlighting works in eclipse).
>
> This automatically creates a space on either side of the link in the
> html because of the whitespace that's generated, which is OK unless I
> need some punctuation directly next to the link text.
>
> For example, this works well:
>
> Would you like to
> = link_to 'self-destruct', :action => 'explode'
> now?
>
> But this doesn't:
>
> Would you like to
> = link_to 'self-destruct now', :action => 'explode'
> ?
>
> Two slightly uglier alternatives are:
>
> Would you like to
> = "#{link_to 'self-destruct now', :action => 'explode'}?"
>
> or:
>
> Would you like to
> = (link_to 'self-destruct now', :action => 'explode'}) + "?"
>
> Maybe there's a better way to do this, any ideas?
>
> Thanks,
> Paul
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to