From 7db4dd46dc2fba2cb3ec2a6c3191c3147b2b215f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 5 Nov 2016 20:21:38 +0100 Subject: Allow `file://` URIs as arguments. Also improved default reader format detection. Previously with a URI ending in .md or .markdown, pandoc would assume HTML input. Now it treats these as markdown. Closes #3196. --- pandoc.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandoc.hs b/pandoc.hs index 06bfa148c..3394c79dd 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -1019,6 +1019,8 @@ defaultReaderName fallback (x:xs) = ".xhtml" -> "html" ".html" -> "html" ".htm" -> "html" + ".md" -> "markdown" + ".markdown" -> "markdown" ".tex" -> "latex" ".latex" -> "latex" ".ltx" -> "latex" @@ -1375,6 +1377,8 @@ convertWithOpts opts args = do readSource src = case parseURI src of Just u | uriScheme u `elem` ["http:","https:"] -> readURI src + | uriScheme u == "file:" -> + UTF8.readFile (uriPath u) _ -> UTF8.readFile src readURI src = do res <- openURL src -- cgit v1.2.3