mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-25 08:55:55 +00:00
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:
+8
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user