diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-05-01 22:14:50 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-05-01 22:15:43 -0700 |
commit | 9b2f645e2adbdc61bfd626e4ce828cb072f29f71 (patch) | |
tree | 334401fe84ff2c5e71fc0f2a7939ce5975fe8f79 | |
parent | 4b2f469994143728c2ffe22aa37370b90a054e15 (diff) | |
download | pandoc-9b2f645e2adbdc61bfd626e4ce828cb072f29f71.tar.gz |
SelfContained: cssURLs no longer tries to fetch fragment URLs.
The current test is: does the URL start with a `#`?
Closes #2121.
-rw-r--r-- | src/Text/Pandoc/SelfContained.hs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index fab4c23d1..8c5fc617a 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -97,18 +97,22 @@ cssURLs media sourceURL d orig = (x,y) | B.null y -> return orig | otherwise -> do let (u,v) = B.breakSubstring ")" $ B.drop 4 y + rest <- cssURLs media sourceURL d v let url = toString $ case B.take 1 u of "\"" -> B.takeWhile (/='"') $ B.drop 1 u "'" -> B.takeWhile (/='\'') $ B.drop 1 u _ -> u - let url' = if isURI url - then url - else d </> url - (raw, mime) <- getRaw media sourceURL "" url' - rest <- cssURLs media sourceURL d v - let enc = fromString $ makeDataURI mime raw - return $ x `B.append` "url(" `B.append` enc `B.append` rest + case url of + '#':_ -> return $ x `B.append` rest + _ -> do + let url' = if isURI url + then url + else d </> url + (raw, mime) <- getRaw media sourceURL "" url' + let enc = fromString $ makeDataURI mime raw + return $ x `B.append` "url(" `B.append` enc + `B.append` rest getRaw :: MediaBag -> Maybe String -> MimeType -> String -> IO (ByteString, MimeType) |