2014-06-13 06:59:01 -07:00
|
|
|
package DDG::Goodie::URLEncode;
|
|
|
|
# ABSTRACT: Displays the percent-encoded url.
|
|
|
|
|
|
|
|
use DDG::Goodie;
|
|
|
|
use URI::Encode qw(uri_encode);
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
zci answer_type => 'encoded_url';
|
|
|
|
primary_example_queries 'url encode http://nospaces.duckduckgo.com/hook em horns' , 'encode url xkcd.com/a webcomic of%romance+math+sarcasm+language';
|
|
|
|
secondary_example_queries 'http://arstechnica.com/spaces after end url encode', 'apple.com/mac encode URL';
|
|
|
|
description 'Displays the percent-encoded url';
|
|
|
|
name 'URLEncode';
|
|
|
|
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/URLEncode.pm';
|
|
|
|
category 'computing_tools';
|
|
|
|
topics 'programming', 'web_design';
|
|
|
|
attribution twitter => ['nshanmugham', 'Nishanth Shanmugham'],
|
|
|
|
web => ['http://nishanths.github.io', 'Nishanth Shanmugham'],
|
|
|
|
github => ['https://github.com/nishanths', 'Nishanth Shanmugham'];
|
|
|
|
|
2014-06-16 07:37:26 -07:00
|
|
|
triggers startend => 'url encode', 'encode url', 'urlencode', 'encodeurl', 'urlescape';
|
2014-06-13 06:59:01 -07:00
|
|
|
my $url = "https://en.wikipedia.org/wiki/Url_encoding";
|
|
|
|
handle remainder => sub {
|
|
|
|
my $holder = uri_encode($_);
|
2014-06-16 14:29:20 -07:00
|
|
|
return "Encoded URL: $holder", html => "<div>Encoded URL: $holder</div><div><a class=\"zci__more-at\" href=\"$url\">More at Wikipedia</a></div>";
|
2014-06-13 06:59:01 -07:00
|
|
|
};
|
|
|
|
1;
|