@@ -97,7 +97,6 @@ module Text.Pandoc.Shared (
97 pandocVersion
97 pandocVersion
101import Text.Pandoc.Definition
100import Text.Pandoc.Definition
102import Text.Pandoc.Walk
101import Text.Pandoc.Walk
103import Text.Pandoc.MediaBag (MediaBag, lookupMedia)
102import Text.Pandoc.MediaBag (MediaBag, lookupMedia)
@@ -247,7 +246,7 @@ trim = triml . trimr
248-- | Remove leading space (including newlines) from string.
247-- | Remove leading space (including newlines) from string.
249triml :: String -> String
248triml :: String -> String
250−triml = dropWhile (`elem` [' ','\r','\n','\t'])
249+triml = dropWhile (`elem` " \r\n\t")
252-- | Remove trailing space (including newlines) from string.
251-- | Remove trailing space (including newlines) from string.
253trimr :: String -> String
252trimr :: String -> String
@@ -660,7 +659,7 @@ inlineListToIdentifier :: [Inline] -> String
660inlineListToIdentifier =
659inlineListToIdentifier =
661 dropWhile (not . isAlpha) . intercalate "-" . words .
660 dropWhile (not . isAlpha) . intercalate "-" . words .
662 map (nbspToSp . toLower) .
661 map (nbspToSp . toLower) .
663− filter (\c -> isLetter c || isDigit c || c `elem` ['_','-','.',' ']) .
662+ filter (\c -> isLetter c || isDigit c || c `elem` "_-. ") .
664 stringify
663 stringify
665 where nbspToSp '\160' = ' '
664 where nbspToSp '\160' = ' '
666 nbspToSp x = x
665 nbspToSp x = x
@@ -914,9 +913,9 @@ fetchItem' media sourceURL s = do
914-- | Read from a URL and return raw data and maybe mime type.
913-- | Read from a URL and return raw data and maybe mime type.
915openURL :: String -> IO (Either E.SomeException (BS.ByteString, Maybe MimeType))
914openURL :: String -> IO (Either E.SomeException (BS.ByteString, Maybe MimeType))
917− | Just u'' <- stripPrefix "data:" u =
916+ | Just u' <- stripPrefix "data:" u =
918− let mime = takeWhile (/=',') u''
917+ let mime = takeWhile (/=',') u'
919− contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u''
918+ contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u'
920 in return $ Right (decodeLenient contents, Just mime)
919 in return $ Right (decodeLenient contents, Just mime)
921#ifdef HTTP_CLIENT
920#ifdef HTTP_CLIENT
922 | otherwise = withSocketsDo $ E.try $ do
921 | otherwise = withSocketsDo $ E.try $ do