Skip to content

Commit

Permalink
Remove use of 'html_enc' (duckduckgo#3567)
Browse files Browse the repository at this point in the history
* removed html_enc from ABC,ANAGRAM,AVERAGE,BASE64,BITSUM,CHARS

* string interpolation fixed

* string interpolation fix
  • Loading branch information
JSSaini07 authored and GuiltyDolphin committed Sep 3, 2016
1 parent 1b73ba6 commit f79cef4
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions lib/DDG/Goodie/ABC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ handle remainder => sub {

# Multi-inputs to single input.
my $last = pop @choices;
my $choice_string = join(', ', @choices) . ' or ' . $last;
my $operation = $selection_type . ' selection from';
my $choice_string = join(', ', @choices) ." or $last";
my $operation = "$selection_type selection from";

return $selection . " (" . $selection_type . ")",
return "$selection ($selection_type)",
structured_answer => {
data => {
title => html_enc("$selection"),
subtitle => html_enc("$operation: $choice_string")
title => "$selection",
subtitle => "$operation: $choice_string"
},
templates => {
group => 'text',
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/Anagram.pm
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ handle remainder => sub {
return $response,
structured_answer => {
data => {
title => html_enc($response),
subtitle => $operation . ' ' . html_enc($word)
title => $response,
subtitle => "$operation $word"
},
templates => {
group => 'text',
Expand Down
4 changes: 2 additions & 2 deletions lib/DDG/Goodie/Average.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ handle remainder => sub {
return "$type: $result",
structured_answer => {
data => {
title => html_enc($result),
subtitle => $type . ' of: ' . html_enc($_)
title => $result,
subtitle => "$type of: $_"
},
templates => {
group => 'text'
Expand Down
8 changes: 4 additions & 4 deletions lib/DDG/Goodie/Base64.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ handle remainder => sub {

my $output = perform_conversion($command, $input);

my $operation = 'Base64 ' . $command;
return $operation . 'd: ' . $output,
my $operation = "Base64 $command";
return "$operation d: $output",
structured_answer => {
data => {
title => html_enc($output),
subtitle => $operation . ': ' . html_enc($input)
title => $output,
subtitle => "$operation: $input"
},
templates => {
group => 'text'
Expand Down
6 changes: 3 additions & 3 deletions lib/DDG/Goodie/Bitsum.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ handle remainder => sub {

# Count ones
my $result = $binstring =~ tr/1/1/;
$input_number .= ' (Base '.$base.', '.$base_string.')';
$input_number = "$input_number (Base $base, $base_string)";

return $result,
structured_answer => {
data => {
title => html_enc($result),
subtitle => 'Hamming Weight Calculation: ' . html_enc($input_number)
title => $result,
subtitle => "Hamming Weight Calculation: $input_number"
},
templates => {
group => 'text'
Expand Down
2 changes: 1 addition & 1 deletion lib/DDG/Goodie/Chars.pm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ handle remainder => sub {
structured_answer => {
data => {
title => $len,
subtitle => 'Character count: ' . html_enc($str)
subtitle => "Character count: $str"
},
templates => {
group => 'text'
Expand Down
2 changes: 1 addition & 1 deletion t/Average.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sub build_structured_answer {
structured_answer => {
data => {
title => $result,
subtitle => $type . ' of: ' . $input
subtitle => "$type of: $input"
},
templates => {
group => 'text'
Expand Down
4 changes: 2 additions & 2 deletions t/Base64.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zci is_cached => 1;

sub build_structured_answer {
my ($input, $operation, $output) = @_;
return $operation . 'd: ' . $output,
return "$operation d: $output",
structured_answer => {
data => {
title => $output,
subtitle => $operation . ': ' . $input
subtitle => "$operation: $input"
},
templates => {
group => 'text'
Expand Down
2 changes: 1 addition & 1 deletion t/Bitsum.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sub build_structured_answer {
structured_answer => {
data => {
title => $result,
subtitle => 'Hamming Weight Calculation: ' . $input_number
subtitle => "Hamming Weight Calculation: $input_number"
},
templates => {
group => 'text'
Expand Down
2 changes: 1 addition & 1 deletion t/Chars.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sub build_structured_answer {
structured_answer => {
data => {
title => $len,
subtitle => 'Character count: ' . $str
subtitle => "Character count: $str"
},
templates => {
group => 'text'
Expand Down

0 comments on commit f79cef4

Please sign in to comment.