diff options
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Hakyll/File.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs index ec9d0fb..d8ee8db 100644 --- a/src/Text/Hakyll/File.hs +++ b/src/Text/Hakyll/File.hs @@ -16,13 +16,17 @@ module Text.Hakyll.File import System.Directory import System.FilePath import Control.Monad +import Data.List (isPrefixOf) -- | Auxiliary function to remove pathSeparators form the start. We don't deal --- with absolute paths here. +-- with absolute paths here. We also remove $root from the start. removeLeadingSeparator :: FilePath -> FilePath removeLeadingSeparator [] = [] -removeLeadingSeparator p@(x:xs) | x `elem` pathSeparators = xs - | otherwise = p +removeLeadingSeparator path + | (head path') `elem` pathSeparators = (tail path') + | otherwise = path' + where path' = if "$root" `isPrefixOf` path then drop 5 path + else path -- | Convert a relative filepath to a filepath in the destination (_site). toDestination :: FilePath -> FilePath |