summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins
diff options
context:
space:
mode:
authorDino Morelli <dino@ui3.info>2015-01-31 15:43:18 -0500
committerjao <jao@gnu.org>2015-02-01 03:21:31 +0100
commit72acb4ad02d7add803c8bf397aa0f58106cd2672 (patch)
tree4e8bc9a048f19dedcae397f263b93c420c805d2a /src/Plugins
parentd647b5688e5457b1854c5b140437a0d21b05db57 (diff)
downloadxmobar-72acb4ad02d7add803c8bf397aa0f58106cd2672.tar.gz
xmobar-72acb4ad02d7add803c8bf397aa0f58106cd2672.tar.bz2
Added additional wind parser case for "Variable at"
Wind data sometimes looks like this: "Wind: Variable at 3 MPH (3 KT):0" Note the missing direction info. This fix adds an additional parser for this case to pWind.
Diffstat (limited to 'src/Plugins')
-rw-r--r--src/Plugins/Monitors/Weather.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/Weather.hs b/src/Plugins/Monitors/Weather.hs
index 3cfbc74..5d3317e 100644
--- a/src/Plugins/Monitors/Weather.hs
+++ b/src/Plugins/Monitors/Weather.hs
@@ -99,6 +99,12 @@ pWind =
let tospace = manyTill anyChar (char ' ')
wind0 = do manyTill skipRestOfLine (string "Wind: Calm:0")
return pWind0
+ windVar = do manyTill skipRestOfLine (string "Wind: Variable at ")
+ mph <- tospace
+ string "MPH ("
+ knot <- tospace
+ manyTill anyChar newline
+ return ("μ", "μ", mph, knot)
wind = do manyTill skipRestOfLine (string "Wind: from the ")
cardinal <- tospace
char '('
@@ -109,7 +115,7 @@ pWind =
knot <- tospace
manyTill anyChar newline
return (cardinal, azimuth, mph, knot)
- in try wind0 <|> wind
+ in try wind0 <|> try windVar <|> wind
pTemp :: Parser (Int, Int)
pTemp = do let num = digit <|> char '-' <|> char '.'