Changeset 194

Show
Ignore:
Timestamp:
03/18/06 13:32:30 (3 years ago)
Author:
ogawa
Message:

Now Mapper plugin supports an extra string for annotating the address information.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Mapper/trunk/Mapper.pl

    r192 r194  
    1818 
    1919sub BEGIN { 
    20     $VERSION = '0.10'; 
     20    $VERSION = '0.11'; 
    2121    my $plugin = MT::Plugin::Mapper->new({ 
    2222        name => 'Mapper', 
     
    9191    my $this = shift; 
    9292    my($s) = @_; 
    93     my($adr, $opt) = split(/:/, $s); 
     93    $s =~ s/^\s+//; 
     94    $s =~ s/\s+$//; 
     95    my($str, $opt) = split(/:/, $s); 
     96    my $adr = $str; 
     97    $adr =~ s/\(.*\)//ge; 
    9498    $adr =~ s/^\s+//; 
    9599    $adr =~ s/\s+$//; 
    96     my ($lat, $lon); 
     100 
     101    my($lat, $lon); 
    97102    if ($adr =~ m!^x([-.\d]+)y([-.\d]+)$!) {            # map:x<lon>y<lat> 
    98103        ($lat, $lon) = ($2, $1); 
     
    105110    my $res = ''; 
    106111    $res .= $this->preamble unless $this->{count}; 
    107     $res .= $this->body($lat, $lon, $adr); 
     112    $res .= $this->body($lat, $lon, $str); 
    108113    $this->{count}++; 
    109114    $res; 
     
    224229    $s =~ s/\s+$//; 
    225230    my($str, $opt) = split(/:/, $s); 
     231    my $adr = $str; 
     232    $adr =~ s/\(.*\)//ge; 
     233    $adr =~ s/^\s+//; 
     234    $adr =~ s/\s+$//; 
    226235 
    227236    my $pos = ''; 
    228     if ($str =~ m!^x([-.\d]+)y([-.\d]+)$!) {          # map:x<lon>y<lat> 
     237    if ($adr =~ m!^x([-.\d]+)y([-.\d]+)$!) {          # map:x<lon>y<lat> 
    229238        $pos = "$2,$1"; 
    230     } elsif ($str =~ m!^([-.\d]+),\s*([-.\d]+)$!) {   # map:<lat>,<lon> 
    231         $pos = $str; 
     239    } elsif ($adr =~ m!^([-.\d]+),\s*([-.\d]+)$!) {   # map:<lat>,<lon> 
     240        $pos = $adr; 
    232241    } 
    233242    if ($pos) { 
     
    235244    } 
    236245 
    237     my $adr = MT::I18N::encode_text($str, '', 'euc-jp') || ''; 
     246    $adr = MT::I18N::encode_text($adr, '', 'euc-jp') || ''; 
    238247    $adr = MT::Util::encode_url($adr); 
    239248    qq[<p><a target="_blank" href="http://clip.alpslab.jp/bin/rd?adr=$adr"><img class="alpslab-clip" src="http://clip.alpslab.jp/bin/map?adr=$adr&amp;opt=$opt" alt="$str" title="$str" /></a></p>];