mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib mhtxtenrich.pl,2.5,2.6

2002-10-26 20:08:53
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv13806

Modified Files:
	mhtxtenrich.pl 
Log Message:
* Map <flushboth> to <p align="justify">.
* All HTML tag names converted to lowercase.
* This filter needs to be updated to handle charsets better, but unsure
  if it is worth the effort.  Who uses text/enriched anymore?


Index: mhtxtenrich.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/mhtxtenrich.pl,v
retrieving revision 2.5
retrieving revision 2.6
diff -C2 -r2.5 -r2.6
*** mhtxtenrich.pl	25 Aug 2001 19:57:59 -0000	2.5
--- mhtxtenrich.pl	27 Oct 2002 03:08:17 -0000	2.6
***************
*** 11,21 ****
  ##
  ##	    <MIMEFILTERS>
! ##	    text/enriched:m2h_text_enriched'filter:mhtxtenrich.pl
! ##	    text/richtext:m2h_text_enriched'filter:mhtxtenrich.pl
  ##	    </MIMEFILTERS>
  ##
  ##---------------------------------------------------------------------------##
  ##    MHonArc -- Internet mail-to-HTML converter
! ##    Copyright (C) 1997-2001	Earl Hood, mhonarc(_at_)mhonarc(_dot_)org
  ##
  ##    This program is free software; you can redistribute it and/or modify
--- 11,21 ----
  ##
  ##	    <MIMEFILTERS>
! ##	    text/enriched;m2h_text_enriched::filter;mhtxtenrich.pl
! ##	    text/richtext;m2h_text_enriched::filter;mhtxtenrich.pl
  ##	    </MIMEFILTERS>
  ##
  ##---------------------------------------------------------------------------##
  ##    MHonArc -- Internet mail-to-HTML converter
! ##    Copyright (C) 1997-2002	Earl Hood, mhonarc(_at_)mhonarc(_dot_)org
  ##
  ##    This program is free software; you can redistribute it and/or modify
***************
*** 39,42 ****
--- 39,44 ----
  ##---------------------------------------------------------------------------
  ##	Filter routine.
+ ##	XXX: Need to update this filter.  However, does anyone still use
+ ##	     text/enriched anymore.
  ##
  sub filter {
***************
*** 48,55 ****
  
      ## Grab charset parameter (if defined)
!     $ctype = $fields->{'content-type'}[0] || "";
!     if ($ctype =~ /charset=(\S+)/) {
  	$charset = lc $1;
! 	$charset =~ s/['"]//g;
      }
  
--- 50,57 ----
  
      ## Grab charset parameter (if defined)
!     if ((defined($fields->{'content-type'}[0])) &&
! 	($fields->{'content-type'}[0] =~ /\bcharset\s*=\s*([^\s;]+)/i) ) {
  	$charset = lc $1;
! 	$charset =~ s/['";\s]//g;
      }
  
***************
*** 62,71 ****
      foreach $chunk (split(m|(</?nofill>)|i, $$data)) {
  	if ($chunk =~ m|<nofill>|i) {
! 	    $ret .= "<PRE>";
  	    $innofill = 1;
  	    next;
  	}
  	if ($chunk =~ m|</nofill>|i) {
! 	    $ret .= "</PRE>";
  	    $innofill = 0;
  	    next;
--- 64,73 ----
      foreach $chunk (split(m|(</?nofill>)|i, $$data)) {
  	if ($chunk =~ m|<nofill>|i) {
! 	    $ret .= '<pre>';
  	    $innofill = 1;
  	    next;
  	}
  	if ($chunk =~ m|</nofill>|i) {
! 	    $ret .= '</pre>';
  	    $innofill = 0;
  	    next;
***************
*** 94,121 ****
      my($str) = shift;
  
!     $$str =~ s|<(/?)bold>|<$1B>|gi;
!     $$str =~ s|<(/?)italic>|<$1I>|gi;
!     $$str =~ s|<(/?)underline>|<$1U>|gi;
!     $$str =~ s|<(/?)fixed>|<$1TT>|gi;
!     $$str =~ s|<(/?)smaller>|<$1SMALL>|gi;
!     $$str =~ s|<(/?)bigger>|<$1BIG>|gi;
! 
!     $$str =~ s|<fontfamily>\s*<param>([^<]+)</param>|<FONT face="$1">|gi;
!     $$str =~ s|</fontfamily>|</FONT>|gi;
!     $$str =~ s|<color>\s*<param>\s*(\S+)\s*</param>|<FONT color="$1">|gi;
!     $$str =~ s|</color>|</FONT>|gi;
!     $$str =~ s|<center>|<P align="center">|gi;
!     $$str =~ s|</center>|</P>|gi;
!     $$str =~ s|<flushleft>|<P align="left">|gi;
!     $$str =~ s|</flushleft>|</P>|gi;
!     $$str =~ s|<flushright>|<P align="right">|gi;
!     $$str =~ s|</flushright>|</P>|gi;
!     $$str =~ s|<flushboth>|<P align="both">|gi;	# Not supported in HTML
!     $$str =~ s|</flushboth>|</P>|gi;
!     $$str =~ s|<paraindent>\s*<param>([^<]*)</param>|<BLOCKQUOTE>|gi;
!     $$str =~ s|</paraindent>|</BLOCKQUOTE>|gi;
  
!     $$str =~ s|<excerpt>\s*(<param>([^<]*)</param>)?|<BLOCKQUOTE>|gi;
!     $$str =~ s|</excerpt>|</BLOCKQUOTE>|gi;
  
      # Not supported commands
--- 96,123 ----
      my($str) = shift;
  
!     $$str =~ s|<(/?)bold>|<$1b>|gi;
!     $$str =~ s|<(/?)italic>|<$1i>|gi;
!     $$str =~ s|<(/?)underline>|<$1u>|gi;
!     $$str =~ s|<(/?)fixed>|<$1tt>|gi;
!     $$str =~ s|<(/?)smaller>|<$1small>|gi;
!     $$str =~ s|<(/?)bigger>|<$1big>|gi;
! 
!     $$str =~ s|<fontfamily>\s*<param>([^<]+)</param>|<font face="$1">|gi;
!     $$str =~ s|</fontfamily>|</font>|gi;
!     $$str =~ s|<color>\s*<param>\s*(\S+)\s*</param>|<font color="$1">|gi;
!     $$str =~ s|</color>|</font>|gi;
!     $$str =~ s|<center>|<p align="center">|gi;
!     $$str =~ s|</center>|</p>|gi;
!     $$str =~ s|<flushleft>|<p align="left">|gi;
!     $$str =~ s|</flushleft>|</p>|gi;
!     $$str =~ s|<flushright>|<p align="right">|gi;
!     $$str =~ s|</flushright>|</p>|gi;
!     $$str =~ s|<flushboth>|<p align="justify">|gi;
!     $$str =~ s|</flushboth>|</p>|gi;
!     $$str =~ s|<paraindent>\s*<param>([^<]*)</param>|<blockquote>|gi;
!     $$str =~ s|</paraindent>|</blockquote>|gi;
  
!     $$str =~ s|<excerpt>\s*(<param>([^<]*)</param>)?|<blockquote>|gi;
!     $$str =~ s|</excerpt>|</blockquote>|gi;
  
      # Not supported commands
***************
*** 126,130 ****
  ##---------------------------------------------------------------------------
  ##	nl_seq_to_brs returns a "<BR>" string based on the number
! ##	on eols in a string.
  ##
  sub nl_seq_to_brs {
--- 128,132 ----
  ##---------------------------------------------------------------------------
  ##	nl_seq_to_brs returns a "<BR>" string based on the number
! ##	of eols in a string.
  ##
  sub nl_seq_to_brs {

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