mhonarc-commits
[Top] [All Lists]

CVS: mhonarc/MHonArc/lib iso2022jp.pl,1.7,1.8

2002-07-30 11:20:52
Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv18179

Modified Files:
	iso2022jp.pl 
Log Message:
* Applied Takashi P.KATOH's patch for clip function to support
  $has_tag flag as defined by TEXTCLIPFUNC resource.


Index: iso2022jp.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/iso2022jp.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** iso2022jp.pl	28 Jul 2002 23:21:53 -0000	1.7
--- iso2022jp.pl	30 Jul 2002 18:20:46 -0000	1.8
***************
*** 123,137 ****
  
  ##---------------------------------------------------------------------------##
! ##	clip($str, $length, $html): Clip an iso-2022-jp string.
  ##
! ##   The last argument $html specifies '&' should be treated
  ##   as HTML character or not.
! ##   (i.e., the length of '&' will be 1 if $html).
  ##
! sub clip {	# &clip($str, 10, 1);
      my($str) = shift;
      my($length) = shift;
!     my($html) = shift;
!     my($tags) = shift;	# Not implemented, yet
      my($ret, $inascii);
      local($_) = $str;
--- 123,137 ----
  
  ##---------------------------------------------------------------------------##
! ##	clip($str, $length, $is_html, $has_tags): Clip an iso-2022-jp string.
  ##
! ##   The last argument $is_html specifies '&' should be treated
  ##   as HTML character or not.
! ##   (i.e., the length of '&' will be 1 if $is_html).
  ##
! sub clip {	# &clip($str, 10, 1, 1);
      my($str) = shift;
      my($length) = shift;
!     my($is_html) = shift;
!     my($has_tags) = shift;
      my($ret, $inascii);
      local($_) = $str;
***************
*** 148,162 ****
  	    while(1) {
  		if (s/^([^\033])//) {      # ASCII plain text
! 		    if ($html) {
! 			if ($1 eq '&') {
! 			    s/^([^\;]*\;)//;
! 			    $ret .= "&$1";
  			} else {
! 			    $ret .= $1;
  			}
  		    } else {
  			$ret .= $1;
  		    }
- 		    $length--;
  		} elsif (s/(\033\.[A-F])//) { # G2 Designate Sequence
  		    $ret .= $1;
--- 148,167 ----
  	    while(1) {
  		if (s/^([^\033])//) {      # ASCII plain text
! 		    if ($is_html) {
! 			if (($1 eq '<') && $has_tags) {
! 			    s/^[^>\033]*>//;
  			} else {
! 			    if ($1 eq '&') {
! 				s/^([^\;]*\;)//;
! 				$ret .= "&$1";
! 			    } else {
! 				$ret .= $1;
! 			    }
! 			    $length--;
  			}
  		    } else {
  			$ret .= $1;
+ 			$length--;
  		    }
  		} elsif (s/(\033\.[A-F])//) { # G2 Designate Sequence
  		    $ret .= $1;
***************
*** 175,178 ****
--- 180,185 ----
  		if (s/^([!-~][!-~])//) { # Double Char plain text
  		    $ret .= $1;
+ 		    # The length of a double-byte-char is assumed 2.
+ 		    # If we consider compatibility with UTF-8, it should be 1.
  		    $length -= 2;
  		} elsif (s/(\033\.[A-F])//) { # G2 Designate Sequence

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