Allow absolute URI as parameter (in this case, content is downloaded).

+ Adds dependency on HTTP.
+ If a parameter is an absolute URI, pandoc will try to
  get the content via HTTP.
+ So, you can do:  pandoc -r html -w markdown http://www.fsf.org

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1826 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher
2010-02-02 07:37:01 +00:00
parent 19b0c72dd1
commit 9fee73d2a3
4 changed files with 28 additions and 7 deletions
+8 -1
View File
@@ -59,6 +59,9 @@ import Text.CSL
import Text.Pandoc.Biblio
#endif
import Control.Monad (when, unless)
import Network.HTTP
import Network.URI (parseURI)
import Data.ByteString.Lazy.UTF8 (toString)
copyrightMessage :: String
copyrightMessage = "\nCopyright (C) 2006-8 John MacFarlane\n" ++
@@ -731,7 +734,11 @@ main = do
let readSources [] = mapM readSource ["-"]
readSources srcs = mapM readSource srcs
readSource "-" = getContents
readSource src = readFile src
readSource src = case parseURI src of
Just u -> readURI u
Nothing -> readFile src
readURI uri = simpleHTTP (mkRequest GET uri) >>= getResponseBody >>=
return . toString -- treat all as UTF8
let convertTabs = tabFilter (if preserveTabs then 0 else tabStop)