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.
This commit is contained in:
John MacFarlane 2016-11-05 20:21:38 +01:00
parent e6422b1deb
commit 7db4dd46dc

View file

@ -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