I fixed the problem by stringing the replace statements (which I didn't know
I could do, but just seemed like the Right thing to do)
ie:

[% MACRO unescape(text)
text.replace('{b}', '<b>').replace('{/b}', '</b>').replace('{i}',
'<i>').replace('{/i}', '</i>').etc..
%]

As you can see I am creating a small "text editor" for textareas so users
can have "rich text" like bold, and Italics while I still am using the
CGI.pm's escapseHTML subroutine, to eliminate unwanted HTML. I restrict it
to only bold, italic, underline, and hyperlink. No other HTML will be
"translated". Javascript, perl, and TT ROCK!!

Thanks guys!!



On Mon, May 19, 2008 at 12:02 PM, Larry Leszczynski <[EMAIL PROTECTED]>
wrote:

> Hi Kelly -
>
> On Sun, 18 May 2008, Kelly Thompson wrote:
>
>  I am trying to create a MACRO that will replace a lot of values within a
>> databased variable. What I have now is this in my "config" template.
>>
>
> Your macro is multiple lines, try enclosing in a BLOCK, e.g.:
>
>  [% MACRO unescape(text) BLOCK;
>  text.replace('\r', '<br />');
>  text.replace('{b}', '<b>');
>  text.replace('{/b}', '</b>');
>  END;
>  %]
>
> HTH,
> Larry
>
> Also just FYI, a more informative email subject (e.g. "Problem with MACRO
> definition") would be helpful to other list menbers.
>
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to