aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-01 22:14:50 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-01 22:15:43 -0700
commit9b2f645e2adbdc61bfd626e4ce828cb072f29f71 (patch)
tree334401fe84ff2c5e71fc0f2a7939ce5975fe8f79 /src/Text
parent4b2f469994143728c2ffe22aa37370b90a054e15 (diff)
downloadpandoc-9b2f645e2adbdc61bfd626e4ce828cb072f29f71.tar.gz
SelfContained: cssURLs no longer tries to fetch fragment URLs.
The current test is: does the URL start with a `#`? Closes #2121.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/SelfContained.hs18
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)