Wasn't there a push a while back to have a HTML::Template::Filter class that would have commonly used filters?
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mark A. Fuller Sent: Wednesday, February 08, 2006 4:30 PM To: Alex Teslik; html-template-users@lists.sourceforge.net Subject: Re: [htmltmpl] extra whitespace From: Alex Teslik <[EMAIL PROTECTED]> >Is there a switch (feature request?) that will tell HTMLTMPL to replace >a TMPL followed by [\n\r]+ with nothing - even better replace the whole >line if the only thing on the line is a TMPL tag? I raised this issue a year or two ago and it wasn't well-received. It seems like it's common for newcomers (as I was) to spot this and believe it's a shortcoming in H::T. Among experienced users, they believe it's easier and faster to use the "filter" option to strip *all* linefeeds if wasted bandwidth is your motivation to remove some. If the performance overhead of using the "filter" option is a concern, then preprocess your templates to load, filter and output them to another file which will be your template to be used at run-time. I do this for other reasons, like if there is common processing to be applied to parts of the page once. For example: international language substitution of headings, labels, etc. I use tags prefixed as "PREPROC-" in my *master* template to differentiate things that need to be preprocessed versus the tags that are dynamically set at run time. I use a batch script to load the template and "filter" the TMPL- tags to "HOLD-" tags, change the "PREPROC-" tags to "TMPL-" tags. I don't strip the linefeeds in this filter. I do my preprocessing to set TMPL-VARS and LOOPS as necessary for one-time initialization of the page (for example, language substitution). I output the H::T object to a variable and perform a regex on the variable to change all the "HOLD-" tags to "TMPL-" tags. This is where I strip the linefeeds. Then print this variable to a file which will be the template used at runtime. So, I have a master template (with includes, etc.) and a run-time template that needs no run-time processing except the actual variables that can change at run time (messages, dynamically generated lists, etc.). That's probably a much more complicated example than what you need just to strip linefeeds. The filter option will work for you. I just wanted to demonstrate that there's a lot of ways to solve a problem with H::T if you realize you're not stuck with just one preconceived way to use it. It took me awhile to get that through my head. In the end I agreed that it's superior to use features like I described above than to burden H::T with indicators about what is essentially formatting (retention or removal). Hope that helps. Mark ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642 _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users ------------------------------------------------------------------------------ This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. ---------- IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Html-template-users mailing list Html-template-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/html-template-users