Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Commit 4783cde

Browse files
pjhamptonmoollaza
authored andcommitted
Fix micro symbol issue. (#4484)
1 parent 95214cc commit 4783cde

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

lib/DDG/Goodie/Conversions.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ handle query => sub {
205205
$_ =~ s/"/inch/;
206206
$_ =~ s/'/foot/;
207207

208+
# hack around the dropped micro symbol
209+
$_ =~ s/μ/micro/;
210+
208211
if($_ =~ /(\d+)\s*(?:feet|foot)\s*(\d+)(?:\s*inch(?:es)?)?/i){
209212
my $feetHack = $1 + $2/12;
210213
$_ =~ s/(\d+)\s*(?:feet|foot)\s*(\d+)(?:\s*inch(?:es)?)?/$feetHack feet/i;

share/goodie/conversions/triggers.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ aliases:
6060
- mcgs
6161
- microgram
6262
- micrograms
63+
- microg
64+
- micro g
65+
- micro grams
6366
type: mass
6467
unit: microgram
6568
symbols: [µg]
@@ -368,6 +371,8 @@ aliases:
368371
- micrometers
369372
- micro meter
370373
- micro meters
374+
- microm
375+
- micro m
371376
- µms
372377
- µm
373378
type: length
@@ -760,6 +765,8 @@ aliases:
760765
- micro seconds
761766
- micro-second
762767
- micro-seconds
768+
- micros
769+
- micro s
763770
- µs
764771
type: duration
765772
unit: microsecond

t/Conversions.t

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2644,7 +2644,38 @@ ddg_goodie_test(
26442644
physical_quantity => 'length'
26452645
})
26462646
),
2647-
2647+
'nanometer to micron' => test_zci(
2648+
'', structured_answer => make_answer({
2649+
raw_input => '1',
2650+
from_unit => 'nanometer',
2651+
to_unit => 'micrometer',
2652+
physical_quantity => 'length'
2653+
})
2654+
),
2655+
'nanometer to μm ' => test_zci(
2656+
'', structured_answer => make_answer({
2657+
raw_input => '1',
2658+
from_unit => 'nanometer',
2659+
to_unit => 'micrometer',
2660+
physical_quantity => 'length'
2661+
})
2662+
),
2663+
'seconds to μs' => test_zci(
2664+
'', structured_answer => make_answer({
2665+
raw_input => '1',
2666+
from_unit => 'second',
2667+
to_unit => 'microsecond',
2668+
physical_quantity => 'duration'
2669+
})
2670+
),
2671+
'grams to μg' => test_zci(
2672+
'', structured_answer => make_answer({
2673+
raw_input => '1',
2674+
from_unit => 'gram',
2675+
to_unit => 'microgram',
2676+
physical_quantity => 'mass'
2677+
})
2678+
),
26482679

26492680
# natural language queries
26502681
'unit converter' => test_zci(

0 commit comments

Comments
 (0)