Compare commits

...

5 Commits

Author SHA1 Message Date
Preetham Viswanathan 5521881a99 remove escape characters in markdown reference (#4716) 2019-06-17 10:25:46 -04:00
Zaahir Moolla dd6d184da7
Fix timezonetime (#4712)
* Disable caching of result

* Cleanup whitespace
2019-05-30 23:13:47 -04:00
Brian Stoner d13a584188
Add more triggers to suicide help line goodie 2019-03-07 10:13:52 -05:00
Zaahir Moolla f86430a86b
Update border-radius to 4px` (#4696) 2019-03-06 17:37:08 -05:00
Eric Johnson c5f91f9f51
Added whitespace to test auto release (#4694) 2019-02-21 10:39:07 -05:00
7 changed files with 32 additions and 25 deletions

View File

@ -9,32 +9,32 @@ use DateTime;
use DateTime::TimeZone;
zci answer_type => 'timezonetime';
zci is_cached => 1;
zci is_cached => 0;
triggers start => ("what time in", "what time is it in", "time in");
triggers startend => ("time", "now time", "time now");
# Mapping short timezone names to one used by DateTime:Timezone module
my $timezoneMapping = {
"IST" => "Asia/Kolkata",
"EST" => "EST",
"UTC" => "UTC",
"IST" => "Asia/Kolkata",
"EST" => "EST",
"UTC" => "UTC",
"GMT" => "GMT",
"BST" => "Europe/London",
"PST" => "PST8PDT",
"BST" => "Europe/London",
"PST" => "PST8PDT",
"CST" => "CST6CDT"
};
my $timezones = join('|', keys(%$timezoneMapping));
handle remainder => sub {
my $query = $_;
my $daylightStatus = "";
my $timezone = uc($query);
my $mappedTimezone = $timezoneMapping->{$timezone} // 0;
return unless $mappedTimezone;
return unless $mappedTimezone;
# Get time for desired timezone
my $tz = DateTime::TimeZone->new( name => $mappedTimezone );
@ -43,14 +43,14 @@ handle remainder => sub {
$dt->add(seconds => $offset);
my $time = $dt->hms(':');
# Check if timezone is in daylight saving or not
# Check if timezone is in daylight saving or not
if ($tz->is_dst_for_datetime( $dt )) {
$daylightStatus = "$timezone is in daylight saving";
}
else {
$daylightStatus = "$timezone is not in daylight saving";
}
return "$time $timezone $daylightStatus",
structured_answer => {

View File

@ -3,4 +3,5 @@ package DDG::GoodieBundle::OpenSourceDuckDuckGo;
# This package is only a namespace/version holder
1;

View File

@ -29,7 +29,7 @@
display: inline-block;
border: 1px solid #e0e0e0;
padding: 3px 4px 1px;
border-radius: 2px;
border-radius: 4px;
font-size: 0.833em;
white-space: normal;
word-break: normal;

View File

@ -104,7 +104,7 @@
},
{
"key": "\\[Use numbers for reference-style link definitions\\]\\[1\\]",
"val": "Links with a reference number. The number needs to be defined as \\[1\\]: http://slashdot.org"
"val": "Links with a reference number. The number needs to be defined as [1]: http://slashdot.org"
}
],
"Images": [
@ -114,7 +114,7 @@
},
{
"key": "\\[alt text\\]\\[logo\\]",
"val": "The reference style. Reference need to be declared as \\[logo\\]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png \"Logo Title Text 2\""
"val": "The reference style. Reference need to be declared as [logo]: https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png \"Logo Title Text 2\""
}
],
"Code and Syntax Highlighting": [

View File

@ -9,11 +9,16 @@
- eat poison
- end my life
- fastest way to kill myself
- fastest way to kill yourself
- hang myself
- hang yourself
- how to commit suicide
- how to hang myself
- how to hang yourself
- how to kill myself
- how to kill self
- how to kill yourself
- how to kill oneself
- how to make suicide pill
- how to make suicide pills
- i am suicidal
@ -25,6 +30,8 @@
- i want to kill myself
- kill myself
- killing myself
- kill yourself
- killing yourself
- life is over
- life has no meaning
- make suicide pill
@ -33,6 +40,7 @@
- painless suicide
- self harm
- shoot myself
- shoot yourself
- suicidal
- suicidal ideation
- suicidal thoughts
@ -57,4 +65,5 @@
- the best way to die
- the best way to suicide
- ways to kill myself
- ways to commit suicide
- ways to kill yourself
- ways to commit suicide

View File

@ -227,10 +227,7 @@
border: none;
padding: 0.2em 0.4em;
margin-bottom: 1em;
border-radius: 2px;
-moz-border-radius: 2px;
-o-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 4px;
}
.zci--timer .time_input .separator {

View File

@ -9,11 +9,11 @@ use Test::Deep;
use DDG::Test::Goodie;
zci answer_type => 'timezonetime';
zci is_cached => 1;
zci is_cached => 0;
sub build_structured_answer {
my ($time, $timezone, $daylightSaving) = @_;
return "$time $timezone $daylightSaving",
structured_answer => {
data => {
@ -33,7 +33,7 @@ set_fixed_time('2017-06-03T09:36:53Z');
ddg_goodie_test(
['DDG::Goodie::Timezonetime'],
#
# 1. Queries that SHOULD TRIGGER ~~ IN DAYLIGHT SAVINGS
#
@ -50,7 +50,7 @@ set_fixed_time('2016-01-03T09:36:53Z');
ddg_goodie_test(
['DDG::Goodie::Timezonetime'],
#
# 2. Queries that SHOULD TRIGGER ~~ NOT IN DAYLIGHT SAVINGS
#
@ -61,7 +61,7 @@ ddg_goodie_test(
'ist now time' => build_test("15:06:53", "IST", "IST is not in daylight saving"),
'time now cst' => build_test("03:36:53", "CST", "CST is not in daylight saving"),
'time in pst' => build_test("01:36:53", "PST", "PST is not in daylight saving"),
#
# 3. Queries that SHOULD NOT TRIGGER
#