Changeset 1873
- Timestamp:
- 11/28/06 09:07:41
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/feature-geo/plagger/lib/Plagger/Plugin/Bundle/Geo.pm
r1854 r1873 8 8 $context->autoload_plugin({ module => 'Namespace::Geo' }); 9 9 $context->autoload_plugin({ module => 'Namespace::GeoRSS' }); 10 $context->autoload_plugin({ module => 'Filter::FindMapLinks' }); 10 11 } 11 12 branches/feature-geo/plagger/lib/Plagger/Plugin/Filter/FindMapLinks.pm
r1869 r1873 44 44 45 45 my $p = HTML::LinkExtor->new($callback); 46 $p->parse($body-> html);46 $p->parse($body->data); 47 47 $p->eof; 48 } else { 49 my $finder = URI::Find->new(sub { push @links, $_[1] }); 50 $finder->find(\$body->data); 48 51 } 49 52 … … 94 97 =head1 SEE ALSO 95 98 96 L<Plagger>, L<http://www.locapoint.com/ jp/links.html>99 L<Plagger>, L<http://www.locapoint.com/tool/navito/navi2gwoption.xml> 97 100 98 101 =cut branches/feature-geo/plagger/t/plugins/Filter-FindMapLinks/base.t
r1868 r1873 3 3 4 4 sub filter_config { 5 my $url = Plagger::Util::encode_xml($_[0]); 5 6 return <<CONF; 6 7 plugins: … … 9 10 title: Maps 10 11 entry: 11 - title: Foo12 - title: HTML 12 13 body: | 13 <a href="$_[0]">Foo</a> 14 <a href="$url">Foo</a> 15 - title: Text 16 body: Link to $_[0] 14 17 - module: Filter::FindMapLinks 15 18 CONF 16 19 } 17 20 18 sub lo nlat{21 sub loc { 19 22 my $context = shift; 20 my $loc = $context->update->feeds->[0]->entries->[0]->location;21 return $loc ? join(",", $loc->latitude, $loc->longitude) : "NOLOC";23 my @loc = map $context->update->feeds->[0]->entries->[$_]->location, 0..1; 24 return \@loc; 22 25 } 23 26 27 test_plugin_deps; 28 24 29 filters 'chomp'; 25 filters { input => [ 'filter_config', 'config' , 'lonlat'] };30 filters { input => [ 'filter_config', 'config' ] }; 26 31 27 test_plugin_deps; 28 plan 'no_plan'; 29 run_is; 32 plan tests => 2 * blocks; 33 34 run { 35 my $block = shift; 36 my $context = $block->input; 37 38 for (0..1) { 39 my $entry = $context->update->feeds->[0]->entries->[$_]; 40 my $loc = $entry->location; 41 my $geo = $loc ? join(",", $loc->latitude, $loc->longitude) : "NOLOC"; 42 is $geo, $block->expected, $block->name . " " . $entry->title; 43 } 44 }; 30 45 31 46 __END__ … … 48 63 --- expected 49 64 NOLOC 65 66 === Google Maps UK 67 --- input 68 http://maps.google.co.uk/?q=%2b35.123456,%2b135.123456 69 --- expected 70 35.123456,135.123456 71 72 === Mapion 73 --- SKIP 74 --- input 75 http://www.mapion.co.jp/c/f?uc=1&grp=all&nl=34/37/43.719&el=135/37/08.946&scl=25000&bid=Mlink 76 --- expected 77 34/37/43.719,135/37/08.946
