1module Text.Pandoc.CSS ( foldOrElse,
6import Text.Pandoc.Shared (trim)
8import Text.Parsec.String
10ruleParser :: Parser (String, String)
12 p <- many1 (noneOf ":") <* char ':'
13 v <- many1 (noneOf ":;") <* (optional $ char ';') <* spaces
14 return (trim p, trim v)
16styleAttrParser :: Parser [(String, String)]
17styleAttrParser = many1 ruleParser
19orElse :: Eq a => a -> a -> a -> a
20orElse v x y = if v == x then y else x
22foldOrElse :: Eq a => a -> [a] -> a
23foldOrElse v xs = foldr (orElse v) v xs
25eitherToMaybe :: Either a b -> Maybe b
26eitherToMaybe (Right x) = Just x
27eitherToMaybe _ = Nothing
29pickStyleAttrProps :: [String] -> String -> Maybe String
30pickStyleAttrProps lookupProps styleAttr = do
31 styles <- eitherToMaybe $ parse styleAttrParser "" styleAttr
32 foldOrElse Nothing $ map (flip lookup styles) lookupProps
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list