On Wed, Aug 15, 2001 at 02:55:03PM +0100, Andrew McFarland wrote:
> Anyone any suggestions as to why html_para works but the above filter 
> doesn't? I populated the database through a web based form using IE on 
> Windows 98. The web server, database, perl and templates are all on the one 
> Sun OS 5.6 machine.

Ah, the problem is that Windows uses "\r\n" as a line separator, 
instead of "\n".

The second problem is that TT doesn't recognise and expand "\r" as 
a character sequence.  This is a bug which you can fix by changing 
line ~501 in Template/Parser.pm from

  $token =~ s/\\([^\$n])/$1/g;

to

  $token =~ s/\\([^\$nr])/$1/g;

Then you can write

  [% FILTER replace("(\r\n){2,}", '</p><p>') %]

or without having to patch anything, you can do something like:

  [% FILTER replace("(.\n){2,}", '</p><p>') %]

but that is likely to break things if your input text is Unix-like
(i.e. matching the last valid character on a line).

I've patched the distribution source and I'll put a snapshot up on the 
web site RSN.

HTH
A



Reply via email to