Changeset 194
- Timestamp:
- 03/18/06 13:32:30 (3 years ago)
- Files:
-
- Mapper/trunk/Mapper.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Mapper/trunk/Mapper.pl
r192 r194 18 18 19 19 sub BEGIN { 20 $VERSION = '0.1 0';20 $VERSION = '0.11'; 21 21 my $plugin = MT::Plugin::Mapper->new({ 22 22 name => 'Mapper', … … 91 91 my $this = shift; 92 92 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; 94 98 $adr =~ s/^\s+//; 95 99 $adr =~ s/\s+$//; 96 my ($lat, $lon); 100 101 my($lat, $lon); 97 102 if ($adr =~ m!^x([-.\d]+)y([-.\d]+)$!) { # map:x<lon>y<lat> 98 103 ($lat, $lon) = ($2, $1); … … 105 110 my $res = ''; 106 111 $res .= $this->preamble unless $this->{count}; 107 $res .= $this->body($lat, $lon, $ adr);112 $res .= $this->body($lat, $lon, $str); 108 113 $this->{count}++; 109 114 $res; … … 224 229 $s =~ s/\s+$//; 225 230 my($str, $opt) = split(/:/, $s); 231 my $adr = $str; 232 $adr =~ s/\(.*\)//ge; 233 $adr =~ s/^\s+//; 234 $adr =~ s/\s+$//; 226 235 227 236 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> 229 238 $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; 232 241 } 233 242 if ($pos) { … … 235 244 } 236 245 237 my $adr = MT::I18N::encode_text($str, '', 'euc-jp') || '';246 $adr = MT::I18N::encode_text($adr, '', 'euc-jp') || ''; 238 247 $adr = MT::Util::encode_url($adr); 239 248 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&opt=$opt" alt="$str" title="$str" /></a></p>];
