@@ -178,12 +178,21 @@ pCSSUrl sourceURL d = P.try $ do
178178 P.char ')'
179179 let fallback = B.pack ("url(" ++ maybe "" (:[]) quote ++ trim url ++
180180 maybe "" (:[]) quote ++ ")")
181− case trim url of
181+ -- pipes are used in URLs provided by Google Code fonts
182+ -- but parseURI doesn't like them, so we escape them:
183+ case escapeURIString (/='|') (trim url) of
182184 '#':_ -> return fallback
183185 'd':'a':'t':'a':':':_ -> return fallback
184186 u -> do let url' = if isURI u then u else d </> u
185− enc <- lift $ getDataURI sourceURL "" url'
186− return (B.pack $ "url(" ++ enc ++ ")")
187+ res <- lift $ getData sourceURL "" url'
188+ case res of
189+ Left uri -> return (B.pack $ "url(" ++ uri ++ ")")
190+ Right (mt, raw) -> do
191+ -- note that the downloaded content may
192+ -- itself contain url(...).
193+ raw' <- cssURLs sourceURL d raw
194+ let enc = makeDataURI (mt, raw')
195+ return (B.pack $ "url(" ++ enc ++ ")")
187196
188197getDataURI :: PandocMonad m => Maybe String -> MimeType -> String -> m String
189198getDataURI sourceURL mimetype src = do