diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-08-02 16:33:06 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-08-02 16:33:22 -0700 |
commit | 842c705097fbb3987145eae85da2261cb264e618 (patch) | |
tree | d632531375c2d705135fd7f1adf4bac2c1d4ea32 /src/Text | |
parent | 85ff3c57710dc96e4f7e80b51d85f93bffca8a3b (diff) | |
download | pandoc-842c705097fbb3987145eae85da2261cb264e618.tar.gz |
SelfContained: Fixed determining of source URL from within CSS files.
(This fixes a bug introduced a couple commits back.)
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/SelfContained.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index 2bc521409..1a4e037cf 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -32,7 +32,7 @@ the HTML using data URIs. -} module Text.Pandoc.SelfContained ( makeSelfContained ) where import Text.HTML.TagSoup -import Network.URI (isURI, escapeURIString) +import Network.URI (isURI, escapeURIString, URI(..), parseURI) import Data.ByteString.Base64 import qualified Data.ByteString.Char8 as B import Data.ByteString (ByteString) @@ -116,8 +116,15 @@ getRaw media sourceURL mimetype src = do $ "Could not determine mime type for `" ++ src ++ "'" (x, Nothing) -> x (_, Just x ) -> x + let cssSourceURL = case parseURI src of + Just u + | uriScheme u `elem` ["http:","https:"] -> + Just $ show u{ uriPath = "", + uriQuery = "", + uriFragment = "" } + _ -> Nothing result <- if mime == "text/css" - then cssURLs media (Just src) (takeDirectory src) raw' + then cssURLs media cssSourceURL (takeDirectory src) raw' else return raw' return (result, mime) |