module Codec.Epub.Util
where
import Text.Regex ( mkRegexWithOpts, subRegex )
removeIllegalStartChars :: String -> String
removeIllegalStartChars :: String -> String
removeIllegalStartChars = (Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
dropWhile (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
'<')
removeEncoding :: String -> String
removeEncoding :: String -> String
removeEncoding = (String -> String -> String) -> String -> String -> String
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Regex -> String -> String -> String
subRegex
(String -> Bool -> Bool -> Regex
mkRegexWithOpts String
" +encoding=\"UTF-8\"" Bool
False Bool
False)) String
""
removeDoctype :: String -> String
removeDoctype :: String -> String
removeDoctype = (String -> String -> String) -> String -> String -> String
forall a b c. (a -> b -> c) -> b -> a -> c
flip (Regex -> String -> String -> String
subRegex
(String -> Bool -> Bool -> Regex
mkRegexWithOpts String
"<!DOCTYPE [^>]*>" Bool
False Bool
True)) String
""