git.iko.soy/typeable/pandoc
on master help sign in
pandoc.hs: Fix writerSourceDirectory when a URL is provided.

It should be the URL up to the path.

commitacfe1d96ee43ecc0b6908a4f2bceaee0c33a0178 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 11 Jan 2013, 15:44 (14 years ago) parent1cc4e7d
1 file changed+7−3
pandoc.hs+7−3
pandoc.hs+7−3
@@ -968,9 +968,13 @@ main = do
968968 return $ Just csl { CSL.styleAbbrevs = abbrevs }
969969 else return Nothing
970970
971− let sourceDir = if null sources
972− then "."
973− else takeDirectory (head sources)
971+ let sourceDir = case sources of
972+ [] -> "."
973+ (x:_) -> case parseURI x of
974+ Just u
975+ | uriScheme u `elem` ["http:","https:"] ->
976+ show u{ uriPath = "", uriQuery = "", uriFragment = "" }
977+ _ -> takeDirectory x
974978
975979 let readerOpts = def{ readerSmart = smart || (texLigatures &&
976980 (laTeXOutput || "context" `isPrefixOf` writerName'))