[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] interpolating



I'm generally for using Text::Template, but I must admit that I did this
kind of stuff for a very long time using the s/X([])X/$1/egis method.


I did this for a while using #TEXT# as my template pattern and then in a
clever moment switched to using HTML comments.

There are only 2 problems with HTML comments, at least in my workflow,
where I'd have clients doing the HTML, and I'd be writing the programs
doing the interpolation.

1) WYSIWYG HTML editors butcher comments mercilessly, so you need to be
able to handle random whitespace in your match pattern.

2) I used interpolations a lot for carrying <form> states from page to
page.  Unfortunately, <FORM_ELEMENT value="<!-- Interpolate_me -->"> is
completely evil HTML and WYSIWYG HTML editors will always replace the
brackets on the comments with entities, rendering your interpolation
dysfunctional.

Suprisingly, Netscape did render the page correctly, putting the comented
text into the visible form fields when you preview the unprocessed HTML
file.

Just something to watch out for...

good luck
eric


At 11:49 PM -0500 11.29.99, Nathaniel Irons wrote:
>On 11/29/99 at 8:08 PM, Nicholas.G.Thornton@directory.reed.edu (Nicholas
>G. Thornton) wrote:
>
>> I'm working on a project that uses html templates replacing comments
>> with the appropreate variable.
>
>Did you check CPAN first?  Text::Template is fast and Safe-savvy.
>
>  -nat
>
>
>
># ===== Want to unsubscribe from this list?
># ===== Send mail with body "unsubscribe" to macperl-request@macperl.org




------------------------------------------------------------------
Eric Fixler                                       v:1-415/401-8650
Tiferet Development                               f:1-415/401-8651

Perl | XML | Apache | Embedded Systems | Electronix | Java | Etc.
------------------------------------------------------------------



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org