@@ -8,6 +8,7 @@ module Text.Hakyll.File
8 , removeSpaces
8 , removeSpaces
9 , makeDirectories
9 , makeDirectories
10 , getRecursiveContents
10 , getRecursiveContents
11 , havingExtension
12 , havingExtension
12 , isMoreRecent
13 , isMoreRecent
13 , directory
14 , directory
@@ -16,7 +17,7 @@ module Text.Hakyll.File
16import System.Directory
17import System.Directory
17import System.FilePath
18import System.FilePath
18import Control.Monad
19import Control.Monad
19−import Data.List (isPrefixOf)
20+import Data.List (isPrefixOf, sortBy)
20import Control.Monad.Reader (liftIO)
21import Control.Monad.Reader (liftIO)
22import Text.Hakyll.Hakyll
23import Text.Hakyll.Hakyll
@@ -100,6 +101,12 @@ getRecursiveContents topdir = do
101 isProper = not . (== '.') . head
102 isProper = not . (== '.') . head
104+-- | Sort a list of filenames on the basename.
105+sortByBaseName :: [FilePath] -> [FilePath]
106+sortByBaseName = sortBy compareBaseName
108+ compareBaseName f1 f2 = compare (takeFileName f1) (takeFileName f2)
103-- | A filter that takes all file names with a given extension. Prefix the
110-- | A filter that takes all file names with a given extension. Prefix the
104-- extension with a dot:
111-- extension with a dot: