diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-11-08 16:56:59 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-11-08 16:56:59 -0800 |
commit | c423dbb5a34c2d1195020e0f0ca3aae883d0749b (patch) | |
tree | a118d6561e1886fe019f51599c5c1258606eadd4 /src/Text/Pandoc/Shared.hs | |
parent | da056191182777c4e4e951d3aae49c6428677fc7 (diff) | |
download | pandoc-c423dbb5a34c2d1195020e0f0ca3aae883d0749b.tar.gz |
Use -XNoImplicitPrelude and 'import Prelude' explicitly.
This is needed for ghci to work with pandoc, given that we
now use a custom prelude.
Closes #2503.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index a40b1d4e9..91ccfb134 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -97,6 +97,7 @@ module Text.Pandoc.Shared ( pandocVersion ) where +import Prelude import Text.Pandoc.Definition import Text.Pandoc.Walk import Text.Pandoc.MediaBag (MediaBag, lookupMedia) @@ -246,7 +247,7 @@ trim = triml . trimr -- | Remove leading space (including newlines) from string. triml :: String -> String -triml = dropWhile (`elem` " \r\n\t") +triml = dropWhile (`elem` [' ','\r','\n','\t']) -- | Remove trailing space (including newlines) from string. trimr :: String -> String @@ -659,7 +660,7 @@ inlineListToIdentifier :: [Inline] -> String inlineListToIdentifier = dropWhile (not . isAlpha) . intercalate "-" . words . map (nbspToSp . toLower) . - filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") . + filter (\c -> isLetter c || isDigit c || c `elem` ['_','-','.',' ']) . stringify where nbspToSp '\160' = ' ' nbspToSp x = x @@ -913,9 +914,9 @@ fetchItem' media sourceURL s = do -- | Read from a URL and return raw data and maybe mime type. openURL :: String -> IO (Either E.SomeException (BS.ByteString, Maybe MimeType)) openURL u - | Just u' <- stripPrefix "data:" u = - let mime = takeWhile (/=',') u' - contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u' + | Just u'' <- stripPrefix "data:" u = + let mime = takeWhile (/=',') u'' + contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u'' in return $ Right (decodeLenient contents, Just mime) #ifdef HTTP_CLIENT | otherwise = withSocketsDo $ E.try $ do |