Merge pull request #2085 from duckduckgo/zt/template-handler

Make the handle a template parameter
master
Ben Moon 2016-02-16 08:34:41 +00:00
commit 246509ae52
2 changed files with 6 additions and 6 deletions

View File

@ -14,12 +14,12 @@ zci answer_type => '<: $ia_id :>';
zci is_cached => 1;
# Triggers - http://docs.duckduckhack.com/walkthroughs/calculation.html#triggers
triggers any => 'triggerword', 'trigger phrase';
triggers <: $ia_trigger :>;
# Handle statement
handle remainder => sub {
handle <: $ia_handler :> => sub {
my $remainder = $_;
my <: $ia_handler_var :><: $ia_handler :> = <: $ia_handler_var :>_;
# Optional - Guard against no remainder
# I.E. the query is only 'triggerWord' or 'trigger phrase'

View File

@ -13,10 +13,10 @@ zci answer_type => '<: $ia_id :>';
zci is_cached => 1;
# Triggers - https://duck.co/duckduckhack/goodie_triggers
triggers any => 'triggerword', 'trigger phrase';
triggers <: $ia_trigger :>;
# Handle statement
handle remainder => sub {
handle <: $ia_handler :> => sub {
return "plain text response",
structured_answer => {
@ -31,7 +31,7 @@ handle remainder => sub {
name => 'Answer',
data => {
remainder => $_
<: $ia_handler :> => \<: $ia_handler_var :>_
},
templates => {