[Home]WikiPatches/GoogleMaps

UseModWiki | WikiPatches | RecentChanges | Preferences

See MeatBall:GoogleMaps -- SunirShah

Next to QuoteHTML:

sub QuoteUrl {
    my ($url) = @_;
    $url =~ s/ /+/g;
    $url =~ s/([^a-zA-Z0-9_.%;&?\/\\:+=~-])/sprintf("%%%02X",ord($1))/eg;
    return $url;
}

Around CommonMarkup:

sub GoogleMaps {
    my ($address) = @_;
    my $text = $address;
    $address =~ s/\bwest\b/W/i;
    $address =~ s/\beast\b/E/i;
    $address =~ s/\bnorth\b/N/i;
    $address =~ s/\bsouth\b/S/i;

    $address = &QuoteUrl($address);
    return &StoreRaw("<a href='http://maps.google.com/maps?q=$address'>Map:\"$text\"</a>");
}

Somewhere in CommonMarkup:

s@Map:\"([^\"]+)"@&GoogleMaps($1)@eg;

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 6, 2005 3:13 pm by MarkusLude (diff)
Search: