git.iko.soy/typeable/pandoc
on master help sign in
Use uriPathToPath with file: URIs.
780bf64John MacFarlane
src/Text/Pandoc/App.hs+2−2
@@ -93,7 +93,7 @@ import Text.Pandoc.Highlighting (highlightingStyles)
93import Text.Pandoc.PDF (makePDF)
93import Text.Pandoc.PDF (makePDF)
94import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)
94import Text.Pandoc.SelfContained (makeDataURI, makeSelfContained)
95import Text.Pandoc.Shared (eastAsianLineBreakFilter, stripEmptyParagraphs,
95import Text.Pandoc.Shared (eastAsianLineBreakFilter, stripEmptyParagraphs,
96− headerShift, isURI, ordNub, safeRead, tabFilter)
96+ headerShift, isURI, ordNub, safeRead, tabFilter, uriPathToPath)
97import qualified Text.Pandoc.UTF8 as UTF8
97import qualified Text.Pandoc.UTF8 as UTF8
98import Text.Pandoc.Writers.Math (defaultKaTeXURL, defaultMathJaxURL)
98import Text.Pandoc.Writers.Math (defaultKaTeXURL, defaultMathJaxURL)
99import Text.Pandoc.XML (toEntities)
99import Text.Pandoc.XML (toEntities)
@@ -795,7 +795,7 @@ readSource src = case parseURI src of
795 readURI src
795 readURI src
796 | uriScheme u == "file:" ->
796 | uriScheme u == "file:" ->
797 liftIO $ UTF8.toText <$>
797 liftIO $ UTF8.toText <$>
798− BS.readFile (uriPath u)
798+ BS.readFile (uriPathToPath $ uriPath u)
799 _ -> liftIO $ UTF8.toText <$>
799 _ -> liftIO $ UTF8.toText <$>
800 BS.readFile src
800 BS.readFile src
801
801
src/Text/Pandoc/Class.hs+2−1
@@ -110,6 +110,7 @@ import qualified Text.Pandoc.UTF8 as UTF8
110import qualified System.Directory as Directory
110import qualified System.Directory as Directory
111import Data.Time (UTCTime)
111import Data.Time (UTCTime)
112import Text.Pandoc.Logging
112import Text.Pandoc.Logging
113+import Text.Pandoc.Shared (uriPathToPath)
113import Text.Parsec (ParsecT, getPosition, sourceLine, sourceName)
114import Text.Parsec (ParsecT, getPosition, sourceLine, sourceName)
114import qualified Data.Time as IO (getCurrentTime)
115import qualified Data.Time as IO (getCurrentTime)
115import Text.Pandoc.MIME (MimeType, getMimeType, extensionFromMimeType)
116import Text.Pandoc.MIME (MimeType, getMimeType, extensionFromMimeType)
@@ -598,7 +599,7 @@ downloadOrRead s = do
598 -- We don't want to treat C:/ as a scheme:
599 -- We don't want to treat C:/ as a scheme:
599 Just u' | length (uriScheme u') > 2 -> openURL (show u')
600 Just u' | length (uriScheme u') > 2 -> openURL (show u')
600 Just u' | uriScheme u' == "file:" ->
601 Just u' | uriScheme u' == "file:" ->
601− readLocalFile $ dropWhile (=='/') (uriPath u')
602+ readLocalFile $ uriPathToPath (uriPath u')
602 _ -> readLocalFile fp -- get from local file system
603 _ -> readLocalFile fp -- get from local file system
603 where readLocalFile f = do
604 where readLocalFile f = do
604 resourcePath <- getResourcePath
605 resourcePath <- getResourcePath