That reference page is massively out-of-date. I'm surprised it still 
exists (it doesn't anymore). The up-to-date reference is at 
http://haml.hamptoncatlin.com/docs/haml.

Anyway, that behavior of ~ was removed because it was obsoleted by 
filter functionality. What you want is

!!! Strict
%html
  %head
    %title= "[EMAIL PROTECTED] - My Site"
    :preserve
      <link rel="stylesheet" href="/css/blueprint/screen.css" type="text/css" 
media="screen, projection"/>
      <link rel="stylesheet" href="/css/blueprint/print.css" type="text/css" 
media="print"/>
      <!--[if IE]>
      <link rel="stylesheet" href="css/blueprint/lib/ie.css" type="text/css" 
media="screen, projection"/>
      <link rel="stylesheet" href="css/homepage_ie.css" type="text/css" 
media="screen, projection"/>
      <![endif]-->
      <link rel="stylesheet" href="/css/homepage.css" type="text/css" 
media="screen, projection"/>
  %body


This'll make for some pretty messy-looking source, though. I encourage 
you to make the transition to Haml.

- Nathan

Adam Salter wrote:
> OK, that certainly did the trick, although it seems to go against what
> my conception of ~ should to (ie anything output should have no
> indentation fiddling _whatsoever_)... but I've got another doozy:
>
> !!! Strict
> %html
>   %head
>     %title= "[EMAIL PROTECTED] - My Site"
>     ~
>       <link rel="stylesheet" href="/css/blueprint/screen.css"
> type="text/css" media="screen, projection"/>
>       <link rel="stylesheet" href="/css/blueprint/print.css"
> type="text/css" media="print"/>
>       <!--[if IE]>
>       <link rel="stylesheet" href="css/blueprint/lib/ie.css"
> type="text/css" media="screen, projection"/>
>       <link rel="stylesheet" href="css/homepage_ie.css" type="text/
> css" media="screen, projection"/>
>       <![endif]-->
>       <link rel="stylesheet" href="/css/homepage.css" type="text/css"
> media="screen, projection"/>
>   %body
>
> According to this page:
> http://haml.hamptoncatlin.com/reference
> "If the ~ character isn't followed by text, it doesn't evaluate Ruby
> at all. Instead, an indented section following it will be rendered in
> a whitespace-sensitive manner, using HTML encodings for newlines"
>
> I want to just cut and paste the information from another site (yes I
> could go through and translate to haml, but i want to do it this
> way... but i get an error "Tag has no content" on the latest Haml gem.
>
> Any suggestions on what I'm doing wrong?
>
> On Feb 15, 5:32 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
>   
>> ~ works as a replacement for = that runs the find_and_preserve helper,
>> which replaces newlines in textareas with the HTML newline escape char.
>> It doesn't do anything if the text doesn't contain a <textarea> (or
>> similar whitespace-preserving) tag. If you want to preserve a manually
>> generated textarea, call find_and_preserve helper manually and pass it a
>> block:
>>
>>   = find_and_preserve do
>>     %textarea= stuff
>>
>> - Nathan
>>
>> Adam Salter wrote:
>>     
>>> Hey all,
>>> Trying to do a html textarea from Rails, but for reasons its too
>>> difficult to explain I've decided to do it by hand... anyway here's my
>>> sample code...
>>>       
>>> %form{ :method => :post, :action => contact_us_path }
>>>   %label{ :for => :comments }
>>>     Your Comments
>>>   %textarea{ :name => :comments, :style => "width: 350px; height:
>>> 200px;" }
>>>     ~ @comments
>>>       
>>> Looks ok right?
>>> Problem is that the comments text-area text gets successively indented
>>> on multiple passes.
>>>       
>>> I understand that the ~ is supposed to remove/ignore indenting, but
>>> it's not working. Just wondering what I'm doing wrong?
>>>       
>>> Thanks,
>>> -Adam
>>>       
> >
>
>   


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