mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhtxtplain.pl,2.28,2.29

2002-11-03 00:54:21
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv19665

Modified Files:
	mhtxtplain.pl 
Log Message:
* maxwidth applied to pre-formatted chunks of flowed data.
* fixed html_length() to work around subtle Perl behavior with backreferences
  in nested scoped patterns.


Index: mhtxtplain.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxtplain.pl,v
retrieving revision 2.28
retrieving revision 2.29
diff -C2 -r2.28 -r2.29
*** mhtxtplain.pl	2 Nov 2002 20:25:56 -0000	2.28
--- mhtxtplain.pl	3 Nov 2002 07:54:13 -0000	2.29
***************
*** 312,324 ****
      }
  
-     ## Check if max-width set
-     if ($maxwidth && $textformat eq 'fixed') {
- 	$$data =~ s/^(.*)$/&break_line($1, $maxwidth)/gem;
-     }
- 
      ## Fixup any EOL mess
      $$data =~ s/\r?\n/\n/g;
      $$data =~ s/\r/\n/g;
  
      ## Convert data according to charset
      if (!$asis{$charset}) {
--- 312,324 ----
      }
  
      ## Fixup any EOL mess
      $$data =~ s/\r?\n/\n/g;
      $$data =~ s/\r/\n/g;
  
+     ## Check if max-width set
+     if (($maxwidth > 0) && ($quote_style != Q_FLOWED)) {
+ 	$$data =~ s/^(.*)$/&break_line($1, $maxwidth)/gem;
+     }
+ 
      ## Convert data according to charset
      if (!$asis{$charset}) {
***************
*** 383,386 ****
--- 383,391 ----
  		    } else {
  			# fixed format
+ 			$para =~ s/^(.*)$
+ 				  /&break_line($1,
+ 				      $maxwidth+(length($1)-&html_length($1)))
+ 				  /gemx
+ 			    if $maxwidth > 0;
  			if ($nonfixed) {
  			    $para =~ s/(\n)/<br>$1/g;
***************
*** 532,538 ****
  
      ## See if str begins with a quote char
!     if ($str =~ s/^( ?$QuoteChars)//o) {
  	$q = $1;
! 	--$width;
      }
  
--- 537,543 ----
  
      ## See if str begins with a quote char
!     if ($str =~ s/^([ ]?(?:$QuoteChars[ ]?)+)//o) {
  	$q = $1;
! 	$width -= length($q);
      }
  
***************
*** 572,578 ****
  
  sub html_length {
      my $len = length($_[0]);
!     while ($_[0] =~ /(\&[^;]+);/g) {
! 	$len -= length($1);
      }
      $len;
--- 577,584 ----
  
  sub html_length {
+     local $_;
      my $len = length($_[0]);
!     foreach ($_[0] =~ /(\&[^;]+);/g) {
! 	$len -= length($_);
      }
      $len;

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV