Dessert: Fixed typos.
[zeroclickinfo-goodies.git] / lib / DDG / Goodie / Dessert.pm
1 package DDG::Goodie::Dessert;
2
3 use DDG::Goodie;
4
5 sub itemify{
6 my $i = rand scalar @_;
7 return '<a href="http://duckduckgo.com/2/' . $_[$i] . '">' . $_[$i] . '</a> <a style="font-size: 10px;" href="http://duckduckgo.com/?q=' . $_[$i] . '+recipe">(recipes)</a>';
8 };
9
10 my %desserts = (
11 a => ['Apple Turnover'],
12 b => ['Banana Split', 'Biscuits'],
13 c => ['Cherry Pie', 'Cupcake', 'Chocolate'],
14 d => ['Donut'],
15 e => ['Eclair'],
16 f => ['Froyo', 'Fudge'],
17 g => ['Gingerbread'],
18 h => ['Honeycomb'],
19 i => ['Ice Cream Sandwich', 'Ice Cream'],
20 j => ['Jam Rolly Polly','Jelly Bean','Jelly'],
21 k => ['Key Lime Pie'],
22 l => ['Lollipop','Liqourice'],
23 m => ['Macaroons','Meringues','Marshmallow','Muffin'],
24 n => ['Nougat','Nutella'],
25 o => ['Oatmeal Pie','Oreos'],
26 p => ['Profiteroles','Pop Tart'],
27 q => ['Quiche'],
28 r => ['Rocky Road','Red Velvet Cake','Ruhbarb and Custard'],
29 s => ['Sundae','Strudel','Strawberries and Cream','Souffle'],
30 t => ['Tiramisu','Trifle','Twinkies','Taffy','Toffee'],
31 u => ['Unicorn Cake','Upside-down cake'],
32 v => ['Vanilla Swirl'],
33 w => ['Waffles','Watermelon','White Chocolate'],
34 x => ['Xmas Cake'],
35 z => ['Zepolle','Zucchini Pie'],
36 );
37
38 triggers start => 'dessert', 'desserts';
39 handle remainder => sub{
40 if(lc $_ =~ m/^(?:that )?(?:start|beginn?)s?(?:ing)? ?(?:with)? ([a-zA-Z])$/i){
41 my $in = lc $1;
42 my $output = 'A desert beginning with ' . (uc $in) . ' is ';
43
44 my $items = $desserts{lc $in};
45 $output .= itemify(@{$items});
46 return $output;
47 }
48 return;
49 };
50
51 zci is_cached => 0;
52 1;