git.iko.soy/typeable/pandoc
on master help sign in
SelfContained: Fix handling of absolute URLs in css imports.

Also allow single-quoted values. Closes #535.

commit6cdfde58076187daf4909ccd128067da5a1fe7f1 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 28 Jun 2012, 18:35 (14 years ago) parentd812036
1 file changed+5−1
src/Text/Pandoc/SelfContained.hs+5−1
src/Text/Pandoc/SelfContained.hs+5−1
@@ -121,8 +121,12 @@ cssURLs userdata d orig =
121121 let url = toString
122122 $ case B.take 1 u of
123123 "\"" -> B.takeWhile (/='"') $ B.drop 1 u
124+ "'" -> B.takeWhile (/='\'') $ B.drop 1 u
124125 _ -> u
125− (raw, mime) <- getRaw userdata "" (d </> url)
126+ let url' = if isAbsoluteURI url
127+ then url
128+ else d </> url
129+ (raw, mime) <- getRaw userdata "" url'
126130 rest <- cssURLs userdata d v
127131 let enc = "data:" `B.append` fromString mime `B.append`
128132 ";base64," `B.append` (encode raw)