[Templates] indent-ing and formatted text (<textarea> / <pre>)

Robin Smidsrød robin@smidsrod.no
Sun, 10 Jun 2007 10:09:29 +0200


Nathaniel Nuss wrote:
> I'm WRAPPER-ing a series of templates and applying the indent filter to
> content at each level. I have in the initial/deepest template a (usually)
> multi-line <textarea>[% sometext %]</textarea>.
> [SNIP]
> Any suggestions on how I could have my cake and ... ?
>   

TEXTAREA is troublesome, because browsers handle whitespace and newline 
a little bit different. If you want to make sure the content of the 
textarea doesn't include something odd, make sure <textarea> and 
</textarea> is on the same line in your source (some browsers convert \n 
inside the block to space), and use this way to include your content 
<textarea>[%- sometext -%]</textarea>, as it avoids any linewrapping of 
the content.

This will of course mess up your indenting in the HTML code, but AFAIK 
it's the only way to produce the correct content in the textarea.

-- Robin