From: Chris N. <pu...@po...> - 2001-02-12 16:28:42
|
OK, some of you may know about POST_CHOMP and PRE_CHOM and TRIM. POST_CHOMP and PRE_CHOMP allow you to automatically remove newlines and whitespace between text and directives, so if both are true (as they are in Slash), this: [% FOREACH user = userlist %] [% user %] [% END %] will be rendered as: [% FOREACH user = userlist %][% user %][% END %] You can de-activate this with "+", so this: [% FOREACH user = userlist %] [%+ user +%] [% END %] Will get treated just like this: [% FOREACH user = userlist %] [% user %] [% END %] Similarly, there is TRIM. This removes leading and trailing whitespace from the output of templates and BLOCKs. This is also on in Slash. I mention this because the behavior of POST_CHOMP and PRE_CHOMP are such that it only works on [ \t\n]. But most of our templates have had "\r" in them, as well, so it was not working properly. I have added code to Slash::Display::Provider to convert CRLF to LF before the template is compiled, so you may now see some slight changes in the output of templates, especially in regard to leading and trailing newlines. This is a similar issue to the previous one; it makes me think that we probably should NOT bother to do "s/\n/\015\012/g" on templates being saved TO the database from files. But if we do, it is not a big deal, because they'll just be stripped before they are compiled. -- Chris Nandor pu...@po... http://pudge.net/ Open Source Development Network pu...@os... http://osdn.com/ |