Merge git://github.com/flaming-toast/zeroclickinfo-goodies into unicornify
commit
7d3aa3b964
3
dist.ini
3
dist.ini
|
@ -24,6 +24,9 @@ Locale::SubCountry = 1.47
|
|||
Unicode::Char = 0.02
|
||||
Number::UN = 0.002
|
||||
Locale::Language = 3.21
|
||||
Gravatar::URL = 1.06
|
||||
CGI = 3.60
|
||||
Email::Valid = 0.190
|
||||
; ParseCron
|
||||
Schedule::Cron::Events = 0
|
||||
Convert::Color = 0.08
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package DDG::Goodie::Unicornify;
|
||||
# ABSTRACT: Return Gravatar image given an email address
|
||||
|
||||
use DDG::Goodie;
|
||||
use CGI qw/img/;
|
||||
use Email::Valid;
|
||||
use Unicornify::URL;
|
||||
|
||||
triggers start => 'unicornify';
|
||||
|
||||
|
||||
handle remainder => sub {
|
||||
my $link = 'http://unicornify.appspot.com/';
|
||||
if (Email::Valid->address($_)) {
|
||||
s/[\s\t]+//g; # strip whitespace from the remainder, we just need the email address.
|
||||
return $_ . '\'s unicorn:',
|
||||
html => $_ . '\'s unicorn (<a href="'.$link.'">Learn more at unicornify.appspot.com</a>):'
|
||||
.'<br /><a href="' . unicornify_url(email => $_, size => 128) .'">'
|
||||
.'<img src="'.unicornify_url(email => $_, size => "100").'" style="margin: 10px 0px 10px 20px; border-radius: 8px;" /></a>';
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
zci is_cached => 1;
|
||||
|
||||
1;
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => 'gravatar';
|
||||
zci is_cached => 1;
|
||||
ddg_goodie_test(
|
||||
[qw(
|
||||
DDG::Goodie::Gravatar
|
||||
)],
|
||||
'gravatar kumimoko.yo@gmail.com' => test_zci('<img src="http://www.gravatar.com/avatar/06ecae11d1c3cea65e3f03245c8a31e4?d=mm" />'),
|
||||
);
|
||||
|
||||
done_testing;
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
use Unicornify::URL;
|
||||
|
||||
|
||||
zci answer_type => 'unicornify';
|
||||
zci is_cached => 1;
|
||||
ddg_goodie_test(
|
||||
[qw(
|
||||
DDG::Goodie::Unicornify
|
||||
)],
|
||||
'unicornify bob@bob.com' =>
|
||||
test_zci('bob@bob.com\'s unicorn:',
|
||||
html => 'bob@bob.com\'s unicorn (<a href="http://unicornify.appspot.com/">Learn more at unicornify.appspot.com</a>):<br />'
|
||||
.'<a href="'.unicornify_url(email => 'bob@bob.com', size => 128).'">'
|
||||
.'<img src="'.unicornify_url(email=>'bob@bob.com', size => 100).'" style="margin: 10px 0px 10px 20px; border-radius: 8px;" /></a>'));
|
||||
|
||||
done_testing;
|
Loading…
Reference in New Issue