mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhtxtenrich.pl,2.7,2.8 mhtxthtml.pl,2.28,2.29 mhtx...

2002-12-18 22:14:31
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv10527

Modified Files:
	mhtxtenrich.pl mhtxthtml.pl mhtxtplain.pl 
Log Message:
* Corrections to charset processing.
* Replace esc_chars_inplace() in mhtxtplain.pl with mhonarc::htmlize().
* mhtxthtml.pl explicitly removes meta tags.


Index: mhtxtenrich.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxtenrich.pl,v
retrieving revision 2.7
retrieving revision 2.8
diff -C2 -r2.7 -r2.8
*** mhtxtenrich.pl	18 Dec 2002 05:47:46 -0000	2.7
--- mhtxtenrich.pl	19 Dec 2002 05:14:23 -0000	2.8
***************
*** 59,66 ****
  	$$data = &$charcnv($$data, $real_charset_name);
      } else {
  	warn qq/\n/,
  	     qq/Warning: Unrecognized character set: $charset\n/,
  	     qq/         Message-Id: <$mhonarc::MHAmsgid>\n/,
! 	     qq/         Message Number: $mhonarc::MHAmsgnum\n/;
      }
      ## Fixup any EOL mess
--- 59,68 ----
  	$$data = &$charcnv($$data, $real_charset_name);
      } else {
+ 	mhonarc::htmlize($data);
  	warn qq/\n/,
  	     qq/Warning: Unrecognized character set: $charset\n/,
  	     qq/         Message-Id: <$mhonarc::MHAmsgid>\n/,
! 	     qq/         Message Number: $mhonarc::MHAmsgnum\n/
! 		unless ($charcnv eq '-decode-');
      }
      ## Fixup any EOL mess

Index: mhtxthtml.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxthtml.pl,v
retrieving revision 2.28
retrieving revision 2.29
diff -C2 -r2.28 -r2.29
*** mhtxthtml.pl	18 Dec 2002 05:47:46 -0000	2.28
--- mhtxthtml.pl	19 Dec 2002 05:14:23 -0000	2.29
***************
*** 50,53 ****
--- 50,54 ----
  	         q/dynsrc|for|href|longdesc|profile|src|url|usemap)\b/;
  
+ # Used to reverse the effects of CHARSETCONVERTERS
  my %special_to_char = (
      'lt'    => '<',
***************
*** 135,139 ****
      if (defined($charcnv) && defined(&$charcnv)) {
  	$$data = &$charcnv($$data, $real_charset_name);
!     } else {
  	warn qq/\n/,
  	     qq/Warning: Unrecognized character set: $charset\n/,
--- 136,142 ----
      if (defined($charcnv) && defined(&$charcnv)) {
  	$$data = &$charcnv($$data, $real_charset_name);
! 	# translate HTML specials back
! 	$$data =~ s/&([lg]t|amp|quot);/$special_to_char{$1}/g;
!     } elsif ($charcnv ne '-decode-') {
  	warn qq/\n/,
  	     qq/Warning: Unrecognized character set: $charset\n/,
***************
*** 141,146 ****
  	     qq/         Message Number: $mhonarc::MHAmsgnum\n/;
      }
-     # translate back HTML specials back
-     $$data =~ s/&([lg]t|amp|quot);/$special_to_char{$1}/g;
  
      ## Check comment declarations: may screw-up mhonarc processing
--- 144,147 ----
***************
*** 186,189 ****
--- 187,191 ----
      $$data =~ s|</?x-html\b[^>]*>||gio;
      $$data =~ s|<head\s*>[\s\S]*</head\s*>||io;
+     $$data =~ s|</?meta\b[^>]*>||io;
  
      ## Strip out style information if requested.

Index: mhtxtplain.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxtplain.pl,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -r2.34 -r2.35
*** mhtxtplain.pl	18 Dec 2002 05:47:46 -0000	2.34
--- mhtxtplain.pl	19 Dec 2002 05:14:23 -0000	2.35
***************
*** 329,337 ****
  		 qq/         Message-Id: <$mhonarc::MHAmsgid>\n/,
  		 qq/         Message Number: $mhonarc::MHAmsgnum\n/;
! 	    esc_chars_inplace($data);
  	}
  
      } else {
! 	esc_chars_inplace($data);
      }
  
--- 329,337 ----
  		 qq/         Message-Id: <$mhonarc::MHAmsgid>\n/,
  		 qq/         Message Number: $mhonarc::MHAmsgnum\n/;
! 	    mhonarc::htmlize($data);
  	}
  
      } else {
! 	mhonarc::htmlize($data);
      }
  
***************
*** 536,550 ****
      $$data = ' '  if $$data eq '';
      ($$data);
- }
- 
- ##---------------------------------------------------------------------------##
- 
- sub esc_chars_inplace {
-     my($foo) = shift;
-     $$foo =~ s/&/&amp;/g;
-     $$foo =~ s/</&lt;/g;
-     $$foo =~ s/>/&gt;/g;
-     $$foo =~ s/"/&quot;/g;
-     1;
  }
  
--- 536,539 ----

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