on master help sign in
Added $root in filepaths.
commit7a765f29a2f5dcf753e5418c96a9c40ddb9112be authorJasper Van der Jeugt <jaspervdj@gmail.com> dateMon 11 Jan 2010, 10:02 (17 years ago) parenteb1fe13
2 files changed+8−4
examples/tagblog/hakyll.hs+1−1 src/Text/Hakyll/File.hs+7−3
examples/tagblog/hakyll.hs+1−1
@@ -58,7 +58,7 @@ main = hakyll $ do
5858 postManipulation = renderDate "date" "%B %e, %Y" "Date unknown"
5959 . renderTagLinks tagToURL
6060
61− tagToURL tag = "/tags/" ++ removeSpaces tag ++ ".html"
61+ tagToURL tag = "$root/tags/" ++ removeSpaces tag ++ ".html"
6262
6363 renderPostList url title posts = do
6464 let postItems = renderAndConcatWith postManipulation
src/Text/Hakyll/File.hs+7−3
@@ -16,13 +16,17 @@ module Text.Hakyll.File
1616import System.Directory
1717import System.FilePath
1818import Control.Monad
19+import Data.List (isPrefixOf)
1920
2021-- | Auxiliary function to remove pathSeparators form the start. We don't deal
21−-- with absolute paths here.
22+-- with absolute paths here. We also remove $root from the start.
2223removeLeadingSeparator :: FilePath -> FilePath
2324removeLeadingSeparator [] = []
24−removeLeadingSeparator p@(x:xs) | x `elem` pathSeparators = xs
25− | otherwise = p
25+removeLeadingSeparator path
26+ | (head path') `elem` pathSeparators = (tail path')
27+ | otherwise = path'
28+ where path' = if "$root" `isPrefixOf` path then drop 5 path
29+ else path
2630
2731-- | Convert a relative filepath to a filepath in the destination (_site).
2832toDestination :: FilePath -> FilePath