pandoc 1.9.4.2 → 1.9.4.3
raw patch · 9 files changed
+66/−25 lines, 9 filesdep ~containersdep ~directorysetup-changed
Dependency ranges changed: containers, directory
Files
- MakeManPage.hs +15/−3
- Setup.hs +15/−3
- changelog +7/−0
- pandoc.cabal +7/−7
- src/Text/Pandoc/Readers/LaTeX.hs +4/−2
- src/Text/Pandoc/Writers/EPUB.hs +2/−0
- src/Text/Pandoc/Writers/ODT.hs +4/−2
- src/Text/Pandoc/Writers/RTF.hs +3/−1
- src/pandoc.hs +9/−7
MakeManPage.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} -- Create pandoc.1 man and pandoc_markdown.5 man pages from README import Text.Pandoc import Data.ByteString.UTF8 (toString, fromString)@@ -10,8 +11,18 @@ import System.Directory (getModificationTime) import System.IO.Error (isDoesNotExistError) import System.Time (ClockTime(..))+import Data.Time.Clock+import Data.Default+import Data.Time.Clock.POSIX import Data.Maybe (catMaybes)+import qualified Control.Exception as E +instance Default ClockTime where+ def = (TOD 0 0)++instance Default UTCTime where+ def = posixSecondsToUTCTime (0::NominalDiffTime)+ main = do rmContents <- liftM toString $ B.readFile "README" let (Pandoc meta blocks) = readMarkdown defaultParserState rmContents@@ -47,13 +58,14 @@ -- | Returns a list of 'dependencies' that have been modified after 'file'. modifiedDependencies :: FilePath -> [FilePath] -> IO [FilePath] modifiedDependencies file dependencies = do- fileModTime <- catch (getModificationTime file) $- \e -> if isDoesNotExistError e- then return (TOD 0 0) -- the minimum ClockTime+ fileModTime <- E.catch (getModificationTime file) $+ \(e::E.IOException) -> if isDoesNotExistError e+ then return def -- the minimum ClockTime else ioError e depModTimes <- mapM getModificationTime dependencies let modified = zipWith (\dep time -> if time > fileModTime then Just dep else Nothing) dependencies depModTimes return $ catMaybes modified+ removeLinks :: Inline -> [Inline] removeLinks (Link l _) = l
Setup.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} import Distribution.Simple import Distribution.Simple.Setup (copyDest, copyVerbosity, fromFlag, installVerbosity, BuildFlags(..))@@ -19,7 +20,17 @@ import System.IO.Error ( isDoesNotExistError ) import Data.Maybe ( catMaybes ) import Data.List ( (\\) )+import Data.Time.Clock+import Data.Default+import Data.Time.Clock.POSIX+import qualified Control.Exception as E +instance Default ClockTime where+ def = (TOD 0 0)++instance Default UTCTime where+ def = posixSecondsToUTCTime (0::NominalDiffTime)+ main :: IO () main = do defaultMainWithHooks $ simpleUserHooks {@@ -89,12 +100,13 @@ installOrdinaryFiles verbosity (mandir (absoluteInstallDirs pkg lbi copy)) (zip (repeat manDir) manpages) + -- | Returns a list of 'dependencies' that have been modified after 'file'. modifiedDependencies :: FilePath -> [FilePath] -> IO [FilePath] modifiedDependencies file dependencies = do- fileModTime <- catch (getModificationTime file) $- \e -> if isDoesNotExistError e- then return (TOD 0 0) -- the minimum ClockTime+ fileModTime <- E.catch (getModificationTime file) $+ \(e::E.IOException) -> if isDoesNotExistError e+ then return def -- the minimum ClockTime else ioError e depModTimes <- mapM getModificationTime dependencies let modified = zipWith (\dep time -> if time > fileModTime then Just dep else Nothing) dependencies depModTimes
changelog view
@@ -1,3 +1,10 @@+pandoc (1.9.4.3)++ * Removed `-threaded` from default compile flags.++ * Modified modules to compile with GHC 7.6 and latest version of time+ package.+ pandoc (1.9.4.2) * Don't encode/decode file paths if base >= 4.4.
pandoc.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-Version: 1.9.4.2+Version: 1.9.4.3 Cabal-Version: >= 1.10 Build-Type: Custom License: GPL@@ -199,13 +199,13 @@ -- Note: the following is duplicated in all stanzas. -- It needs to be duplicated because of the library & executable flags. -- BEGIN DUPLICATED SECTION- Build-Depends: containers >= 0.1 && < 0.5,+ Build-Depends: containers >= 0.1 && < 0.6, parsec >= 3.1 && < 3.2, mtl >= 1.1 && < 2.2, network >= 2 && < 2.4, filepath >= 1.1 && < 1.4, process >= 1 && < 1.2,- directory >= 1 && < 1.2,+ directory >= 1 && < 1.3, bytestring >= 0.9 && < 1.0, zip-archive >= 0.1.1.7 && < 0.2, utf8-string >= 0.3 && < 0.4,@@ -307,13 +307,13 @@ -- Note: the following is duplicated in all stanzas. -- It needs to be duplicated because of the library & executable flags. -- BEGIN DUPLICATED SECTION- Build-Depends: containers >= 0.1 && < 0.5,+ Build-Depends: containers >= 0.1 && < 0.6, parsec >= 3.1 && < 3.2, mtl >= 1.1 && < 2.2, network >= 2 && < 2.4, filepath >= 1.1 && < 1.4, process >= 1 && < 1.2,- directory >= 1 && < 1.2,+ directory >= 1 && < 1.3, bytestring >= 0.9 && < 1.0, zip-archive >= 0.1.1.7 && < 0.2, utf8-string >= 0.3 && < 0.4,@@ -374,13 +374,13 @@ -- Note: the following is duplicated in all stanzas. -- It needs to be duplicated because of the library & executable flags. -- BEGIN DUPLICATED SECTION- Build-Depends: containers >= 0.1 && < 0.5,+ Build-Depends: containers >= 0.1 && < 0.6, parsec >= 3.1 && < 3.2, mtl >= 1.1 && < 2.2, network >= 2 && < 2.4, filepath >= 1.1 && < 1.4, process >= 1 && < 1.2,- directory >= 1 && < 1.2,+ directory >= 1 && < 1.3, bytestring >= 0.9 && < 1.0, zip-archive >= 0.1.1.7 && < 0.2, utf8-string >= 0.3 && < 0.4,
src/Text/Pandoc/Readers/LaTeX.hs view
@@ -27,6 +27,7 @@ Conversion of LaTeX to 'Pandoc' document. -}+{-# LANGUAGE ScopedTypeVariables #-} module Text.Pandoc.Readers.LaTeX ( readLaTeX, rawLaTeXInline, rawLaTeXBlock,@@ -47,6 +48,7 @@ import System.FilePath (replaceExtension) import Data.List (intercalate) import qualified Data.Map as M+import qualified Control.Exception as E (catch, IOException) -- | Parse LaTeX from string and return 'Pandoc' document. readLaTeX :: ParserState -- ^ Parser state, including options for parser@@ -671,8 +673,8 @@ handleIncludes [] = return [] handleIncludes ('\\':xs) = case runParser include defaultParserState "input" ('\\':xs) of- Right (fs, rest) -> do let getfile f = catch (UTF8.readFile f)- (\_ -> return "")+ Right (fs, rest) -> do let getfile f = E.catch (UTF8.readFile f)+ (\(_::E.IOException) -> return "") yss <- mapM getfile fs (intercalate "\n" yss ++) `fmap` handleIncludes rest
src/Text/Pandoc/Writers/EPUB.hs view
@@ -48,7 +48,9 @@ import Data.Char ( toLower ) import Network.URI ( unEscapeString ) import Text.Pandoc.MIME (getMimeType)+#if ! MIN_VERSION_base(4,6,0) import Prelude hiding (catch)+#endif import Control.Exception (catch, SomeException) -- | Produce an EPUB file from a Pandoc document.
src/Text/Pandoc/Writers/ODT.hs view
@@ -27,6 +27,7 @@ Conversion of 'Pandoc' documents to ODT. -}+{-# LANGUAGE ScopedTypeVariables #-} module Text.Pandoc.Writers.ODT ( writeODT ) where import Data.IORef import Data.List ( isPrefixOf )@@ -47,6 +48,7 @@ import Network.URI ( unEscapeString ) import Text.Pandoc.XML import Text.Pandoc.Pretty+import qualified Control.Exception as E (catch, IOException) -- | Produce an ODT file from a Pandoc document. writeODT :: Maybe FilePath -- ^ Path specified by --reference-odt@@ -110,9 +112,9 @@ Nothing -> tit entries <- readIORef entriesRef let newsrc = "Pictures/" ++ show (length entries) ++ takeExtension src'- catch (readEntry [] (sourceDir </> src') >>= \entry ->+ E.catch (readEntry [] (sourceDir </> src') >>= \entry -> modifyIORef entriesRef (entry{ eRelativePath = newsrc } :) >> return (Image lab (newsrc, tit')))- (\_ -> return (Emph lab))+ (\(_::E.IOException) -> return (Emph lab)) transformPic _ _ x = return x
src/Text/Pandoc/Writers/RTF.hs view
@@ -27,6 +27,7 @@ Conversion of 'Pandoc' documents to RTF (rich text format). -}+{-# LANGUAGE ScopedTypeVariables #-} module Text.Pandoc.Writers.RTF ( writeRTF, rtfEmbedImage ) where import Text.Pandoc.Definition import Text.Pandoc.Shared@@ -38,6 +39,7 @@ import qualified Data.ByteString as B import Text.Printf ( printf ) import Network.URI ( isAbsoluteURI, unEscapeString )+import qualified Control.Exception as E (catch, IOException) -- | Convert Image inlines into a raw RTF embedded image, read from a file. -- If file not found or filetype not jpeg or png, leave the inline unchanged.@@ -47,7 +49,7 @@ if ext `elem` [".jpg",".jpeg",".png"] && not (isAbsoluteURI src) then do let src' = unEscapeString src- imgdata <- catch (B.readFile src') (\_ -> return B.empty)+ imgdata <- E.catch (B.readFile src') (\(_::E.IOException) -> return B.empty) let bytes = map (printf "%02x") $ B.unpack imgdata let filetype = case ext of ".jpg" -> "\\jpegblip"
src/pandoc.hs view
@@ -29,6 +29,7 @@ Parses command-line options and calls the appropriate readers and writers. -}+{-# LANGUAGE ScopedTypeVariables #-} module Main where import Text.Pandoc import Text.Pandoc.PDF (tex2pdf)@@ -62,6 +63,7 @@ #else import Codec.Binary.UTF8.String (decodeString, encodeString) #endif+import qualified Control.Exception as E (catch, IOException) encodePath, decodeArg :: FilePath -> FilePath #if MIN_VERSION_base(4,4,0)@@ -837,9 +839,9 @@ let sources = if ignoreArgs then [] else args datadir <- case mbDataDir of- Nothing -> catch+ Nothing -> E.catch (liftM Just $ getAppUserDataDirectory "pandoc")- (const $ return Nothing)+ (\(_::E.IOException) -> return Nothing) Just _ -> return mbDataDir -- assign reader and writer based on options and filenames@@ -890,12 +892,12 @@ let tp' = case takeExtension tp of "" -> tp <.> format _ -> tp- catch (UTF8.readFile tp')- (\e -> if isDoesNotExistError e- then catch+ E.catch (UTF8.readFile tp')+ (\(e::E.IOException) -> if isDoesNotExistError e+ then E.catch (readDataFile datadir $ "templates" </> tp')- (\_ -> throwIO e)+ (\(_::E.IOException) -> throwIO e) else throwIO e) let slideVariant = case writerName' of@@ -926,7 +928,7 @@ -- that we can do lookups with regular string equality let unescapeRefId ref = ref{ refId = fromEntities (refId ref) } - refs <- mapM (\f -> catch (CSL.readBiblioFile f) $ \e ->+ refs <- mapM (\f -> E.catch (CSL.readBiblioFile f) $ \(e::E.IOException) -> err 23 $ "Error reading bibliography `" ++ f ++ "'" ++ "\n" ++ show e) reffiles >>= return . map unescapeRefId . concat