aboutsummaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-01-11 15:44:50 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2013-01-11 15:44:50 -0800
commitacfe1d96ee43ecc0b6908a4f2bceaee0c33a0178 (patch)
tree71f3a6d532181aea1a4a34c01faa50d61419ead3 /pandoc.hs
parent1cc4e7db52e73ecb3facb879ecc95f9eb4f1316f (diff)
downloadpandoc-acfe1d96ee43ecc0b6908a4f2bceaee0c33a0178.tar.gz
pandoc.hs: Fix writerSourceDirectory when a URL is provided.
It should be the URL up to the path.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs10
1 files 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'))