Re: Format=flowed

2002-10-28 19:47:23
I've just checked-in the newer version into CVS.  Feel free to
to try it out to see if it works with your data.

Single line paragraphs are ambiguous as to whether they are fixed or flowed. I 
think that it is a little startling to have a fixed-width font line in between 
two variable-width paragraphs. Granted, it's not a capital crime, but it is 
less than ideal.

It also seems that your latest code has a bug. It does not show a blank line 
between two flowed paragraphs.

I agree on both those comments, and have attached some modifications that resolve the issues. To see the difference, please compare, converted with revision 2.25 of, with, converted with my (latest) modified version.

Also, I noticed that v2.25 never converts to more than one blank line. I think that 2 or 3 blank lines between paragraphs should be recognized, since the use of additional blank lines may be part of a message's disposition. The attached code takes care of that as well.

I've also played with a new CPAN module, Text::Flowed, and I attach a variant which makes use of that module. I'm not sure that it is an appropriate way to handle messages when converting to HTML, but you guys may want to check it out.

/ Gunnar
CVS diff Format=Flowed modifications (compared to v2.25)
< $EndFlowedQuote   = "</blockquote>";
$EndFlowedQuote   = "</blockquote>\n";
              $chunk =~ s/\r?\n/\n/g;

              # recognize up to 3 blank lines between (flowed) paragraphs
              $chunk =~ s/\s+$//;
              $chunk =~ s/\n([\t ]*\n){3,}/\n\n<br>\n<br>\n\n/g;
              $chunk =~ s/\n([\t ]*\n){2}/\n\n<br>\n\n/g;
                      $para = "$para\n<br>";
<                       } else {
<                           $para = '<pre>' . $para . '</pre>';
                      } elsif ($para !~ /<br>/) {
                          $para =~ s/^\n//;
                          my @lines = split (/\n/, $para);
                          if (scalar @lines > 1) {
                              $para = '<pre>' . $para . '</pre>';
                          } else {
                              $para .= "<br>\n<br>";
<                   $chunk .= $para;
                  $chunk .= "$para\n";
<       $ret =~ s/<br><\/blockquote>/<\/blockquote>/g;
<       $ret =~ s/<\/blockquote><br>/<\/blockquote>/g;
      $ret =~ s/<br>\n?(<\/?blockquote)/$1/g;
      $ret =~ s/(<\/blockquote>)\n?<br>/$1/g;
      $ret =~ s/<br>\n?(<pre>)/$1/g;

Description: Zip compressed data

Description: Zip compressed data

<Prev in Thread] Current Thread [Next in Thread>