on master help sign in
Compacted the code by unifying all the similar prefix options.
ec1486cNicole Rauch
src/Hakyll/Web/CompressCss.hs+6−9
@@ -37,17 +37,14 @@ compressSeparators [] = []
37compressSeparators str
37compressSeparators str
38 | isPrefixOf "\"" str = head str : retainConstants compressSeparators "\"" (drop 1 str)
38 | isPrefixOf "\"" str = head str : retainConstants compressSeparators "\"" (drop 1 str)
39 | isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
39 | isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
40− | isPrefixOf " " str = compressSeparators (drop 1 str)
41− | isPrefixOf " {" str = compressSeparators (drop 1 str)
42− | isPrefixOf " }" str = compressSeparators (drop 1 str)
43− | isPrefixOf " ;" str = compressSeparators (drop 1 str)
44− | isPrefixOf ";;" str = compressSeparators (drop 1 str)
40+ | stripFirst = compressSeparators (drop 1 str)
45− | isPrefixOf "{ " str = compressSeparators (head str : (drop 2 str))
46− | isPrefixOf "} " str = compressSeparators (head str : (drop 2 str))
47− | isPrefixOf "; " str = compressSeparators (head str : (drop 2 str))
41+ | stripSecond = compressSeparators (head str : (drop 2 str))
48 | isPrefixOf ";}" str = '}' : compressSeparators (drop 2 str)
42 | isPrefixOf ";}" str = '}' : compressSeparators (drop 2 str)
49 | otherwise = head str : compressSeparators (drop 1 str)
43 | otherwise = head str : compressSeparators (drop 1 str)
50−
44+ where
45+ prefix p = isPrefixOf p str
46+ stripFirst = or $ map prefix [" ", " {", " }", ";;"]
47+ stripSecond = or $ map prefix ["{ ", "} ", "; "]
51
48
52--------------------------------------------------------------------------------
49--------------------------------------------------------------------------------
53-- | Compresses all whitespace.
50-- | Compresses all whitespace.