For the first problem, I'd recommend using preserve along with the Rails 
"text_area_tag" helper, like so:

= preserve text_area_tag('blablabla', 'The very very long line ...')


For the second example, the best solution would be to manually add in 
the strong tag, perhaps along with a link_to helper, like so:

= succeed ',' do
  %a{:href => 'http://somewhere'} <strong>Somewhere</strong>

or

= link_to('<strong>Somewhere</strong>', 'http://somewhere')


Tags that can't have inner whitespace is definitely a problem with Haml 
as-is. There'll be a way to force it not to add whitespace in version 
2.0, but as of yet it's unavailable.

- Nathan

Dmitry Root wrote:
> Hello,
>
> I use HAML in my project, and today I found two problems in it.
>
> The first problem is whitespace-sencitive tags, like textarea or pre, and 
> indentation.
> Haml::Helpers module provides 'preserve' function to change newlines into 
> HTML 
> codes. But what is the correct way not to indent the very first line of the 
> text?
> For example:
>
> %textarea{:name => 'blablabla'}= preserve('The very very long line ...')
>
> Produced code:
>
> <textarea name='blablabla'>
>   The very very long line ...
> </textarea>
>
> and I will see the first text line with some spaces.
>
>
> The second problem is unnecessary spaces in text. For example, I need a link, 
> then a comma and then some text after it.
>
> Haml::Helpers provides a solution in 'succeed' function, that works in simple 
> cases. But suppose the code:
>
> = succeed ',' do
>   %a{:href => 'http://somewhere'}
>     %strong Somewhere
>
> Generated code:
>
> <a href='http://somewhere'>
>   <strong>Somewhere</strong>
> </a>,
>
> and I will see the space between the link and comma.
>
>
> P.S. I use Gentoo Linux with up-to-date portage tree, and development version 
> of rails.
>
> Ruby 1.8.6
> Rails 1.2.3
> HAML 1.5.2
>
>   


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