From acfe1d96ee43ecc0b6908a4f2bceaee0c33a0178 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 11 Jan 2013 15:44:50 -0800 Subject: pandoc.hs: Fix writerSourceDirectory when a URL is provided. It should be the URL up to the path. --- pandoc.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pandoc.hs b/pandoc.hs index c176db078..20278d2d0 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -968,9 +968,13 @@ main = do return $ Just csl { CSL.styleAbbrevs = abbrevs } else return Nothing - let sourceDir = if null sources - then "." - else takeDirectory (head sources) + let sourceDir = case sources of + [] -> "." + (x:_) -> case parseURI x of + Just u + | uriScheme u `elem` ["http:","https:"] -> + show u{ uriPath = "", uriQuery = "", uriFragment = "" } + _ -> takeDirectory x let readerOpts = def{ readerSmart = smart || (texLigatures && (laTeXOutput || "context" `isPrefixOf` writerName')) -- cgit v1.2.3