switch to a safe version of </>
This commit is contained in:
parent
e3d1f22ff1
commit
7a60fce085
2
Tags.hs
2
Tags.hs
|
@ -14,7 +14,7 @@ import qualified Data.Yaml as Y
|
||||||
import Lens.Micro
|
import Lens.Micro
|
||||||
import Lens.Micro.Aeson
|
import Lens.Micro.Aeson
|
||||||
import Lens.Micro.Mtl
|
import Lens.Micro.Mtl
|
||||||
import System.FilePath ((</>), joinPath, splitDirectories, takeFileName)
|
import System.FilePath (joinPath, splitDirectories, takeFileName)
|
||||||
|
|
||||||
import AesonUtils
|
import AesonUtils
|
||||||
import Types
|
import Types
|
||||||
|
|
12
Utils.hs
12
Utils.hs
|
@ -28,7 +28,7 @@ import System.Directory
|
||||||
, doesDirectoryExist
|
, doesDirectoryExist
|
||||||
, getDirectoryContents
|
, getDirectoryContents
|
||||||
)
|
)
|
||||||
import System.FilePath ((</>), splitDirectories, takeDirectory)
|
import System.FilePath (splitDirectories, takeDirectory)
|
||||||
import Text.Pandoc.Definition
|
import Text.Pandoc.Definition
|
||||||
import qualified Text.Pandoc.Walk
|
import qualified Text.Pandoc.Walk
|
||||||
import Types
|
import Types
|
||||||
|
@ -96,6 +96,16 @@ unAbsolute = dropWhile (== '/')
|
||||||
withPandocBlocks :: ([Block] -> [Block]) -> Pandoc -> Pandoc
|
withPandocBlocks :: ([Block] -> [Block]) -> Pandoc -> Pandoc
|
||||||
withPandocBlocks f (Pandoc meta blocks) = Pandoc meta (f blocks)
|
withPandocBlocks f (Pandoc meta blocks) = Pandoc meta (f blocks)
|
||||||
|
|
||||||
|
infixr 5 </>
|
||||||
|
|
||||||
|
a </> b@('/':_) =
|
||||||
|
error
|
||||||
|
$ "internal error: unchecked concatenation of absolute path: "
|
||||||
|
++ a
|
||||||
|
++ " </> "
|
||||||
|
++ b
|
||||||
|
a </> b = (System.FilePath.</>) a b
|
||||||
|
|
||||||
-- | Get all contents of a directory. (Interned from Hakyll.)
|
-- | Get all contents of a directory. (Interned from Hakyll.)
|
||||||
getRecursiveContents ::
|
getRecursiveContents ::
|
||||||
(FilePath -> IO Bool) -- ^ Ignore this file/directory
|
(FilePath -> IO Bool) -- ^ Ignore this file/directory
|
||||||
|
|
|
@ -306,7 +306,7 @@ installRedirect target' from = do
|
||||||
target <- rootedPageLink target'
|
target <- rootedPageLink target'
|
||||||
tname <- use redirectTemplate
|
tname <- use redirectTemplate
|
||||||
templ <- use $ templates . to (M.! fromString tname)
|
templ <- use $ templates . to (M.! fromString tname)
|
||||||
file <- indexFilename from
|
file <- indexFilename (unAbsolute from)
|
||||||
checkTarget file
|
checkTarget file
|
||||||
io $ do
|
io $ do
|
||||||
putStrLn $ "@ -> " ++ file ++ " -> " ++ target
|
putStrLn $ "@ -> " ++ file ++ " -> " ++ target
|
||||||
|
|
Loading…
Reference in a new issue