diff --git a/gitit.cabal b/gitit.cabal index efa351817..ee10a5c28 100644 --- a/gitit.cabal +++ b/gitit.cabal @@ -135,7 +135,7 @@ Library directory, mtl, old-time, - pandoc >= 2.9 && < 2.12, + pandoc >= 2.9 && < 2.14, pandoc-types >= 1.20 && < 1.23, skylighting >= 0.8.2.3 && < 0.11, bytestring, diff --git a/src/Network/Gitit/Authentication.hs b/src/Network/Gitit/Authentication.hs index 4c240e7f5..c0f92fd16 100644 --- a/src/Network/Gitit/Authentication.hs +++ b/src/Network/Gitit/Authentication.hs @@ -44,7 +44,7 @@ import System.Exit import System.Log.Logger (logM, Priority(..)) import Data.Char (isAlphaNum, isAlpha) import qualified Data.Map as M -import Text.Pandoc.Shared (substitute) +import Data.List (stripPrefix) import Data.Maybe (isJust, fromJust, isNothing, fromMaybe) import Network.URL (exportURL, add_param, importURL) import Network.BSD (getHostName) @@ -54,6 +54,16 @@ import Codec.Binary.UTF8.String (encodeString) import Data.ByteString.UTF8 (toString) import Network.Gitit.Rpxnow as R +-- | Replace each occurrence of one sublist in a list with another. +-- Vendored in from pandoc 2.11.4 as 2.12 removed this function. +substitute :: (Eq a) => [a] -> [a] -> [a] -> [a] +substitute _ _ [] = [] +substitute [] _ xs = xs +substitute target replacement lst@(x:xs) = + case stripPrefix target lst of + Just lst' -> replacement ++ substitute target replacement lst' + Nothing -> x : substitute target replacement xs + data ValidationType = Register | ResetPassword deriving (Show,Read) diff --git a/src/Network/Gitit/Util.hs b/src/Network/Gitit/Util.hs index c5e9fe518..067130a95 100644 --- a/src/Network/Gitit/Util.hs +++ b/src/Network/Gitit/Util.hs @@ -45,7 +45,11 @@ import Network.URL (encString) -- | Read file as UTF-8 string. Encode filename as UTF-8. readFileUTF8 :: FilePath -> IO Text +#if MIN_VERSION_pandoc(2,12,0) +readFileUTF8 = UTF8.readFile +#else readFileUTF8 = fmap T.pack . UTF8.readFile +#endif -- | Perform a function a directory and return to working directory. inDir :: FilePath -> IO a -> IO a