@@ -32,7 +32,7 @@ the HTML using data URIs.
3232-}
3333module Text.Pandoc.SelfContained ( makeSelfContained ) where
3434import Text.HTML.TagSoup
35−import Network.URI (isURI, escapeURIString)
35+import Network.URI (isURI, escapeURIString, URI(..), parseURI)
3636import Data.ByteString.Base64
3737import qualified Data.ByteString.Char8 as B
3838import Data.ByteString (ByteString)
@@ -116,8 +116,15 @@ getRaw media sourceURL mimetype src = do
116116 $ "Could not determine mime type for `" ++ src ++ "'"
117117 (x, Nothing) -> x
118118 (_, Just x ) -> x
119+ let cssSourceURL = case parseURI src of
120+ Just u
121+ | uriScheme u `elem` ["http:","https:"] ->
122+ Just $ show u{ uriPath = "",
123+ uriQuery = "",
124+ uriFragment = "" }
125+ _ -> Nothing
119126 result <- if mime == "text/css"
120− then cssURLs media (Just src) (takeDirectory src) raw'
127+ then cssURLs media cssSourceURL (takeDirectory src) raw'
121128 else return raw'
122129 return (result, mime)
123130