|
List Info
Thread: Textareas and indentation
|
|
| Textareas and indentation |
  United States |
2007-04-05 09:31:40 |
Hello,
I have a quite serious problem with textareas and haml.
Version is
trunk (1.6.0). Consider the following:
textarea_layout.haml
%div
= content_for_layout
textarea.haml
= text_area_tag "foo", "barnbarnbar"
renders to:
<div>
<textarea id="foo"
name="foo">bar
bar
bar</textarea>
</div>
As you can see, the content of the textarea is indented,
resulting in
leading whitespaces in each line of the textarea. This is
not the case
if I replace the n newlines with r carriage returns
("barrbar
rbar").
I would really appreciate any input!
Andi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Textareas and indentation |
  United States |
2007-04-05 13:07:17 |
There're two helpers available to deal with this. They both
work by
replacing newlines with the HTML character code for a
newline, thus
avoiding Haml's auto-indentation while keeping the output
relatively
nice-looking. The first is called "preserve",
which just replaces all
newlines. The second is called
"find_and_preserve", which replaces all
newlines within whitespace sensitive tags, like pre and
textarea. So,
for example, you could do:
= find_and_preserve text_area_tag("foo",
"barnbarnbar")
There's also a shortcut for "= find_and_preserve":
the ~ character.
~ text_area_tag "foo", "barnbarnbar"
Hope that helps!
- Nathan
ridcully wrote:
> Hello,
>
> I have a quite serious problem with textareas and haml.
Version is
> trunk (1.6.0). Consider the following:
>
> textarea_layout.haml
>
> %div
> = content_for_layout
>
>
> textarea.haml
>
> = text_area_tag "foo",
"barnbarnbar"
>
>
> renders to:
>
> <div>
> <textarea id="foo"
name="foo">bar
> bar
> bar</textarea>
> </div>
>
> As you can see, the content of the textarea is
indented, resulting in
> leading whitespaces in each line of the textarea. This
is not the case
> if I replace the n newlines with r carriage returns
("barrbar
> rbar").
>
> I would really appreciate any input!
>
> Andi
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Textareas and indentation |
  United States |
2007-04-06 07:05:04 |
Thank you, I'll look into this.
My problem is that the templates containing the text_areas
are RHTML,
so I don't have the preserve helper method available there.
But I
would have converted them anyway, so I'll just do it now.
Andi
On Apr 5, 8:07 pm, Nathan Weizenbaum <nex... gmail.com> wrote:
> There're two helpers available to deal with this. They
both work by
> replacing newlines with the HTML character code for a
newline, thus
> avoiding Haml's auto-indentation while keeping the
output relatively
> nice-looking. The first is called "preserve",
which just replaces all
> newlines. The second is called
"find_and_preserve", which replaces all
> newlines within whitespace sensitive tags, like pre and
textarea. So,
> for example, you could do:
>
> = find_and_preserve text_area_tag("foo",
"barnbarnbar")
>
> There's also a shortcut for "=
find_and_preserve": the ~ character.
>
> ~ text_area_tag "foo",
"barnbarnbar"
>
> Hope that helps!
> - Nathan
>
> ridcully wrote:
> > Hello,
>
> > I have a quite serious problem with textareas and
haml. Version is
> > trunk (1.6.0). Consider the following:
>
> > textarea_layout.haml
>
> > %div
> > = content_for_layout
>
> > textarea.haml
>
> > = text_area_tag "foo",
"barnbarnbar"
>
> > renders to:
>
> > <div>
> > <textarea id="foo"
name="foo">bar
> > bar
> > bar</textarea>
> > </div>
>
> > As you can see, the content of the textarea is
indented, resulting in
> > leading whitespaces in each line of the textarea.
This is not the case
> > if I replace the n newlines with r carriage
returns ("barrbar
> > rbar").
>
> > I would really appreciate any input!
>
> > Andi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Textareas and indentation |

|
2007-04-06 11:09:39 |
You can actually put the ~ around the partial, and it will
search
inside of there
~ render :partial =>
"my_rhtml_partial_with_textareas"
On 4/6/07, ridcully <google ridcully.net> wrote:
>
> Thank you, I'll look into this.
>
> My problem is that the templates containing the
text_areas are RHTML,
> so I don't have the preserve helper method available
there. But I
> would have converted them anyway, so I'll just do it
now.
>
> Andi
>
> On Apr 5, 8:07 pm, Nathan Weizenbaum <nex... gmail.com> wrote:
> > There're two helpers available to deal with this.
They both work by
> > replacing newlines with the HTML character code
for a newline, thus
> > avoiding Haml's auto-indentation while keeping the
output relatively
> > nice-looking. The first is called
"preserve", which just replaces all
> > newlines. The second is called
"find_and_preserve", which replaces all
> > newlines within whitespace sensitive tags, like
pre and textarea. So,
> > for example, you could do:
> >
> > = find_and_preserve text_area_tag("foo",
"barnbarnbar")
> >
> > There's also a shortcut for "=
find_and_preserve": the ~ character.
> >
> > ~ text_area_tag "foo",
"barnbarnbar"
> >
> > Hope that helps!
> > - Nathan
> >
> > ridcully wrote:
> > > Hello,
> >
> > > I have a quite serious problem with textareas
and haml. Version is
> > > trunk (1.6.0). Consider the following:
> >
> > > textarea_layout.haml
> >
> > > %div
> > > = content_for_layout
> >
> > > textarea.haml
> >
> > > = text_area_tag "foo",
"barnbarnbar"
> >
> > > renders to:
> >
> > > <div>
> > > <textarea id="foo"
name="foo">bar
> > > bar
> > > bar</textarea>
> > > </div>
> >
> > > As you can see, the content of the textarea
is indented, resulting in
> > > leading whitespaces in each line of the
textarea. This is not the case
> > > if I replace the n newlines with r carriage
returns ("barrbar
> > > rbar").
> >
> > > I would really appreciate any input!
> >
> > > Andi
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Haml" group.
To post to this group, send email to haml googlegroups.com
To unsubscribe from this group, send email to
haml-unsubscribe googlegroups.com
For more options, visit this group at http://grou
ps.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-4]
|
|