From 179af414b94965c966774627949327f5b2d147cc Mon Sep 17 00:00:00 2001 From: John Lifsey Date: Wed, 4 Mar 2015 22:58:46 -0500 Subject: [PATCH] Adjust byline to accommodate disscussion in #981 --- lib/DDG/Goodie/Wavelength.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/DDG/Goodie/Wavelength.pm b/lib/DDG/Goodie/Wavelength.pm index 60a399a90..12beff639 100644 --- a/lib/DDG/Goodie/Wavelength.pm +++ b/lib/DDG/Goodie/Wavelength.pm @@ -46,6 +46,8 @@ handle remainder => sub { my ($vf) = $query =~ m/\bvf[ =]([\d\.]+)/i; $vf = 1 if (!$vf or $vf>1 or $vf<0); + my $velocity_text = ($vf == 1 ? '' : "$vf × ").'Speed of light in a vacuum'; + my $mul = MULTIPLIER->{lc($units)}; my $hz_freq = $freq * $mul * (1/$vf); @@ -63,13 +65,14 @@ handle remainder => sub { } } - my $output_text = "λ = $output_value $output_units"; + my $result_text = "λ = $output_value $output_units"; + my $operation_text = "Wavelength of $freq ".FORMAT_UNITS->{lc($units)}." ($velocity_text)"; - return $output_text, + return $result_text, structured_answer => { - input => [$freq, FORMAT_UNITS->{lc($units)}], - operation => "Wavelength ( Velocity Factor $vf × Speed of light in a vacuum )", - result => $output_text, + input => [], + operation => $operation_text, + result => $result_text, }; };