From: imiyazaki Date: Wed, 22 Oct 2003 17:00:25 +0000 (+0000) Subject: add $prefix and $suffix to entity reference in &de_er. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0d14956e6b4179eaa2f58b5b6398eb51d5c79f8;p=chise%2Fperl.git add $prefix and $suffix to entity reference in &de_er. --- diff --git a/Chise_utils/Chise_utils.pm b/Chise_utils/Chise_utils.pm index 1c2aca0..2f40e75 100644 --- a/Chise_utils/Chise_utils.pm +++ b/Chise_utils/Chise_utils.pm @@ -234,8 +234,11 @@ sub get_chars_for{ sub de_er{ my($er)=@_; my($output_char,$atr,$value); + my($prefix,$suffix); + $er=~/^(amp|&)?(.+?)(;)?$/ + and $prefix=$1,$er=$2,$suffix=$3; + $prefix or $prefix="",$suffix or $suffix=""; if($er=~/^\d+$/){ - # only for debug. $output_char=pack("U",$er); }elsif($er=~/^U[\+\-]([a-fA-F\d]+)/){ $output_char=pack("U",hex($1)); @@ -247,9 +250,9 @@ sub de_er{ ($output_char)=&get_chars_matching($er_alias{$atr},$value); } if($output_char){ - return $output_char; + return $output_char; }else{ - return $er; + return $prefix.$er.$suffix; } }