Merge pull request #2 from vrs/master

X.H.DynamicLog: make xmobarStrip actually strip xmobar tags
This commit is contained in:
geekosaur 2015-09-11 17:03:05 -04:00
commit 32f3fbdb2f

View File

@ -398,7 +398,11 @@ xmobarColor fg bg = wrap t "</fc>"
-- | Strip xmobar markup, specifically the <fc>, <icon> and <action> tags and -- | Strip xmobar markup, specifically the <fc>, <icon> and <action> tags and
-- the matching tags like </fc>. -- the matching tags like </fc>.
xmobarStrip :: String -> String xmobarStrip :: String -> String
xmobarStrip = xmobarStripTags ["fc","icon","action"] where xmobarStrip = converge (xmobarStripTags ["fc","icon","action"]) where
converge :: (Eq a) => (a -> a) -> a -> a
converge f a = let xs = iterate f a
in fst $ head $ dropWhile (uncurry (/=)) $ zip xs $ tail xs
xmobarStripTags :: [String] -- ^ tags xmobarStripTags :: [String] -- ^ tags
-> String -> String -- ^ with all <tag>...</tag> removed -> String -> String -- ^ with all <tag>...</tag> removed